diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/console/BBMoveDroneCommand.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/console/BBMoveDroneCommand.java')
| -rw-r--r-- | NET/worlds/console/BBMoveDroneCommand.java | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/NET/worlds/console/BBMoveDroneCommand.java b/NET/worlds/console/BBMoveDroneCommand.java new file mode 100644 index 0000000..464bd12 --- /dev/null +++ b/NET/worlds/console/BBMoveDroneCommand.java @@ -0,0 +1,75 @@ +package NET.worlds.console; + +import NET.worlds.scape.Drone; +import NET.worlds.scape.HoloPilot; +import NET.worlds.scape.Pilot; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class BBMoveDroneCommand extends BlackBoxCommand { + private short x; + private short y; + private short z; + private short dir; + private String droneID; + + public BBMoveDroneCommand() { + this.commandType = 3; + } + + public BBMoveDroneCommand(String pdroneID, short px, short py, short pz, short pdir) { + this(); + this.droneID = pdroneID; + this.x = px; + this.y = py; + this.z = pz; + this.dir = pdir; + } + + @Override + public boolean execute() { + Drone id = null; + if (this.droneID.equals("@Pilot")) { + Pilot p = Pilot.getActive(); + if (p != null && p instanceof HoloPilot) { + HoloPilot hp = (HoloPilot)p; + id = hp.getInternalDrone(); + } + } else { + id = ArmyOfZombies.instance().get(this.droneID); + } + + if (id != null) { + short _dir = this.dir; + _dir = (short)(90 - _dir); + _dir = (short)(360 - _dir); + id.longLoc(this.x, this.y, this.z, _dir); + this.doCallback(true); + return true; + } else { + this.doCallback(true); + return true; + } + } + + @Override + public void save(DataOutputStream dos) throws IOException { + super.save(dos); + dos.writeUTF(this.droneID); + dos.writeShort(this.x); + dos.writeShort(this.y); + dos.writeShort(this.z); + dos.writeShort(this.dir); + } + + @Override + public void load(DataInputStream dis) throws IOException { + super.load(dis); + this.droneID = dis.readUTF(); + this.x = dis.readShort(); + this.y = dis.readShort(); + this.z = dis.readShort(); + this.dir = dis.readShort(); + } +} |