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

◆ GetSittingTargetInfo()

static bool Terraria.GameContent.PlayerSittingHelper.GetSittingTargetInfo ( Player player,
int x,
int y,
out int targetDirection,
out Vector2 playerSittingPosition,
out Vector2 seatDownOffset,
out ExtraSeatInfo extraInfo )
inlinestatic

Definition at line 184 of file PlayerSittingHelper.cs.

185 {
186 //IL_002e: Unknown result type (might be due to invalid IL or missing references)
187 //IL_0033: Unknown result type (might be due to invalid IL or missing references)
188 //IL_003a: Unknown result type (might be due to invalid IL or missing references)
189 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
190 //IL_0050: Unknown result type (might be due to invalid IL or missing references)
191 //IL_0057: Unknown result type (might be due to invalid IL or missing references)
192 //IL_005c: Unknown result type (might be due to invalid IL or missing references)
193 //IL_0224: Unknown result type (might be due to invalid IL or missing references)
194 //IL_0229: Unknown result type (might be due to invalid IL or missing references)
195 //IL_0489: Unknown result type (might be due to invalid IL or missing references)
196 //IL_0490: Unknown result type (might be due to invalid IL or missing references)
197 //IL_0498: Unknown result type (might be due to invalid IL or missing references)
198 //IL_04b9: Unknown result type (might be due to invalid IL or missing references)
199 //IL_04c6: Unknown result type (might be due to invalid IL or missing references)
200 //IL_04e6: Unknown result type (might be due to invalid IL or missing references)
201 //IL_04eb: Unknown result type (might be due to invalid IL or missing references)
202 //IL_04f2: Unknown result type (might be due to invalid IL or missing references)
203 //IL_04f7: Unknown result type (might be due to invalid IL or missing references)
204 //IL_050b: Unknown result type (might be due to invalid IL or missing references)
205 //IL_051a: Unknown result type (might be due to invalid IL or missing references)
206 //IL_051f: Unknown result type (might be due to invalid IL or missing references)
207 //IL_0538: Unknown result type (might be due to invalid IL or missing references)
208 //IL_053d: Unknown result type (might be due to invalid IL or missing references)
209 //IL_053f: Unknown result type (might be due to invalid IL or missing references)
210 //IL_0544: Unknown result type (might be due to invalid IL or missing references)
211 //IL_042c: Unknown result type (might be due to invalid IL or missing references)
212 //IL_042e: Unknown result type (might be due to invalid IL or missing references)
213 //IL_0473: Unknown result type (might be due to invalid IL or missing references)
214 //IL_0478: Unknown result type (might be due to invalid IL or missing references)
215 //IL_047a: Unknown result type (might be due to invalid IL or missing references)
216 //IL_047f: Unknown result type (might be due to invalid IL or missing references)
217 //IL_0468: Unknown result type (might be due to invalid IL or missing references)
218 //IL_046a: Unknown result type (might be due to invalid IL or missing references)
219 //IL_045d: Unknown result type (might be due to invalid IL or missing references)
220 //IL_045f: Unknown result type (might be due to invalid IL or missing references)
221 extraInfo = default(ExtraSeatInfo);
222 Tile tileSafely = Framing.GetTileSafely(x, y);
223 if (!TileID.Sets.CanBeSatOnForPlayers[tileSafely.type] || !tileSafely.active())
224 {
225 targetDirection = 1;
226 seatDownOffset = Vector2.Zero;
227 playerSittingPosition = default(Vector2);
228 return false;
229 }
230 int num = x;
231 int num2 = y;
232 targetDirection = 1;
233 seatDownOffset = Vector2.Zero;
234 int num3 = 6;
235 Vector2 zero = Vector2.Zero;
236 switch (tileSafely.type)
237 {
238 case 15:
239 case 497:
240 {
241 bool num7 = tileSafely.type == 15 && (tileSafely.frameY / 40 == 1 || tileSafely.frameY / 40 == 20);
242 bool value = tileSafely.type == 15 && tileSafely.frameY / 40 == 27;
243 seatDownOffset.Y = value.ToInt() * 4;
244 if (tileSafely.frameY % 40 != 0)
245 {
246 num2--;
247 }
248 targetDirection = -1;
249 if (tileSafely.frameX != 0)
250 {
251 targetDirection = 1;
252 }
253 if (num7 || tileSafely.type == 497)
254 {
255 extraInfo.IsAToilet = true;
256 }
257 break;
258 }
259 case 102:
260 {
261 int num5 = tileSafely.frameX / 18;
262 if (num5 == 0)
263 {
264 num++;
265 }
266 if (num5 == 2)
267 {
268 num--;
269 }
270 int num6 = tileSafely.frameY / 18;
271 if (num6 == 0)
272 {
273 num2 += 2;
274 }
275 if (num6 == 1)
276 {
277 num2++;
278 }
279 if (num6 == 3)
280 {
281 num2--;
282 }
283 targetDirection = player.direction;
284 num3 = 0;
285 break;
286 }
287 case 487:
288 {
289 int num4 = tileSafely.frameX % 72 / 18;
290 if (num4 == 1)
291 {
292 num--;
293 }
294 if (num4 == 2)
295 {
296 num++;
297 }
298 if (tileSafely.frameY / 18 != 0)
299 {
300 num2--;
301 }
302 targetDirection = (num4 <= 1).ToDirectionInt();
303 num3 = 0;
304 seatDownOffset.Y -= 1f;
305 break;
306 }
307 case 89:
308 {
309 targetDirection = player.direction;
310 num3 = 0;
311 Vector2 vector = default(Vector2);
312 ((Vector2)(ref vector))._002Ector(-4f, 2f);
313 Vector2 vector2 = default(Vector2);
314 ((Vector2)(ref vector2))._002Ector(4f, 2f);
315 Vector2 vector3 = default(Vector2);
316 ((Vector2)(ref vector3))._002Ector(0f, 2f);
317 Vector2 zero2 = Vector2.Zero;
318 zero2.X = 1f;
319 zero.X = -1f;
320 switch (tileSafely.frameX / 54)
321 {
322 case 0:
323 vector3.Y = (vector.Y = (vector2.Y = 1f));
324 break;
325 case 1:
326 vector3.Y = 1f;
327 break;
328 case 2:
329 case 14:
330 case 15:
331 case 17:
332 case 20:
333 case 21:
334 case 22:
335 case 23:
336 case 25:
337 case 26:
338 case 27:
339 case 28:
340 case 35:
341 case 37:
342 case 38:
343 case 39:
344 case 40:
345 case 41:
346 case 42:
347 vector3.Y = (vector.Y = (vector2.Y = 1f));
348 break;
349 case 3:
350 case 4:
351 case 5:
352 case 7:
353 case 8:
354 case 9:
355 case 10:
356 case 11:
357 case 12:
358 case 13:
359 case 16:
360 case 18:
361 case 19:
362 case 36:
363 vector3.Y = (vector.Y = (vector2.Y = 0f));
364 break;
365 case 6:
366 vector3.Y = (vector.Y = (vector2.Y = -1f));
367 break;
368 case 24:
369 vector3.Y = 0f;
370 vector.Y = -4f;
371 vector.X = 0f;
372 vector2.X = 0f;
373 vector2.Y = -4f;
374 break;
375 }
376 if (tileSafely.frameY % 40 != 0)
377 {
378 num2--;
379 }
380 if ((tileSafely.frameX % 54 == 0 && targetDirection == -1) || (tileSafely.frameX % 54 == 36 && targetDirection == 1))
381 {
383 }
384 else if ((tileSafely.frameX % 54 == 0 && targetDirection == 1) || (tileSafely.frameX % 54 == 36 && targetDirection == -1))
385 {
387 }
388 else
389 {
391 }
393 break;
394 }
395 }
398 num = info.AnchorTilePosition.X;
399 num2 = info.AnchorTilePosition.Y;
400 num3 = info.DirectionOffset;
401 targetDirection = info.TargetDirection;
402 seatDownOffset = info.VisualOffset;
403 zero = info.FinalOffset;
404 extraInfo = info.ExtraInfo;
405 playerSittingPosition = Utils.ToWorldCoordinates(new Point(num, num2), 8f, 16f);
406 playerSittingPosition.X += targetDirection * num3;
408 return true;
409 }
static bool[] CanBeSatOnForPlayers
Definition TileID.cs:183
static void ModifySittingTargetInfo(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.CanBeSatOnForPlayers, Terraria.Entity.direction, Terraria.Framing.GetTileSafely(), Terraria.ModLoader.TileLoader.ModifySittingTargetInfo(), and Terraria.Utils.ToWorldCoordinates().

Referenced by Terraria.GameContent.PlayerSittingHelper.SitDown(), Terraria.GameContent.PlayerSittingHelper.TryGetSittingBlock(), and Terraria.GameContent.PlayerSittingHelper.UpdateSitting().

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