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;
31 tmin = self.absmin + '25 25 0';
32 tmax = self.absmax - '25 25 -8';
33 tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
34 if (self.spawnflags & PLAT_LOW_TRIGGER)
37 if (self.size_x <= 50)
39 tmin_x = (self.mins_x + self.maxs_x) / 2;
42 if (self.size_y <= 50)
44 tmin_y = (self.mins_y + self.maxs_y) / 2;
52 setsize (trigger, tmin, tmax);
56 // otherwise, something is fishy...
58 objerror("plat_spawn_inside_trigger: platform has odd size or lip, can't spawn");
63 _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
66 self.SUB_THINK = plat_go_down;
67 self.SUB_NEXTTHINK = self.SUB_LTIME + 3;
70 void plat_hit_bottom()
72 _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
78 _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
80 SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom);
85 _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
87 SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top);
90 void plat_center_touch()
93 if (!other.iscreature)
96 if (other.health <= 0)
99 if (!IS_PLAYER(other))
105 if (self.enemy.state == 2)
106 WITHSELF(self.enemy, plat_go_up());
107 else if (self.enemy.state == 1)
108 self.enemy.SUB_NEXTTHINK = self.enemy.SUB_LTIME + 1;
111 void plat_outside_touch()
114 if (!other.iscreature)
117 if (other.health <= 0)
120 if (!IS_PLAYER(other))
124 if (self.enemy.state == 1)
125 WITHSELF(self.enemy, plat_go_down());
128 void plat_trigger_use(entity this, entity actor, entity trigger)
132 return; // already activated
137 WITHSELF(this, plat_go_down());
143 if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO))
144 { // KIll Kill Kill!!
146 Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
152 if((self.dmg) && (other.takedamage != DAMAGE_NO))
154 Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
155 // Gib dead/dying stuff
157 Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
163 else if (self.state == 3)
165 // when in other states, then the plat_crush event came delayed after
166 // plat state already had changed
167 // this isn't a bug per se!
171 void plat_use(entity this, entity actor, entity trigger)
173 this.use = func_null;
175 objerror ("plat_use: not in up state");
176 WITHSELF(this, plat_go_down());
179 .string sound1, sound2;
181 void plat_reset(entity this)
185 setorigin (this, this.pos1);
191 setorigin (this, this.pos2);
193 this.use = plat_trigger_use;
197 this.SendFlags |= SF_TRIGGER_RESET;
201 .float platmovetype_start_default, platmovetype_end_default;
202 bool set_platmovetype(entity e, string s)
204 // sets platmovetype_start and platmovetype_end based on a string consisting of two values
206 int n = tokenize_console(s);
208 e.platmovetype_start = stof(argv(0));
210 e.platmovetype_start = 0;
213 e.platmovetype_end = stof(argv(1));
215 e.platmovetype_end = e.platmovetype_start;
218 if(argv(2) == "force")
219 return true; // no checking, return immediately
221 if(!cubic_speedfunc_is_sane(e.platmovetype_start, e.platmovetype_end))
223 objerror("Invalid platform move type; platform would go in reverse, which is not allowed.");