summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/BuildRamp.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/BuildRamp.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/scape/BuildRamp.java')
-rw-r--r--NET/worlds/scape/BuildRamp.java310
1 files changed, 310 insertions, 0 deletions
diff --git a/NET/worlds/scape/BuildRamp.java b/NET/worlds/scape/BuildRamp.java
new file mode 100644
index 0000000..fc4a2e0
--- /dev/null
+++ b/NET/worlds/scape/BuildRamp.java
@@ -0,0 +1,310 @@
+package NET.worlds.scape;
+
+import java.awt.Color;
+import java.io.IOException;
+
+public class BuildRamp extends SwitchableBehavior implements FrameHandler, Persister {
+ protected boolean doBuild = false;
+ protected boolean built = false;
+ protected WrRamp ramp = null;
+ protected String stairName = "ramp";
+ protected float length = 1000.0F;
+ protected float width = 300.0F;
+ protected float pWidth = 250.0F;
+ protected float pHeight = 240.0F;
+ protected float dz = 300.0F;
+ protected float lintelZ = 50.0F;
+ protected float floorTileX = 300.0F;
+ protected float floorTileY = 200.0F;
+ protected float ceilTileX = 300.0F;
+ protected float ceilTileY = 200.0F;
+ protected float leftTileX = 100.0F;
+ protected float leftTileY = 100.0F;
+ protected float rightTileX = 100.0F;
+ protected float rightTileY = 100.0F;
+ protected Material floor = new Material(Color.green);
+ protected Material left = new Material(Color.cyan);
+ protected Material right = new Material(Color.red);
+ protected Material doorpost = new Material(Color.yellow);
+ protected Material lintel = new Material(Color.magenta);
+ protected Material ceiling = new Material(Color.blue);
+ protected String worldURL = null;
+
+ protected void build(Portal end1) {
+ Room room = end1.getRoom();
+ World world = room.getWorld();
+ this.ramp = new WrRamp(
+ world,
+ this.stairName,
+ this.length,
+ this.width,
+ this.pWidth,
+ this.pHeight,
+ this.dz,
+ this.lintelZ,
+ this.floorTileX,
+ this.floorTileY,
+ this.ceilTileX,
+ this.ceilTileY,
+ this.leftTileX,
+ this.leftTileY,
+ this.rightTileX,
+ this.rightTileY,
+ this.floor,
+ this.left,
+ this.right,
+ this.doorpost,
+ this.lintel,
+ this.ceiling
+ );
+ end1.biconnect(this.ramp.portal1);
+ this.built = true;
+ end1.removeHandler(this);
+ }
+
+ protected void unbuild(Portal end1) {
+ this.built = false;
+ }
+
+ @Override
+ public boolean handle(FrameEvent e) {
+ if (!this.built && this.doBuild && e.target instanceof Portal) {
+ this.build((Portal)e.target);
+ } else if (this.built && !this.doBuild && e.target instanceof Portal) {
+ this.unbuild((Portal)e.target);
+ }
+
+ return true;
+ }
+
+ @Override
+ public Object properties(int index, int offset, int mode, Object value) throws NoSuchPropertyException {
+ Object ret = null;
+ switch (index - offset) {
+ case 0:
+ if (mode == 0) {
+ ret = new ClassProperty(this, index, "BuildRamp");
+ }
+ break;
+ case 1:
+ if (mode == 0) {
+ ret = BooleanPropertyEditor.make(new Property(this, index, "Build now?"), "Later", "Now");
+ } else if (mode == 1) {
+ ret = new Boolean(this.doBuild);
+ } else if (mode == 2) {
+ this.doBuild = (Boolean)value;
+ }
+ break;
+ case 2:
+ if (mode == 0) {
+ ret = StringPropertyEditor.make(new Property(this, index, "Staircase Name"));
+ } else if (mode == 1) {
+ ret = this.stairName;
+ } else if (mode == 2) {
+ this.stairName = (String)value;
+ }
+ break;
+ case 3:
+ if (mode == 0) {
+ ret = FloatPropertyEditor.make(new Property(this, index, "Portal-to-portal Distance"));
+ } else if (mode == 1) {
+ ret = new Float(this.length);
+ } else if (mode == 2) {
+ this.length = (Float)value;
+ }
+ break;
+ case 4:
+ if (mode == 0) {
+ ret = FloatPropertyEditor.make(new Property(this, index, "Stairwell Width"));
+ } else if (mode == 1) {
+ ret = new Float(this.width);
+ } else if (mode == 2) {
+ this.width = (Float)value;
+ }
+ break;
+ case 5:
+ if (mode == 0) {
+ ret = FloatPropertyEditor.make(new Property(this, index, "Portal Width"));
+ } else if (mode == 1) {
+ ret = new Float(this.pWidth);
+ } else if (mode == 2) {
+ this.pWidth = (Float)value;
+ }
+ break;
+ case 6:
+ if (mode == 0) {
+ ret = FloatPropertyEditor.make(new Property(this, index, "Portal Height"));
+ } else if (mode == 1) {
+ ret = new Float(this.pHeight);
+ } else if (mode == 2) {
+ this.pHeight = (Float)value;
+ }
+ break;
+ case 7:
+ if (mode == 0) {
+ ret = FloatPropertyEditor.make(new Property(this, index, "Total Rise"));
+ } else if (mode == 1) {
+ ret = new Float(this.dz);
+ } else if (mode == 2) {
+ this.dz = (Float)value;
+ }
+ break;
+ case 8:
+ if (mode == 0) {
+ ret = FloatPropertyEditor.make(new Property(this, index, "Lintel Height"));
+ } else if (mode == 1) {
+ ret = new Float(this.lintelZ);
+ } else if (mode == 2) {
+ this.lintelZ = (Float)value;
+ }
+ break;
+ case 9:
+ if (mode == 0) {
+ ret = Point2PropertyEditor.make(new Property(this, index, "Floor Tile Size"));
+ } else if (mode == 1) {
+ Point2 coords = new Point2();
+ coords.x = this.floorTileX;
+ coords.y = this.floorTileY;
+ ret = coords;
+ } else if (mode == 2) {
+ this.floorTileX = ((Point2)value).x;
+ this.floorTileY = ((Point2)value).y;
+ }
+ break;
+ case 10:
+ if (mode == 0) {
+ ret = Point2PropertyEditor.make(new Property(this, index, "Ceiling Tile Size"));
+ } else if (mode == 1) {
+ Point2 coords = new Point2();
+ coords.x = this.ceilTileX;
+ coords.y = this.ceilTileY;
+ ret = coords;
+ } else if (mode == 2) {
+ this.ceilTileX = ((Point2)value).x;
+ this.ceilTileY = ((Point2)value).y;
+ }
+ break;
+ case 11:
+ if (mode == 0) {
+ ret = Point2PropertyEditor.make(new Property(this, index, "Left Wall Tile Size"));
+ } else if (mode == 1) {
+ Point2 coords = new Point2();
+ coords.x = this.leftTileX;
+ coords.y = this.leftTileY;
+ ret = coords;
+ } else if (mode == 2) {
+ this.leftTileX = ((Point2)value).x;
+ this.leftTileY = ((Point2)value).y;
+ }
+ break;
+ case 12:
+ if (mode == 0) {
+ ret = Point2PropertyEditor.make(new Property(this, index, "Right Wall Tile Size"));
+ } else if (mode == 1) {
+ Point2 coords = new Point2();
+ coords.x = this.rightTileX;
+ coords.y = this.rightTileY;
+ ret = coords;
+ } else if (mode == 2) {
+ this.rightTileX = ((Point2)value).x;
+ this.rightTileY = ((Point2)value).y;
+ }
+ break;
+ case 13:
+ if (mode == 0) {
+ ret = new Property(this, index, "Floor Material");
+ } else if (mode == 1) {
+ ret = this.floor;
+ }
+ break;
+ case 14:
+ if (mode == 0) {
+ ret = new Property(this, index, "Left Wall Material");
+ } else if (mode == 1) {
+ ret = this.left;
+ }
+ break;
+ case 15:
+ if (mode == 0) {
+ ret = new Property(this, index, "Right Wall Material");
+ } else if (mode == 1) {
+ ret = this.right;
+ }
+ break;
+ case 16:
+ if (mode == 0) {
+ ret = new Property(this, index, "Doorpost Material");
+ } else if (mode == 1) {
+ ret = this.doorpost;
+ }
+ break;
+ case 17:
+ if (mode == 0) {
+ ret = new Property(this, index, "Lintel Material");
+ } else if (mode == 1) {
+ ret = this.lintel;
+ }
+ break;
+ case 18:
+ if (mode == 0) {
+ ret = new Property(this, index, "Ceiling Material");
+ } else if (mode == 1) {
+ ret = this.ceiling;
+ }
+ break;
+ default:
+ ret = super.properties(index, offset + 19, mode, value);
+ }
+
+ return ret;
+ }
+
+ @Override
+ public String toString() {
+ return "Ramp: built=" + this.built;
+ }
+
+ @Override
+ public void saveState(Saver s) throws IOException {
+ s.saveBoolean(this.built);
+ s.saveString(this.stairName);
+ s.saveFloat(this.length);
+ s.saveFloat(this.width);
+ s.saveFloat(this.pWidth);
+ s.saveFloat(this.pHeight);
+ s.saveFloat(this.dz);
+ s.saveFloat(this.lintelZ);
+ s.saveFloat(this.floorTileX);
+ s.saveFloat(this.floorTileY);
+ s.saveFloat(this.ceilTileX);
+ s.saveFloat(this.ceilTileY);
+ s.saveFloat(this.leftTileX);
+ s.saveFloat(this.leftTileY);
+ s.saveFloat(this.rightTileX);
+ s.saveFloat(this.rightTileY);
+ }
+
+ @Override
+ public void restoreState(Restorer r) throws IOException {
+ this.built = r.restoreBoolean();
+ this.stairName = r.restoreString();
+ this.length = r.restoreFloat();
+ this.width = r.restoreFloat();
+ this.pWidth = r.restoreFloat();
+ this.pHeight = r.restoreFloat();
+ this.dz = r.restoreFloat();
+ this.lintelZ = r.restoreFloat();
+ this.floorTileX = r.restoreFloat();
+ this.floorTileY = r.restoreFloat();
+ this.ceilTileX = r.restoreFloat();
+ this.ceilTileY = r.restoreFloat();
+ this.leftTileX = r.restoreFloat();
+ this.leftTileY = r.restoreFloat();
+ this.rightTileX = r.restoreFloat();
+ this.rightTileY = r.restoreFloat();
+ }
+
+ @Override
+ public void postRestore(int version) {
+ }
+}