summaryrefslogtreecommitdiff
path: root/NET/worlds/console/ArmyOfZombies.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-12 22:33:32 -0800
committerFuwn <[email protected]>2026-02-12 22:33:32 -0800
commitc7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch)
treedf9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/console/ArmyOfZombies.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/console/ArmyOfZombies.java')
-rw-r--r--NET/worlds/console/ArmyOfZombies.java120
1 files changed, 120 insertions, 0 deletions
diff --git a/NET/worlds/console/ArmyOfZombies.java b/NET/worlds/console/ArmyOfZombies.java
new file mode 100644
index 0000000..5cfb094
--- /dev/null
+++ b/NET/worlds/console/ArmyOfZombies.java
@@ -0,0 +1,120 @@
+package NET.worlds.console;
+
+import NET.worlds.scape.DeepEnumeration;
+import NET.worlds.scape.Drone;
+import NET.worlds.scape.Pilot;
+import NET.worlds.scape.Point3Temp;
+import NET.worlds.scape.Room;
+import NET.worlds.scape.SuperRoot;
+import NET.worlds.scape.WObject;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+class ArmyOfZombies {
+ Hashtable<String, Drone> zombies = new Hashtable<String, Drone>();
+ private static ArmyOfZombies instance = new ArmyOfZombies();
+
+ public static ArmyOfZombies instance() {
+ return instance;
+ }
+
+ protected ArmyOfZombies() {
+ }
+
+ public void killZombies() {
+ Enumeration<Drone> e = this.zombies.elements();
+
+ while (e.hasMoreElements()) {
+ Drone id = e.nextElement();
+ Enumeration<WObject> en = (Enumeration<WObject>)id.getContents();
+
+ while (en.hasMoreElements()) {
+ WObject wob = en.nextElement();
+ wob.detach();
+ }
+
+ id.detach();
+ id.discard();
+ }
+
+ this.zombies.clear();
+ }
+
+ public void addZombie(Drone id) {
+ String name = id.getName();
+ if (name.charAt(0) == '!') {
+ name = name.substring(1);
+ }
+
+ this.zombies.put(name, id);
+ }
+
+ public void replaceZombie(String name, Drone id) {
+ Drone oldId = this.get(name);
+ if (oldId != id) {
+ this.zombies.remove(name);
+ this.addZombie(id);
+ id.makeTag(true);
+ }
+ }
+
+ public void killZombie(String name) {
+ Drone id = this.get(name);
+ if (id != null) {
+ this.zombies.remove(name);
+ id.detach();
+ }
+ }
+
+ public void zombify() {
+ if (Pilot.getActive() != null) {
+ if (Pilot.getActive().getRoom() != null) {
+ if (Pilot.getActive().getRoom().getWorld() != null) {
+ Enumeration<Object> rooms = Pilot.getActive().getRoom().getWorld().getRooms();
+
+ while (rooms.hasMoreElements()) {
+ Room r = (Room)rooms.nextElement();
+ if (r != null) {
+ DeepEnumeration<Object> de = new DeepEnumeration<Object>();
+ r.getChildren(de);
+
+ while (de.hasMoreElements()) {
+ Object o = de.nextElement();
+ if (o instanceof Drone) {
+ Drone d = (Drone)o;
+ Point3Temp pos = d.getPosition();
+ short dir = (short)(-d.getYaw() + 90.0F);
+ dir = (short)(dir % 360);
+
+ while (dir < 0) {
+ dir = (short)(dir + 360);
+ }
+
+ SuperRoot wobj = d.getOwner();
+ if (wobj != null) {
+ Room rm = wobj.getRoom();
+ if (rm != null && d.getName() != null) {
+ BlackBox.getInstance()
+ .submitEvent(new BBAppearDroneCommand(r.getRoom().toString(), d.getName(), (short)pos.x, (short)pos.y, (short)pos.z, dir));
+ if (d.getCurrentURL() != null) {
+ BlackBox.getInstance().submitEvent(new BBDroneBitmapCommand(d.getName(), d.getCurrentURL().toString()));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Drone get(String name) {
+ if (name.charAt(0) == '!') {
+ name = name.substring(1);
+ }
+
+ return this.zombies.get(name);
+ }
+}