summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/DispenserAction.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/scape/DispenserAction.java')
-rw-r--r--NET/worlds/scape/DispenserAction.java158
1 files changed, 158 insertions, 0 deletions
diff --git a/NET/worlds/scape/DispenserAction.java b/NET/worlds/scape/DispenserAction.java
new file mode 100644
index 0000000..a081b79
--- /dev/null
+++ b/NET/worlds/scape/DispenserAction.java
@@ -0,0 +1,158 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.console.Console;
+/* */ import NET.worlds.network.URL;
+/* */ import java.io.IOException;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class DispenserAction
+/* */ extends Action
+/* */ {
+/* */ URL wobName;
+/* 29 */ Point3 center = new Point3(200.0F, 200.0F, 0.0F);
+/* 30 */ float radius = 50.0F;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Persister trigger(Event arg, Persister seqID)
+/* */ {
+/* 40 */ WObject w = (WObject)getOwner();
+/* */
+/* 42 */ SuperRoot ob = SuperRoot.readFile(this.wobName);
+/* */
+/* */
+/* 45 */ if (!(ob instanceof WObject))
+/* */ {
+/* 47 */ Console.println(Console.message("Cant-find") + this.wobName);
+/* 48 */ return null;
+/* */ }
+/* */
+/* 51 */ WObject wob = (WObject)ob;
+/* */
+/* */
+/* */
+/* */
+/* 56 */ Point3Temp pos = Point3Temp.make(
+/* 57 */ this.radius - (float)Math.random() * 2.0F * this.radius,
+/* 58 */ this.radius - (float)Math.random() * 2.0F * this.radius,
+/* 59 */ 0.0F)
+/* 60 */ .plus(this.center);
+/* */
+/* */
+/* 63 */ pos.z = wob.getZ();
+/* 64 */ wob.moveTo(pos);
+/* */
+/* 66 */ w.getRoom().add(wob);
+/* */
+/* 68 */ return null;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 77 */ Object ret = null;
+/* 78 */ switch (index - offset) {
+/* */ case 0:
+/* 80 */ if (mode == 0) {
+/* 81 */ ret = URLPropertyEditor.make(
+/* 82 */ new Property(this, index, "wob File Name"),
+/* 83 */ "wob");
+/* 84 */ } else if (mode == 1) {
+/* 85 */ ret = this.wobName;
+/* 86 */ } else if (mode == 2)
+/* 87 */ this.wobName = ((URL)value);
+/* 88 */ break;
+/* */
+/* */ case 1:
+/* 91 */ if (mode == 0) {
+/* 92 */ ret = Point3PropertyEditor.make(
+/* 93 */ new Property(this, index, "Center Position For Drop"));
+/* 94 */ } else if (mode == 1) {
+/* 95 */ ret = new Point3(this.center);
+/* 96 */ } else if (mode == 2)
+/* 97 */ this.center = new Point3((Point3)value);
+/* 98 */ break;
+/* */
+/* */ case 2:
+/* 101 */ if (mode == 0) {
+/* 102 */ ret = FloatPropertyEditor.make(
+/* 103 */ new Property(this, index, "Drop-position Radius"));
+/* 104 */ } else if (mode == 1) {
+/* 105 */ ret = new Float(this.radius);
+/* 106 */ } else if (mode == 2)
+/* 107 */ this.radius = ((Float)value).floatValue();
+/* 108 */ break;
+/* */
+/* */ default:
+/* 111 */ ret = super.properties(index, offset + 3, mode, value);
+/* */ }
+/* 113 */ return ret;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 120 */ private static Object classCookie = new Object();
+/* */
+/* */ public void saveState(Saver s) throws IOException
+/* */ {
+/* 124 */ s.saveVersion(0, classCookie);
+/* 125 */ super.saveState(s);
+/* 126 */ URL.save(s, this.wobName);
+/* 127 */ s.save(this.center);
+/* 128 */ s.saveFloat(this.radius);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r)
+/* */ throws IOException, TooNewException
+/* */ {
+/* 134 */ switch (r.restoreVersion(classCookie)) {
+/* */ case 0:
+/* 136 */ super.restoreState(r);
+/* 137 */ this.wobName = URL.restore(r);
+/* 138 */ this.center = ((Point3)r.restore());
+/* 139 */ this.radius = r.restoreFloat();
+/* 140 */ break;
+/* */
+/* */ default:
+/* 143 */ throw new TooNewException();
+/* */ }
+/* */
+/* */ }
+/* */
+/* */ public String toString()
+/* */ {
+/* 150 */ return super.toString() + "[" + this.wobName + "]";
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\DispenserAction.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file