summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/DispenserAction.java
blob: a081b79d707e95c7bbaf3e717049a2919ba8548e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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
 */