TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ GetSleepingTargetInfo()

static bool Terraria.GameContent.PlayerSleepingHelper.GetSleepingTargetInfo ( int x,
int y,
out int targetDirection,
out Vector2 anchorPosition,
out Vector2 visualoffset )
inlinestatic

Definition at line 229 of file PlayerSleepingHelper.cs.

230 {
231 //IL_0025: Unknown result type (might be due to invalid IL or missing references)
232 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
233 //IL_008b: Unknown result type (might be due to invalid IL or missing references)
234 //IL_0090: Unknown result type (might be due to invalid IL or missing references)
235 //IL_009a: Unknown result type (might be due to invalid IL or missing references)
236 //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
237 //IL_00ab: Unknown result type (might be due to invalid IL or missing references)
238 //IL_00b1: Unknown result type (might be due to invalid IL or missing references)
239 //IL_00d5: Unknown result type (might be due to invalid IL or missing references)
240 //IL_00e2: Unknown result type (might be due to invalid IL or missing references)
241 //IL_0103: Unknown result type (might be due to invalid IL or missing references)
242 //IL_0108: Unknown result type (might be due to invalid IL or missing references)
243 //IL_010f: Unknown result type (might be due to invalid IL or missing references)
244 //IL_0114: Unknown result type (might be due to invalid IL or missing references)
245 //IL_011b: Unknown result type (might be due to invalid IL or missing references)
246 //IL_012a: Unknown result type (might be due to invalid IL or missing references)
247 //IL_012f: Unknown result type (might be due to invalid IL or missing references)
248 //IL_0146: Unknown result type (might be due to invalid IL or missing references)
249 //IL_014b: Unknown result type (might be due to invalid IL or missing references)
250 //IL_014d: Unknown result type (might be due to invalid IL or missing references)
251 //IL_0152: Unknown result type (might be due to invalid IL or missing references)
252 Tile tileSafely = Framing.GetTileSafely(x, y);
253 if (!TileID.Sets.CanBeSleptIn[tileSafely.type] || !tileSafely.active())
254 {
255 targetDirection = 1;
256 anchorPosition = default(Vector2);
257 visualoffset = default(Vector2);
258 return false;
259 }
260 int num = y;
261 int num4 = x - tileSafely.frameX % 72 / 18;
262 if (tileSafely.frameY % 36 != 0)
263 {
264 num--;
265 }
266 targetDirection = 1;
267 int num2 = tileSafely.frameX / 72;
268 int num3 = num4;
269 switch (num2)
270 {
271 case 0:
272 targetDirection = -1;
273 num3++;
274 break;
275 case 1:
276 num3 += 2;
277 break;
278 }
282 num3 = info.AnchorTilePosition.X;
283 num = info.AnchorTilePosition.Y;
284 int directionOffset = info.DirectionOffset;
285 targetDirection = info.TargetDirection;
286 visualoffset = info.VisualOffset;
287 Vector2 finalOffset = info.FinalOffset;
288 anchorPosition = Utils.ToWorldCoordinates(new Point(num3, num + 1), 8f, 16f);
289 anchorPosition.X += targetDirection * directionOffset;
291 return true;
292 }
static bool[] CanBeSleptIn
Definition TileID.cs:185
static void ModifySleepingTargetInfo(int i, int j, int type, ref TileRestingInfo info)
This serves as the central class from which tile-related functions are supported and carried out.
Definition TileLoader.cs:23
Holds data required for offsetting an entity when it rests on a tile (sitting/sleeping).

References Terraria.ID.TileID.Sets.CanBeSleptIn, Terraria.Framing.GetTileSafely(), Terraria.ModLoader.TileLoader.ModifySleepingTargetInfo(), Terraria.GameContent.PlayerSleepingHelper.SetOffsetbyBed(), and Terraria.Utils.ToWorldCoordinates().

Referenced by Terraria.GameContent.PlayerSleepingHelper.StartSleeping(), and Terraria.GameContent.PlayerSleepingHelper.UpdateState().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: