-
Notifications
You must be signed in to change notification settings - Fork 1
/
MasomodeEXGlobalTile.cs
102 lines (91 loc) · 3.97 KB
/
MasomodeEXGlobalTile.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Localization;
using Terraria.ID;
using Terraria.ModLoader;
namespace MasomodeEX
{
public class MasomodeEXGlobalTile : GlobalTile
{
public override bool CanKillTile(int i, int j, int type, ref bool blockDamaged)
{
switch (type)
{
case TileID.Meteorite:
if (!NPC.downedBoss2)
{
int p = Player.FindClosest(new Vector2(i * 16, j * 16), 0, 0);
if (p != -1)
NPC.SpawnOnPlayer(p, NPCID.SolarCorite);
return false;
}
if (MasomodeEX.Instance.VeinMinerLoaded)
{
int p = Player.FindClosest(new Vector2(i * 16, j * 16), 0, 0);
string text = "Don't even try to bring that vein-mining cheese in here!";
if (Main.netMode == 0)
Main.NewText(text, Color.LimeGreen);
else if (Main.netMode == 2)
NetMessage.BroadcastChatMessage(NetworkText.FromLiteral(text), Color.LimeGreen);
if (p != -1)
NPC.SpawnOnPlayer(p, MasomodeEX.Souls.NPCType("MutantBoss"));
}
break;
case TileID.BlueDungeonBrick:
case TileID.GreenDungeonBrick:
case TileID.PinkDungeonBrick:
case TileID.LihzahrdBrick:
if (!NPC.downedMoonlord)
return false;
break;
case TileID.Hellstone:
if (!(NPC.downedBoss2 && NPC.downedBoss3))
return false;
break;
case TileID.Traps:
case TileID.PressurePlates:
if (Framing.GetTileSafely(i, j).wall == WallID.LihzahrdBrickUnsafe)
return NPC.downedGolemBoss;
break;
default:
break;
}
return true;
}
public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem)
{
switch(type)
{
case TileID.Trees:
NPC.NewNPC(i * 16, j * 16, Main.rand.Next(2) == 0 ? NPCID.Bee : NPCID.BeeSmall);
break;
case TileID.Pots:
for (int a = 0; a < 5; a++)
{
int p = Projectile.NewProjectile(new Vector2(i * 16, j * 16), Main.rand.NextVector2Unit() * 6f, MasomodeEX.Souls.ProjectileType("MothDust"), 10, 0f, Main.myPlayer);
if (p != 1000)
Main.projectile[p].timeLeft = 30;
}
break;
case TileID.Explosives:
Projectile.NewProjectile(i * 16 + 8, j * 16 + 8, 0f, 0f, ProjectileID.Explosives, 500, 10, Main.myPlayer);
break;
default:
break;
}
}
public override void RightClick(int i, int j, int type)
{
if (type == TileID.Containers || type == TileID.Containers2)
if (Main.rand.Next(100) == 0)
Projectile.NewProjectile(i * 16 + 8, j * 16 + 8, 0f, 0f, ProjectileID.Explosives, 500, 10, Main.myPlayer);
}
/*public override void NearbyEffects(int i, int j, int type, bool closer)
{
if (type == TileID.PlanteraBulb)
for (int a = 0; a < Main.maxProjectiles; a++)
if (Main.projectile[a].active && Main.projectile[a].damage > 0 && Main.projectile[a].friendly && Main.projectile[a].Hitbox.Contains(i * 16 + 8, j * 16 + 8))
WorldGen.KillTile(i, j);
}*/
}
}