diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/Sensor.java | |
| download | worlds.jar-main.tar.xz worlds.jar-main.zip | |
Diffstat (limited to 'NET/worlds/scape/Sensor.java')
| -rw-r--r-- | NET/worlds/scape/Sensor.java | 208 |
1 files changed, 208 insertions, 0 deletions
diff --git a/NET/worlds/scape/Sensor.java b/NET/worlds/scape/Sensor.java new file mode 100644 index 0000000..47d0a6f --- /dev/null +++ b/NET/worlds/scape/Sensor.java @@ -0,0 +1,208 @@ +/* */ package NET.worlds.scape; +/* */ +/* */ import java.io.IOException; +/* */ import java.io.PrintStream; +/* */ import java.util.Enumeration; +/* */ import java.util.Vector; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class Sensor +/* */ extends SuperRoot +/* */ { +/* 70 */ protected Vector<Action> actions = new Vector(); +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void addAction(Action o) +/* */ { +/* 82 */ this.actions.addElement(o); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void deleteAction(Action o) +/* */ { +/* 93 */ this.actions.removeElement(o); +/* */ } +/* */ +/* */ +/* */ +/* */ public void deleteActions() +/* */ { +/* 100 */ while (this.actions.size() > 0) { +/* 101 */ deleteAction((Action)this.actions.elementAt(0)); +/* */ } +/* */ } +/* */ +/* */ +/* */ public Enumeration<Action> getActions() +/* */ { +/* 108 */ return this.actions.elements(); +/* */ } +/* */ +/* */ +/* */ +/* */ public int countActions() +/* */ { +/* 115 */ return this.actions.size(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void trigger(Event event) +/* */ { +/* 126 */ RunningActionHandler.trigger(this.actions, getWorld(), event); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public Object properties(int index, int offset, int mode, Object value) +/* */ throws NoSuchPropertyException +/* */ { +/* 136 */ Object ret = null; +/* 137 */ switch (index - offset) { +/* */ case 0: +/* 139 */ if (mode == 0) { +/* 140 */ ret = ObjectPropertyAdder.make(new VectorProperty(this, index, +/* 141 */ "Targets"), getRoot(), "NET.worlds.scape.Action"); +/* 142 */ } else if (mode == 1) { +/* 143 */ ret = this.actions.clone(); +/* 144 */ } else if (mode == 4) { +/* 145 */ deleteAction((Action)value); +/* 146 */ } else if (mode == 3) +/* 147 */ addAction((Action)value); +/* 148 */ break; +/* */ default: +/* 150 */ ret = super.properties(index, offset + 1, mode, value); +/* */ } +/* 152 */ return ret; +/* */ } +/* */ +/* */ +/* 156 */ private static Object classCookie = new Object(); +/* */ +/* */ public void saveState(Saver s) throws IOException { +/* 159 */ s.saveVersion(2, classCookie); +/* 160 */ super.saveState(s); +/* 161 */ s.saveVector(this.actions); +/* */ } +/* */ +/* */ public void restoreState(Restorer r) throws IOException, TooNewException { +/* 165 */ restoreStateVers(r); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ protected int restoreStateVers(Restorer r) +/* */ throws IOException, TooNewException +/* */ { +/* 175 */ int vers = r.restoreVersion(classCookie); +/* */ +/* 177 */ switch (vers) { +/* */ case 1: +/* */ case 2: +/* 180 */ super.restoreState(r); +/* */ case 0: +/* 182 */ this.actions = r.restoreVectorActions(); +/* 183 */ break; +/* */ default: +/* 185 */ throw new TooNewException(); +/* */ } +/* */ +/* 188 */ return vers; +/* */ } +/* */ +/* */ public void postRestore(int version) { +/* 192 */ super.postRestore(version); +/* 193 */ for (Enumeration<Action> en = getActions(); en.hasMoreElements();) { +/* 194 */ Action a = (Action)en.nextElement(); +/* 195 */ if ((getOwner() != null) && (a.getOwner() == null)) { +/* 196 */ System.out.println("Reparenting orphan action " + a.getName()); +/* 197 */ WObject w = (WObject)getOwner(); +/* 198 */ w.addAction(a); +/* */ } +/* */ } +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\Sensor.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |