-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathCheatSheetNPC.cs
50 lines (43 loc) · 1.49 KB
/
CheatSheetNPC.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using CheatSheet.Menus;
using Terraria;
using Terraria.ModLoader;
namespace CheatSheet
{
internal class CheatSheetNPC : GlobalNPC
{
public bool isFiltered = false;
public override bool InstancePerEntity => true;
public override bool PreAI(NPC npc) {
//Main.NewText("using " + npc.ToString());
if (NPCBrowser.filteredNPCSlots.Contains(npc.netID)/* || NPCBrowser.filteredNPCSlots.Contains(npc.type)*/) {
//NPCSlot.HandleFilterNPC(npc.whoAmI);
isFiltered = true;
int life = npc.life;
NPC.HitInfo hit = npc.CalculateHitInfo(life, -npc.direction, false, 0f);
hit.InstantKill = true;
npc.StrikeNPC(hit, true, noPlayerInteraction: true);
if (Main.netMode == 1) // syncData does not do visuals
{
NetMessage.SendStrikeNPC(npc, hit);
//NetMessage.SendData(28, -1, -1, null, npc.whoAmI, life, 0f, -Main.npc[npc.whoAmI].direction, 1);
// type, -1, -1, msg, index, damage, knockback, direction, crit
}
//NetMessage.SendData(23, -1, -1, "", npc.whoAmI);
}
return base.PreAI(npc);
}
public override bool PreKill(NPC npc) {
return !isFiltered;
}
/*public override void SpawnNPC(int npc, int tileX, int tileY)
{
Main.NewText("spawning " + npc.ToString());
if (NPCBrowser.filteredNPCSlots.Contains(Main.npc[npc].netID))
{
Main.NewText("deleting " + npc.ToString());
Main.npc[npc].netDefaults(0);
Main.npc[npc].active = false;
}
}*/
}
}