1 void generic_plat_blocked()
4 if(self.dmg && other.takedamage != DAMAGE_NO)
6 if(self.dmgtime2 < time)
8 Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
9 self.dmgtime2 = time + self.dmgtime;
12 // Gib dead/dying stuff
13 if(other.deadflag != DEAD_NO)
14 Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
19 void plat_spawn_inside_trigger()
25 trigger.touch = plat_center_touch;
26 trigger.movetype = MOVETYPE_NONE;
27 trigger.solid = SOLID_TRIGGER;
31 trigger.drawmask = MASK_NORMAL;
32 trigger.trigger_touch = plat_center_touch;
33 trigger.draw = trigger_draw_generic;
36 tmin = self.absmin + '25 25 0';
37 tmax = self.absmax - '25 25 -8';
38 tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
39 if (self.spawnflags & PLAT_LOW_TRIGGER)
42 if (self.size_x <= 50)
44 tmin_x = (self.mins_x + self.maxs_x) / 2;
47 if (self.size_y <= 50)
49 tmin_y = (self.mins_y + self.maxs_y) / 2;
57 setsize (trigger, tmin, tmax);
61 // otherwise, something is fishy...
63 objerror("plat_spawn_inside_trigger: platform has odd size or lip, can't spawn");
68 _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
71 self.SUB_THINK = plat_go_down;
72 self.SUB_NEXTTHINK = self.SUB_LTIME + 3;
75 void plat_hit_bottom()
77 _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
83 _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
85 SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom);
90 _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
92 SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top);
95 void plat_center_touch()
98 if (!other.iscreature)
101 if (other.health <= 0)
104 if (!IS_PLAYER(other))
113 else if (self.state == 1)
114 self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
117 void plat_outside_touch()
120 if (!other.iscreature)
123 if (other.health <= 0)
126 if (!IS_PLAYER(other))
135 void plat_trigger_use()
139 return; // already activated
150 if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO))
151 { // KIll Kill Kill!!
153 Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
159 if((self.dmg) && (other.takedamage != DAMAGE_NO))
161 Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
162 // Gib dead/dying stuff
163 if(other.deadflag != DEAD_NO)
164 Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
170 else if (self.state == 3)
172 // when in other states, then the plat_crush event came delayed after
173 // plat state already had changed
174 // this isn't a bug per se!
180 self.use = func_null;
182 objerror ("plat_use: not in up state");
186 .string sound1, sound2;
188 void plat_reset(entity this)
192 setorigin (this, this.pos1);
198 setorigin (this, this.pos2);
200 this.use = plat_trigger_use;
204 this.SendFlags |= SF_TRIGGER_RESET;
208 .float platmovetype_start_default, platmovetype_end_default;
209 bool set_platmovetype(entity e, string s)
211 // sets platmovetype_start and platmovetype_end based on a string consisting of two values
213 int n = tokenize_console(s);
215 e.platmovetype_start = stof(argv(0));
217 e.platmovetype_start = 0;
220 e.platmovetype_end = stof(argv(1));
222 e.platmovetype_end = e.platmovetype_start;
225 if(argv(2) == "force")
226 return true; // no checking, return immediately
228 if(!cubic_speedfunc_is_sane(e.platmovetype_start, e.platmovetype_end))
230 objerror("Invalid platform move type; platform would go in reverse, which is not allowed.");