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

◆ DrawHealthBar() [1/2]

static bool Terraria.ModLoader.NPCLoader.DrawHealthBar ( NPC npc,
ref float scale )
inlinestatic

Definition at line 1219 of file NPCLoader.cs.

1220 {
1221 //IL_00bb: Unknown result type (might be due to invalid IL or missing references)
1222 //IL_00fe: Unknown result type (might be due to invalid IL or missing references)
1223 Vector2 position = default(Vector2);
1224 ((Vector2)(ref position))._002Ector(npc.position.X + (float)(npc.width / 2), npc.position.Y + npc.gfxOffY);
1225 if (Main.HealthBarDrawSettings == 1)
1226 {
1227 position.Y += (float)npc.height + 10f + Main.NPCAddHeight(npc);
1228 }
1229 else if (Main.HealthBarDrawSettings == 2)
1230 {
1231 position.Y -= 24f + Main.NPCAddHeight(npc) / 2f;
1232 }
1233 EntityGlobalsEnumerator<GlobalNPC> enumerator = HookDrawHealthBar.Enumerate(npc).GetEnumerator();
1234 while (enumerator.MoveNext())
1235 {
1236 bool? result2 = enumerator.Current.DrawHealthBar(npc, Main.HealthBarDrawSettings, ref scale, ref position);
1237 if (result2.HasValue)
1238 {
1239 if (result2.Value)
1240 {
1241 DrawHealthBar(npc, position, scale);
1242 }
1243 return false;
1244 }
1245 }
1246 if (IsModNPC(npc))
1247 {
1248 bool? result = npc.ModNPC.DrawHealthBar(Main.HealthBarDrawSettings, ref scale, ref position);
1249 if (result.HasValue)
1250 {
1251 if (result.Value)
1252 {
1253 DrawHealthBar(npc, position, scale);
1254 }
1255 return false;
1256 }
1257 }
1258 return true;
1259 }
static GlobalHookList< GlobalNPC > HookDrawHealthBar
Definition NPCLoader.cs:208
static bool DrawHealthBar(NPC npc, ref float scale)
static bool IsModNPC(NPC npc)
Definition NPCLoader.cs:438

References Terraria.ModLoader.NPCLoader.DrawHealthBar(), Terraria.NPC.gfxOffY, Terraria.Main.HealthBarDrawSettings, Terraria.Entity.height, Terraria.ModLoader.NPCLoader.HookDrawHealthBar, Terraria.ModLoader.NPCLoader.IsModNPC(), Terraria.NPC.ModNPC, Terraria.Main.NPCAddHeight(), and Terraria.Entity.position.

Referenced by Terraria.ModLoader.NPCLoader.DrawHealthBar(), and Terraria.Main.DrawInterface_14_EntityHealthBars().

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