1 void generic_plat_blocked()
5 if(self.dmg && other.takedamage != DAMAGE_NO)
7 if(self.dmgtime2 < time)
9 Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
10 self.dmgtime2 = time + self.dmgtime;
13 // Gib dead/dying stuff
15 Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
20 void plat_spawn_inside_trigger()
26 settouch(trigger, plat_center_touch);
27 trigger.movetype = MOVETYPE_NONE;
28 trigger.solid = SOLID_TRIGGER;
32 trigger.drawmask = MASK_NORMAL;
33 trigger.trigger_touch = plat_center_touch;
34 trigger.draw = trigger_draw_generic;
37 tmin = self.absmin + '25 25 0';
38 tmax = self.absmax - '25 25 -8';
39 tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
40 if (self.spawnflags & PLAT_LOW_TRIGGER)
43 if (self.size_x <= 50)
45 tmin_x = (self.mins_x + self.maxs_x) / 2;
48 if (self.size_y <= 50)
50 tmin_y = (self.mins_y + self.maxs_y) / 2;
58 setsize (trigger, tmin, tmax);
62 // otherwise, something is fishy...
64 objerror("plat_spawn_inside_trigger: platform has odd size or lip, can't spawn");
69 _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
72 self.SUB_THINK = plat_go_down;
73 self.SUB_NEXTTHINK = self.SUB_LTIME + 3;
76 void plat_hit_bottom()
78 _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
84 _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
86 SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom);
91 _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
93 SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top);
96 void plat_center_touch()
99 if (!other.iscreature)
102 if (other.health <= 0)
105 if (!IS_PLAYER(other))
111 if (self.enemy.state == 2)
112 WITHSELF(self.enemy, plat_go_up());
113 else if (self.enemy.state == 1)
114 self.enemy.SUB_NEXTTHINK = self.enemy.SUB_LTIME + 1;
117 void plat_outside_touch()
120 if (!other.iscreature)
123 if (other.health <= 0)
126 if (!IS_PLAYER(other))
130 if (self.enemy.state == 1)
131 WITHSELF(self.enemy, plat_go_down());
134 void plat_trigger_use(entity this, entity actor, entity trigger)
138 return; // already activated
143 WITHSELF(this, plat_go_down());
149 if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO))
150 { // KIll Kill Kill!!
152 Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
158 if((self.dmg) && (other.takedamage != DAMAGE_NO))
160 Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
161 // Gib dead/dying stuff
163 Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
169 else if (self.state == 3)
171 // when in other states, then the plat_crush event came delayed after
172 // plat state already had changed
173 // this isn't a bug per se!
177 void plat_use(entity this, entity actor, entity trigger)
179 this.use = func_null;
181 objerror ("plat_use: not in up state");
182 WITHSELF(this, plat_go_down());
185 .string sound1, sound2;
187 void plat_reset(entity this)
191 setorigin (this, this.pos1);
197 setorigin (this, this.pos2);
199 this.use = plat_trigger_use;
203 this.SendFlags |= SF_TRIGGER_RESET;
207 .float platmovetype_start_default, platmovetype_end_default;
208 bool set_platmovetype(entity e, string s)
210 // sets platmovetype_start and platmovetype_end based on a string consisting of two values
212 int n = tokenize_console(s);
214 e.platmovetype_start = stof(argv(0));
216 e.platmovetype_start = 0;
219 e.platmovetype_end = stof(argv(1));
221 e.platmovetype_end = e.platmovetype_start;
224 if(argv(2) == "force")
225 return true; // no checking, return immediately
227 if(!cubic_speedfunc_is_sane(e.platmovetype_start, e.platmovetype_end))
229 objerror("Invalid platform move type; platform would go in reverse, which is not allowed.");