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

◆ AI_007_AttemptToPlayIdleAnimationsForPets()

void Terraria.NPC.AI_007_AttemptToPlayIdleAnimationsForPets ( int petIdleChance)
inlineprivate

Definition at line 59345 of file NPC.cs.

59346 {
59347 if (velocity.X == 0f && Main.netMode != 1 && Main.rand.Next(petIdleChance) == 0)
59348 {
59349 int num = 3;
59350 if (type == 638)
59351 {
59352 num = 2;
59353 }
59355 {
59356 num = 0;
59357 }
59358 ai[0] = ((num == 0) ? 20 : Main.rand.Next(20, 20 + num));
59359 ai[1] = 200 + Main.rand.Next(300);
59360 if (ai[0] == 20f && type == 637)
59361 {
59362 ai[1] = 500 + Main.rand.Next(200);
59363 }
59364 if (ai[0] == 21f && type == 638)
59365 {
59366 ai[1] = 100 + Main.rand.Next(100);
59367 }
59368 if (ai[0] == 22f && type == 656)
59369 {
59370 ai[1] = 200 + Main.rand.Next(200);
59371 }
59372 if (ai[0] == 20f && NPCID.Sets.IsTownSlime[type])
59373 {
59374 ai[1] = 180 + Main.rand.Next(240);
59375 }
59376 ai[2] = 0f;
59377 localAI[3] = 0f;
59378 netUpdate = true;
59379 }
59380 }
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
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
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.NPC.ai, Terraria.ID.NPCID.Sets.IsTownSlime, Terraria.NPC.localAI, Terraria.Main.netMode, Terraria.NPC.netUpdate, Terraria.Main.rand, Terraria.NPC.type, and Terraria.Entity.velocity.

Referenced by Terraria.NPC.AI_007_TownEntities().

+ Here is the caller graph for this function: