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

◆ AI_007_TryForcingSitting()

void Terraria.NPC.AI_007_TryForcingSitting ( int homeFloorX,
int homeFloorY )
inlineprivate

Definition at line 56168 of file NPC.cs.

56169 {
56170 //IL_00a4: Unknown result type (might be due to invalid IL or missing references)
56171 //IL_00a9: Unknown result type (might be due to invalid IL or missing references)
56172 //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
56173 //IL_00b8: Unknown result type (might be due to invalid IL or missing references)
56174 //IL_00bd: Unknown result type (might be due to invalid IL or missing references)
56175 //IL_00c2: Unknown result type (might be due to invalid IL or missing references)
56176 //IL_0177: Unknown result type (might be due to invalid IL or missing references)
56177 //IL_018e: Unknown result type (might be due to invalid IL or missing references)
56178 //IL_0196: Unknown result type (might be due to invalid IL or missing references)
56179 //IL_019b: Unknown result type (might be due to invalid IL or missing references)
56180 //IL_010e: Unknown result type (might be due to invalid IL or missing references)
56181 //IL_0113: Unknown result type (might be due to invalid IL or missing references)
56182 //IL_011d: Unknown result type (might be due to invalid IL or missing references)
56183 //IL_0122: Unknown result type (might be due to invalid IL or missing references)
56184 //IL_0127: Unknown result type (might be due to invalid IL or missing references)
56185 //IL_012c: Unknown result type (might be due to invalid IL or missing references)
56186 Tile tile = Main.tile[homeFloorX, homeFloorY - 1];
56188 if (flag)
56189 {
56190 flag &= tile != null && tile.active() && TileID.Sets.CanBeSatOnForNPCs[tile.type];
56191 }
56192 if (flag)
56193 {
56194 flag &= tile.type != 15 || tile.frameY < 1080 || tile.frameY > 1098;
56195 }
56196 if (flag)
56197 {
56198 Point point = (base.Bottom + Vector2.UnitY * -2f).ToTileCoordinates();
56199 for (int i = 0; i < 200; i++)
56200 {
56201 if (Main.npc[i].active && Main.npc[i].aiStyle == 7 && Main.npc[i].townNPC && Main.npc[i].ai[0] == 5f && (Main.npc[i].Bottom + Vector2.UnitY * -2f).ToTileCoordinates() == point)
56202 {
56203 flag = false;
56204 break;
56205 }
56206 }
56207 }
56208 if (flag)
56209 {
56210 ai[0] = 5f;
56211 ai[1] = 900 + Main.rand.Next(10800);
56212 SitDown(new Point(homeFloorX, homeFloorY - 1), out var targetDirection, out var bottom);
56214 base.Bottom = bottom;
56215 velocity = Vector2.Zero;
56216 localAI[3] = 0f;
56217 netUpdate = true;
56218 }
56219 }
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
static bool[] IsTownSlime
If true for a given NPC type (F:Terraria.NPC.type), then that NPC is categorized as a town slime....
Definition NPCID.cs:232
static bool[] CannotSitOnFurniture
Whether or not a given NPC can sit on suitable furniture (F:Terraria.ID.TileID.Sets....
Definition NPCID.cs:644
static bool[] CanBeSatOnForNPCs
Definition TileID.cs:181
float[] localAI
Acts like F:Terraria.NPC.ai, but does not sync to the server. Many vanilla T:Terraria....
Definition NPC.cs:1003
float[] ai
An array with 4 slots used for any sort of data storage, which is occasionally synced from the server...
Definition NPC.cs:997
void SitDown(Point anchorTilePosition, out int direction, out Vector2 bottom)
Helper method for getting the parameters for seating a town NPC. Assumes the tile at anchorTilePositi...
Definition NPC.cs:112547
int type
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game....
Definition NPC.cs:990
bool netUpdate
Definition NPC.cs:1130

References Terraria.Tile.active(), Terraria.NPC.ai, Terraria.ID.TileID.Sets.CanBeSatOnForNPCs, Terraria.ID.NPCID.Sets.CannotSitOnFurniture, Terraria.Entity.direction, Terraria.ID.NPCID.Sets.IsTownSlime, Terraria.NPC.localAI, Terraria.NPC.netUpdate, Terraria.Main.npc, Terraria.Main.rand, Terraria.NPC.SitDown(), Terraria.Main.tile, Terraria.NPC.type, Terraria.Tile.type, and Terraria.Entity.velocity.

Referenced by Terraria.NPC.AI_007_TownEntities(), and Terraria.NPC.AI_007_TownEntities_TeleportToHome().

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