private void ActivateDownstream() { Emit = 1; var dummy = DummyTile.GetDummy <ReflectorDummy>((int)endPoint.X / 16, (int)endPoint.Y / 16); if (dummy != null) { if ((dummy.modProjectile as ReflectorDummy).Emit > 0) //base case to prevent infinite reflections { return; } (dummy.modProjectile as ReflectorDummy).ActivateDownstream(); } }
public void DeactivateDownstream(bool disableSelf = false) { if (disableSelf) { Emit = 0; } var dummy = DummyTile.GetDummy <ReflectorDummy>((int)endPoint.X / 16, (int)endPoint.Y / 16); if (dummy != null) { if ((dummy.modProjectile as ReflectorDummy).Emit <= 0) //base case to prevent infinite reflections { return; } (dummy.modProjectile as ReflectorDummy).DeactivateDownstream(true); } }
protected override void Receive() { if (Main.netMode == Terraria.ID.NetmodeID.Server) { if (Core.DummyTile.DummyExists(x, y, type)) { DummyTile.GetDummy(x, y, type).netUpdate = true; //this case meant that a player went up to a tile dummy that did not exist for them, but did on server and we want to make sure they receive it return; } Projectile p = new Projectile(); p.SetDefaults(type); var spawnPos = new Vector2(x, y) * 16 + p.Size / 2; int n = Projectile.NewProjectile(spawnPos, Vector2.Zero, type, 0, 0); NetMessage.SendData(Terraria.ID.MessageID.SyncProjectile, -1, -1, null, n); Point16 key = new Point16(x, y); DummyTile.dummies[key] = n; } }