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/BBTeleportCommand.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/console/BBTeleportCommand.java')
| -rw-r--r-- | NET/worlds/console/BBTeleportCommand.java | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/NET/worlds/console/BBTeleportCommand.java b/NET/worlds/console/BBTeleportCommand.java new file mode 100644 index 0000000..620e9c4 --- /dev/null +++ b/NET/worlds/console/BBTeleportCommand.java @@ -0,0 +1,82 @@ +package NET.worlds.console; + +import NET.worlds.scape.Drone; +import NET.worlds.scape.HoloPilot; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.Point3Temp; +import NET.worlds.scape.TeleportAction; +import NET.worlds.scape.TeleportStatus; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class BBTeleportCommand extends BlackBoxCommand implements TeleportStatus { + private String location; + + public BBTeleportCommand() { + this.commandType = 1; + } + + public BBTeleportCommand(String pLocation) { + this(); + if (pLocation != null) { + this.location = new String(pLocation); + } + } + + @Override + public boolean execute() { + if (this.location != null) { + TeleportAction.teleport(this.location, this); + } + + return true; + } + + @Override + public void save(DataOutputStream dos) throws IOException { + super.save(dos); + if (this.location == null) { + dos.writeUTF(""); + } else { + dos.writeUTF(this.location); + } + } + + @Override + public void load(DataInputStream dis) throws IOException { + super.load(dis); + this.location = dis.readUTF(); + if (this.location.equals("")) { + this.location = null; + } + } + + @Override + public void teleportStatus(String err, String targetURL) { + Pilot p = Pilot.getActive(); + if (p instanceof HoloPilot) { + HoloPilot hp = (HoloPilot)p; + Drone d = hp.getInternalDrone(); + if (d != null) { + short dir = (short)(-p.getYaw() + 90.0F); + dir = (short)(dir % 360); + + while (dir < 0) { + dir = (short)(dir + 360); + } + + dir = (short)(90 - dir); + dir = (short)(360 - dir); + Point3Temp pos = p.getPosition(); + d.reset((short)pos.x, (short)pos.y, (short)p.getFootHeight(), dir); + } + } + + if (err == null) { + this.doCallback(true); + } else { + this.doCallback(false); + } + } +} |