1 void generic_plat_blocked(entity this)
4 if(this.dmg && other.takedamage != DAMAGE_NO)
6 if(this.dmgtime2 < time)
8 Damage (other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
9 this.dmgtime2 = time + this.dmgtime;
12 // Gib dead/dying stuff
14 Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
19 void plat_spawn_inside_trigger(entity this)
25 settouch(trigger, plat_center_touch);
26 trigger.movetype = MOVETYPE_NONE;
27 trigger.solid = SOLID_TRIGGER;
30 tmin = this.absmin + '25 25 0';
31 tmax = this.absmax - '25 25 -8';
32 tmin_z = tmax_z - (this.pos1_z - this.pos2_z + 8);
33 if (this.spawnflags & PLAT_LOW_TRIGGER)
36 if (this.size_x <= 50)
38 tmin_x = (this.mins_x + this.maxs_x) / 2;
41 if (this.size_y <= 50)
43 tmin_y = (this.mins_y + this.maxs_y) / 2;
51 setsize (trigger, tmin, tmax);
55 // otherwise, something is fishy...
57 objerror(this, "plat_spawn_inside_trigger: platform has odd size or lip, can't spawn");
60 void plat_hit_top(entity this)
62 _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
65 SUB_THINK(this, plat_go_down);
66 this.SUB_NEXTTHINK = this.SUB_LTIME + 3;
69 void plat_hit_bottom(entity this)
71 _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
75 void plat_go_down(entity this)
77 _sound (this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_NORM);
79 SUB_CalcMove (this, this.pos2, TSPEED_LINEAR, this.speed, plat_hit_bottom);
82 void plat_go_up(entity this)
84 _sound (this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_NORM);
86 SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, plat_hit_top);
89 void plat_center_touch(entity this)
92 if (!other.iscreature)
95 if (other.health <= 0)
98 if (!IS_PLAYER(other))
104 if (this.enemy.state == 2) {
105 plat_go_up(this.enemy);
106 } else if (this.enemy.state == 1)
107 this.enemy.SUB_NEXTTHINK = this.enemy.SUB_LTIME + 1;
110 void plat_outside_touch(entity this)
113 if (!other.iscreature)
116 if (other.health <= 0)
119 if (!IS_PLAYER(other))
123 if (this.enemy.state == 1) {
124 entity e = this.enemy;
129 void plat_trigger_use(entity this, entity actor, entity trigger)
133 return; // already activated
142 void plat_crush(entity this)
144 if((this.spawnflags & 4) && (other.takedamage != DAMAGE_NO))
145 { // KIll Kill Kill!!
147 Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
153 if((this.dmg) && (other.takedamage != DAMAGE_NO))
155 Damage (other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
156 // Gib dead/dying stuff
158 Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
164 else if (this.state == 3)
166 // when in other states, then the plat_crush event came delayed after
167 // plat state already had changed
168 // this isn't a bug per se!
172 void plat_use(entity this, entity actor, entity trigger)
174 this.use = func_null;
176 objerror (this, "plat_use: not in up state");
180 .string sound1, sound2;
182 void plat_reset(entity this)
186 setorigin(this, this.pos1);
192 setorigin(this, this.pos2);
194 this.use = plat_trigger_use;
198 this.SendFlags |= SF_TRIGGER_RESET;
202 .float platmovetype_start_default, platmovetype_end_default;
203 bool set_platmovetype(entity e, string s)
205 // sets platmovetype_start and platmovetype_end based on a string consisting of two values
207 int n = tokenize_console(s);
209 e.platmovetype_start = stof(argv(0));
211 e.platmovetype_start = 0;
214 e.platmovetype_end = stof(argv(1));
216 e.platmovetype_end = e.platmovetype_start;
219 if(argv(2) == "force")
220 return true; // no checking, return immediately
222 if(!cubic_speedfunc_is_sane(e.platmovetype_start, e.platmovetype_end))
224 objerror(e, "Invalid platform move type; platform would go in reverse, which is not allowed.");