summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/BuildRamp.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/BuildRamp.java
downloadworlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz
worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/BuildRamp.java')
-rw-r--r--NET/worlds/scape/BuildRamp.java365
1 files changed, 365 insertions, 0 deletions
diff --git a/NET/worlds/scape/BuildRamp.java b/NET/worlds/scape/BuildRamp.java
new file mode 100644
index 0000000..756fb3a
--- /dev/null
+++ b/NET/worlds/scape/BuildRamp.java
@@ -0,0 +1,365 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import java.awt.Color;
+/* */ import java.io.IOException;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class BuildRamp
+/* */ extends SwitchableBehavior
+/* */ implements FrameHandler, Persister
+/* */ {
+/* 31 */ protected boolean doBuild = false;
+/* 32 */ protected boolean built = false;
+/* 33 */ protected WrRamp ramp = null;
+/* */
+/* */
+/* 36 */ protected String stairName = "ramp";
+/* 37 */ protected float length = 1000.0F;
+/* 38 */ protected float width = 300.0F;
+/* 39 */ protected float pWidth = 250.0F;
+/* 40 */ protected float pHeight = 240.0F;
+/* 41 */ protected float dz = 300.0F;
+/* 42 */ protected float lintelZ = 50.0F;
+/* 43 */ protected float floorTileX = 300.0F;
+/* 44 */ protected float floorTileY = 200.0F;
+/* 45 */ protected float ceilTileX = 300.0F;
+/* 46 */ protected float ceilTileY = 200.0F;
+/* 47 */ protected float leftTileX = 100.0F;
+/* 48 */ protected float leftTileY = 100.0F;
+/* 49 */ protected float rightTileX = 100.0F;
+/* 50 */ protected float rightTileY = 100.0F;
+/* */
+/* */
+/* 53 */ protected Material floor = new Material(Color.green);
+/* 54 */ protected Material left = new Material(Color.cyan);
+/* 55 */ protected Material right = new Material(Color.red);
+/* 56 */ protected Material doorpost = new Material(Color.yellow);
+/* 57 */ protected Material lintel = new Material(Color.magenta);
+/* 58 */ protected Material ceiling = new Material(Color.blue);
+/* */
+/* 60 */ protected String worldURL = null;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ protected void build(Portal end1)
+/* */ {
+/* 74 */ Room room = end1.getRoom();
+/* 75 */ World world = room.getWorld();
+/* */
+/* */
+/* 78 */ this.ramp = new WrRamp(world, this.stairName,
+/* 79 */ this.length, this.width, this.pWidth, this.pHeight,
+/* 80 */ this.dz, this.lintelZ,
+/* 81 */ this.floorTileX, this.floorTileY, this.ceilTileX, this.ceilTileY,
+/* 82 */ this.leftTileX, this.leftTileY, this.rightTileX, this.rightTileY,
+/* 83 */ this.floor, this.left, this.right, this.doorpost, this.lintel, this.ceiling);
+/* */
+/* */
+/* 86 */ end1.biconnect(this.ramp.portal1);
+/* */
+/* */
+/* 89 */ this.built = true;
+/* */
+/* 91 */ end1.removeHandler(this);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ protected void unbuild(Portal end1)
+/* */ {
+/* 103 */ this.built = false;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public boolean handle(FrameEvent e)
+/* */ {
+/* 113 */ if ((!this.built) && (this.doBuild) && ((e.target instanceof Portal))) {
+/* 114 */ build((Portal)e.target);
+/* 115 */ } else if ((this.built) && (!this.doBuild) && ((e.target instanceof Portal)))
+/* 116 */ unbuild((Portal)e.target);
+/* 117 */ return true;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 127 */ Object ret = null;
+/* 128 */ switch (index - offset) {
+/* */ case 0:
+/* 130 */ if (mode == 0)
+/* 131 */ ret = new ClassProperty(this, index, "BuildRamp");
+/* 132 */ break;
+/* */ case 1:
+/* 134 */ if (mode == 0) {
+/* 135 */ ret = BooleanPropertyEditor.make(
+/* 136 */ new Property(this, index, "Build now?"),
+/* 137 */ "Later", "Now");
+/* 138 */ } else if (mode == 1) {
+/* 139 */ ret = new Boolean(this.doBuild);
+/* 140 */ } else if (mode == 2)
+/* 141 */ this.doBuild = ((Boolean)value).booleanValue();
+/* 142 */ break;
+/* */ case 2:
+/* 144 */ if (mode == 0) {
+/* 145 */ ret = StringPropertyEditor.make(
+/* 146 */ new Property(this, index, "Staircase Name"));
+/* 147 */ } else if (mode == 1) {
+/* 148 */ ret = this.stairName;
+/* 149 */ } else if (mode == 2)
+/* 150 */ this.stairName = ((String)value);
+/* 151 */ break;
+/* */ case 3:
+/* 153 */ if (mode == 0) {
+/* 154 */ ret = FloatPropertyEditor.make(
+/* 155 */ new Property(this, index, "Portal-to-portal Distance"));
+/* 156 */ } else if (mode == 1) {
+/* 157 */ ret = new Float(this.length);
+/* 158 */ } else if (mode == 2)
+/* 159 */ this.length = ((Float)value).floatValue();
+/* 160 */ break;
+/* */ case 4:
+/* 162 */ if (mode == 0) {
+/* 163 */ ret = FloatPropertyEditor.make(
+/* 164 */ new Property(this, index, "Stairwell Width"));
+/* 165 */ } else if (mode == 1) {
+/* 166 */ ret = new Float(this.width);
+/* 167 */ } else if (mode == 2)
+/* 168 */ this.width = ((Float)value).floatValue();
+/* 169 */ break;
+/* */ case 5:
+/* 171 */ if (mode == 0) {
+/* 172 */ ret = FloatPropertyEditor.make(
+/* 173 */ new Property(this, index, "Portal Width"));
+/* 174 */ } else if (mode == 1) {
+/* 175 */ ret = new Float(this.pWidth);
+/* 176 */ } else if (mode == 2)
+/* 177 */ this.pWidth = ((Float)value).floatValue();
+/* 178 */ break;
+/* */ case 6:
+/* 180 */ if (mode == 0) {
+/* 181 */ ret = FloatPropertyEditor.make(
+/* 182 */ new Property(this, index, "Portal Height"));
+/* 183 */ } else if (mode == 1) {
+/* 184 */ ret = new Float(this.pHeight);
+/* 185 */ } else if (mode == 2)
+/* 186 */ this.pHeight = ((Float)value).floatValue();
+/* 187 */ break;
+/* */ case 7:
+/* 189 */ if (mode == 0) {
+/* 190 */ ret = FloatPropertyEditor.make(
+/* 191 */ new Property(this, index, "Total Rise"));
+/* 192 */ } else if (mode == 1) {
+/* 193 */ ret = new Float(this.dz);
+/* 194 */ } else if (mode == 2)
+/* 195 */ this.dz = ((Float)value).floatValue();
+/* 196 */ break;
+/* */ case 8:
+/* 198 */ if (mode == 0) {
+/* 199 */ ret = FloatPropertyEditor.make(
+/* 200 */ new Property(this, index, "Lintel Height"));
+/* 201 */ } else if (mode == 1) {
+/* 202 */ ret = new Float(this.lintelZ);
+/* 203 */ } else if (mode == 2)
+/* 204 */ this.lintelZ = ((Float)value).floatValue();
+/* 205 */ break;
+/* */ case 9:
+/* 207 */ if (mode == 0) {
+/* 208 */ ret = Point2PropertyEditor.make(
+/* 209 */ new Property(this, index, "Floor Tile Size"));
+/* 210 */ } else if (mode == 1) {
+/* 211 */ Point2 coords = new Point2();
+/* 212 */ coords.x = this.floorTileX;
+/* 213 */ coords.y = this.floorTileY;
+/* 214 */ ret = coords;
+/* 215 */ } else if (mode == 2) {
+/* 216 */ this.floorTileX = ((Point2)value).x;
+/* 217 */ this.floorTileY = ((Point2)value).y;
+/* */ }
+/* 219 */ break;
+/* */ case 10:
+/* 221 */ if (mode == 0) {
+/* 222 */ ret = Point2PropertyEditor.make(
+/* 223 */ new Property(this, index, "Ceiling Tile Size"));
+/* 224 */ } else if (mode == 1) {
+/* 225 */ Point2 coords = new Point2();
+/* 226 */ coords.x = this.ceilTileX;
+/* 227 */ coords.y = this.ceilTileY;
+/* 228 */ ret = coords;
+/* 229 */ } else if (mode == 2) {
+/* 230 */ this.ceilTileX = ((Point2)value).x;
+/* 231 */ this.ceilTileY = ((Point2)value).y;
+/* */ }
+/* 233 */ break;
+/* */ case 11:
+/* 235 */ if (mode == 0) {
+/* 236 */ ret = Point2PropertyEditor.make(
+/* 237 */ new Property(this, index, "Left Wall Tile Size"));
+/* 238 */ } else if (mode == 1) {
+/* 239 */ Point2 coords = new Point2();
+/* 240 */ coords.x = this.leftTileX;
+/* 241 */ coords.y = this.leftTileY;
+/* 242 */ ret = coords;
+/* 243 */ } else if (mode == 2) {
+/* 244 */ this.leftTileX = ((Point2)value).x;
+/* 245 */ this.leftTileY = ((Point2)value).y;
+/* */ }
+/* 247 */ break;
+/* */ case 12:
+/* 249 */ if (mode == 0) {
+/* 250 */ ret = Point2PropertyEditor.make(
+/* 251 */ new Property(this, index, "Right Wall Tile Size"));
+/* 252 */ } else if (mode == 1) {
+/* 253 */ Point2 coords = new Point2();
+/* 254 */ coords.x = this.rightTileX;
+/* 255 */ coords.y = this.rightTileY;
+/* 256 */ ret = coords;
+/* 257 */ } else if (mode == 2) {
+/* 258 */ this.rightTileX = ((Point2)value).x;
+/* 259 */ this.rightTileY = ((Point2)value).y;
+/* */ }
+/* 261 */ break;
+/* */ case 13:
+/* 263 */ if (mode == 0) {
+/* 264 */ ret = new Property(this, index, "Floor Material");
+/* 265 */ } else if (mode == 1)
+/* 266 */ ret = this.floor;
+/* 267 */ break;
+/* */ case 14:
+/* 269 */ if (mode == 0) {
+/* 270 */ ret = new Property(this, index, "Left Wall Material");
+/* 271 */ } else if (mode == 1)
+/* 272 */ ret = this.left;
+/* 273 */ break;
+/* */ case 15:
+/* 275 */ if (mode == 0) {
+/* 276 */ ret = new Property(this, index, "Right Wall Material");
+/* 277 */ } else if (mode == 1)
+/* 278 */ ret = this.right;
+/* 279 */ break;
+/* */ case 16:
+/* 281 */ if (mode == 0) {
+/* 282 */ ret = new Property(this, index, "Doorpost Material");
+/* 283 */ } else if (mode == 1)
+/* 284 */ ret = this.doorpost;
+/* 285 */ break;
+/* */ case 17:
+/* 287 */ if (mode == 0) {
+/* 288 */ ret = new Property(this, index, "Lintel Material");
+/* 289 */ } else if (mode == 1)
+/* 290 */ ret = this.lintel;
+/* 291 */ break;
+/* */ case 18:
+/* 293 */ if (mode == 0) {
+/* 294 */ ret = new Property(this, index, "Ceiling Material");
+/* 295 */ } else if (mode == 1)
+/* 296 */ ret = this.ceiling;
+/* 297 */ break;
+/* */ default:
+/* 299 */ ret = super.properties(index, offset + 19, mode, value);
+/* */ }
+/* */
+/* 302 */ return ret;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public String toString()
+/* */ {
+/* 309 */ return "Ramp: built=" + this.built;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public void saveState(Saver s)
+/* */ throws IOException
+/* */ {
+/* 317 */ s.saveBoolean(this.built);
+/* 318 */ s.saveString(this.stairName);
+/* 319 */ s.saveFloat(this.length);
+/* 320 */ s.saveFloat(this.width);
+/* 321 */ s.saveFloat(this.pWidth);
+/* 322 */ s.saveFloat(this.pHeight);
+/* 323 */ s.saveFloat(this.dz);
+/* 324 */ s.saveFloat(this.lintelZ);
+/* 325 */ s.saveFloat(this.floorTileX);
+/* 326 */ s.saveFloat(this.floorTileY);
+/* 327 */ s.saveFloat(this.ceilTileX);
+/* 328 */ s.saveFloat(this.ceilTileY);
+/* 329 */ s.saveFloat(this.leftTileX);
+/* 330 */ s.saveFloat(this.leftTileY);
+/* 331 */ s.saveFloat(this.rightTileX);
+/* 332 */ s.saveFloat(this.rightTileY);
+/* */ }
+/* */
+/* */
+/* */
+/* */ public void restoreState(Restorer r)
+/* */ throws IOException
+/* */ {
+/* 340 */ this.built = r.restoreBoolean();
+/* 341 */ this.stairName = r.restoreString();
+/* 342 */ this.length = r.restoreFloat();
+/* 343 */ this.width = r.restoreFloat();
+/* 344 */ this.pWidth = r.restoreFloat();
+/* 345 */ this.pHeight = r.restoreFloat();
+/* 346 */ this.dz = r.restoreFloat();
+/* 347 */ this.lintelZ = r.restoreFloat();
+/* 348 */ this.floorTileX = r.restoreFloat();
+/* 349 */ this.floorTileY = r.restoreFloat();
+/* 350 */ this.ceilTileX = r.restoreFloat();
+/* 351 */ this.ceilTileY = r.restoreFloat();
+/* 352 */ this.leftTileX = r.restoreFloat();
+/* 353 */ this.leftTileY = r.restoreFloat();
+/* 354 */ this.rightTileX = r.restoreFloat();
+/* 355 */ this.rightTileY = r.restoreFloat();
+/* */ }
+/* */
+/* */ public void postRestore(int version) {}
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\BuildRamp.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file