2 void generic_plat_blocked()
4 if(self.dmg && other.takedamage != DAMAGE_NO) {
5 if(self.dmgtime2 < time) {
6 Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
7 self.dmgtime2 = time + self.dmgtime;
10 // Gib dead/dying stuff
11 if(other.deadflag != DEAD_NO)
12 Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
16 void plat_spawn_inside_trigger()
22 trigger.touch = plat_center_touch;
23 trigger.movetype = MOVETYPE_NONE;
24 trigger.solid = SOLID_TRIGGER;
27 tmin = self.absmin + '25 25 0';
28 tmax = self.absmax - '25 25 -8';
29 tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
30 if (self.spawnflags & PLAT_LOW_TRIGGER)
33 if (self.size_x <= 50)
35 tmin_x = (self.mins_x + self.maxs_x) / 2;
38 if (self.size_y <= 50)
40 tmin_y = (self.mins_y + self.maxs_y) / 2;
48 setsize (trigger, tmin, tmax);
52 // otherwise, something is fishy...
54 objerror("plat_spawn_inside_trigger: platform has odd size or lip, can't spawn");
59 sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
61 self.think = plat_go_down;
62 self.nextthink = self.ltime + 3;
65 void plat_hit_bottom()
67 sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
73 sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
75 SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom);
80 sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
82 SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top);
85 void plat_center_touch()
87 if (!other.iscreature)
90 if (other.health <= 0)
96 else if (self.state == 1)
97 self.nextthink = self.ltime + 1; // delay going down
100 void plat_outside_touch()
102 if (!other.iscreature)
105 if (other.health <= 0)
113 void plat_trigger_use()
116 return; // already activated
123 if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
124 Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
126 if((self.dmg) && (other.takedamage != DAMAGE_NO)) { // Shall we bite?
127 Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
128 // Gib dead/dying stuff
129 if(other.deadflag != DEAD_NO)
130 Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
135 else if (self.state == 3)
137 // when in other states, then the plat_crush event came delayed after
138 // plat state already had changed
139 // this isn't a bug per se!
145 self.use = func_null;
147 objerror ("plat_use: not in up state");
151 .string sound1, sound2;
157 setorigin (self, self.pos1);
163 setorigin (self, self.pos2);
165 self.use = plat_trigger_use;
169 .float platmovetype_start_default, platmovetype_end_default;
170 float set_platmovetype(entity e, string s)
172 // sets platmovetype_start and platmovetype_end based on a string consisting of two values
175 n = tokenize_console(s);
177 e.platmovetype_start = stof(argv(0));
179 e.platmovetype_start = 0;
182 e.platmovetype_end = stof(argv(1));
184 e.platmovetype_end = e.platmovetype_start;
187 if(argv(2) == "force")
188 return TRUE; // no checking, return immediately
190 if(!cubic_speedfunc_is_sane(e.platmovetype_start, e.platmovetype_end))
192 objerror("Invalid platform move type; platform would go in reverse, which is not allowed.");