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

◆ Update()

void Terraria.GameContent.Bestiary.UnlockableNPCEntryIcon.Update ( BestiaryUICollectionInfo providedInfo,
Rectangle hitbox,
EntryIconDrawSettings settings )
inline

Implements Terraria.GameContent.Bestiary.IEntryIcon.

Definition at line 44 of file UnlockableNPCEntryIcon.cs.

45 {
46 //IL_0002: Unknown result type (might be due to invalid IL or missing references)
47 //IL_0147: Unknown result type (might be due to invalid IL or missing references)
48 //IL_0148: Unknown result type (might be due to invalid IL or missing references)
49 //IL_0097: Unknown result type (might be due to invalid IL or missing references)
50 //IL_009c: Unknown result type (might be due to invalid IL or missing references)
51 //IL_0180: Unknown result type (might be due to invalid IL or missing references)
52 //IL_0185: Unknown result type (might be due to invalid IL or missing references)
53 Vector2 positionOffsetCache = default(Vector2);
54 int? num = null;
55 int? num2 = null;
56 int? num3 = null;
57 bool wet = false;
58 float num4 = 0f;
60 if (NPCID.Sets.NPCBestiaryDrawOffset.TryGetValue(_npcNetId, out var value))
61 {
62 _npcCache.rotation = value.Rotation;
63 _npcCache.scale = value.Scale;
64 if (value.PortraitScale.HasValue && settings.IsPortrait)
65 {
66 _npcCache.scale = value.PortraitScale.Value;
67 }
68 positionOffsetCache = value.Position;
69 num = value.Frame;
70 num2 = value.Direction;
71 num3 = value.SpriteDirection;
72 num4 = value.Velocity;
73 wet = value.IsWet;
74 if (value.PortraitPositionXOverride.HasValue && settings.IsPortrait)
75 {
76 positionOffsetCache.X = value.PortraitPositionXOverride.Value;
77 }
78 if (value.PortraitPositionYOverride.HasValue && settings.IsPortrait)
79 {
80 positionOffsetCache.Y = value.PortraitPositionYOverride.Value;
81 }
82 if (value.CustomTexturePath != null)
83 {
84 asset = ModContent.Request<Texture2D>(value.CustomTexturePath);
85 }
86 if (asset != null && asset.IsLoaded)
87 {
89 }
90 }
94 {
95 for (int i = 0; i < _npcCache.oldPos.Length; i++)
96 {
98 }
99 }
100 _npcCache.direction = (_npcCache.spriteDirection = (num2.HasValue ? num2.Value : (-1)));
101 if (num3.HasValue)
102 {
103 _npcCache.spriteDirection = num3.Value;
104 }
105 _npcCache.wet = wet;
108 if (!num.HasValue && (settings.IsPortrait || settings.IsHovered))
109 {
110 _npcCache.velocity.X = (float)_npcCache.direction * num4;
112 }
113 else if (num.HasValue)
114 {
116 _npcCache.frame.Y = _npcCache.frame.Height * num.Value;
117 }
118 }
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
void AdjustSpecialSpawnRulesForVisuals(EntryIconDrawSettings settings)
static Dictionary< int, NPCBestiaryDrawModifiers > NPCBestiaryDrawOffset
The settings to use for a given NPC type's (F:Terraria.NPC.type) Bestiary drawing.
Definition NPCID.cs:182
static int[] TrailingMode
If != -1 for a given NPC type (F:Terraria.NPC.type), then that NPC will store its past positions (and...
Definition NPCID.cs:277
Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loa...
Definition ModContent.cs:38
void FindFrame()
Definition NPC.cs:72151
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
Vector2[] oldPos
Definition NPC.cs:580

References Terraria.GameContent.Bestiary.UnlockableNPCEntryIcon._customTexture, Terraria.GameContent.Bestiary.UnlockableNPCEntryIcon._npcCache, Terraria.GameContent.Bestiary.UnlockableNPCEntryIcon._npcNetId, Terraria.GameContent.Bestiary.UnlockableNPCEntryIcon._positionOffsetCache, Terraria.GameContent.Bestiary.UnlockableNPCEntryIcon.AdjustSpecialSpawnRulesForVisuals(), Terraria.Entity.direction, Terraria.NPC.FindFrame(), Terraria.ID.NPCID.Sets.NPCBestiaryDrawOffset, Terraria.NPC.oldPos, Terraria.Entity.position, Terraria.GameContent.Bestiary.UnlockableNPCEntryIcon.SimulateFirstHover(), Terraria.ID.NPCID.Sets.TrailingMode, Terraria.NPC.type, and Terraria.GameContent.Bestiary.UnlockableNPCEntryIcon.UpdatePosition().

+ Here is the call graph for this function: