summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/TwoWayPortal.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/scape/TwoWayPortal.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/scape/TwoWayPortal.java')
-rw-r--r--NET/worlds/scape/TwoWayPortal.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/NET/worlds/scape/TwoWayPortal.java b/NET/worlds/scape/TwoWayPortal.java
new file mode 100644
index 0000000..c9c3b0c
--- /dev/null
+++ b/NET/worlds/scape/TwoWayPortal.java
@@ -0,0 +1,64 @@
+package NET.worlds.scape;
+
+import java.io.IOException;
+
+public class TwoWayPortal extends Portal {
+ private static Object classCookie = new Object();
+
+ public TwoWayPortal(String targetRoom, float llx, float lly, float llz, float urx, float ury, float urz) {
+ super(llx, lly, llz, urx, ury, urz);
+ this.setFarSideInfo(null, targetRoom, null);
+ }
+
+ public TwoWayPortal() {
+ }
+
+ @Override
+ public void saveState(Saver s) throws IOException {
+ s.saveVersion(0, classCookie);
+ super.saveState(s);
+ }
+
+ @Override
+ public void restoreState(Restorer r) throws IOException, TooNewException {
+ int vers = r.restoreVersion(classCookie);
+ switch (vers) {
+ case 0:
+ super.restoreState(r);
+ return;
+ default:
+ throw new TooNewException();
+ }
+ }
+
+ @Override
+ public void detach() throws ClassCastException {
+ super.detach();
+ Portal p = this.farSide();
+ if (p != null) {
+ p.detach();
+ }
+ }
+
+ @Override
+ public void reset(boolean showmessage) {
+ super.reset(showmessage);
+ if (this.farSideRoom() != null) {
+ Portal p = this.farSide();
+ if (p != null) {
+ if (p.isActive()) {
+ return;
+ }
+
+ p.detach();
+ this.bidisconnect();
+ }
+
+ Point3Temp left = this.getWorldPosition();
+ Point3Temp right = this.getFarCorner();
+ p = new Portal(right.x, right.y, left.z, left.x, left.y, right.z);
+ this.farSideRoom().add(p);
+ this.biconnect(p);
+ }
+ }
+}