X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmapobjects%2Fplatforms.qc;h=9e1f635b32c9982ab594d10c3036bad243f6e00e;hb=e4c6c6d7f00f23fe23a2145278a15c308e70ec28;hp=4747877314a3ac52f78c30c06233ec3f63dcf170;hpb=fbd313c7ceb26a09310d8062926f4ac2468623a8;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mapobjects/platforms.qc b/qcsrc/common/mapobjects/platforms.qc index 474787731..9e1f635b3 100644 --- a/qcsrc/common/mapobjects/platforms.qc +++ b/qcsrc/common/mapobjects/platforms.qc @@ -1,4 +1,5 @@ #include "platforms.qh" + void generic_plat_blocked(entity this, entity blocker) { #ifdef SVQC @@ -19,10 +20,9 @@ void generic_plat_blocked(entity this, entity blocker) void plat_spawn_inside_trigger(entity this) { - entity trigger; vector tmin, tmax; - trigger = spawn(); + entity trigger = spawn(); settouch(trigger, plat_center_touch); set_movetype(trigger, MOVETYPE_NONE); trigger.solid = SOLID_TRIGGER; @@ -93,7 +93,7 @@ void plat_center_touch(entity this, entity toucher) if (!toucher.iscreature) return; - if (toucher.health <= 0) + if (GetResource(toucher, RES_HEALTH) <= 0) return; #elif defined(CSQC) if (!IS_PLAYER(toucher)) @@ -114,7 +114,7 @@ void plat_outside_touch(entity this, entity toucher) if (!toucher.iscreature) return; - if (toucher.health <= 0) + if (GetResource(toucher, RES_HEALTH) <= 0) return; #elif defined(CSQC) if (!IS_PLAYER(toucher)) @@ -173,13 +173,21 @@ void plat_use(entity this, entity actor, entity trigger) plat_go_down(this); } +void plat_target_use(entity this, entity actor, entity trigger) +{ + if (this.state == STATE_TOP) + this.nextthink = this.ltime + 1; + else if (this.state != STATE_UP) + plat_go_up(this); +} + // WARNING: backwards compatibility because people don't use already existing fields :( // TODO: Check if any maps use these fields and remove these fields if it doesn't break maps .string sound1, sound2; void plat_reset(entity this) { - IFTARGETED + if(this.targetname && this.targetname != "" && !Q3COMPAT_COMMON) { setorigin(this, this.pos1); this.state = STATE_UP; @@ -189,7 +197,7 @@ void plat_reset(entity this) { setorigin(this, this.pos2); this.state = STATE_BOTTOM; - this.use = plat_trigger_use; + this.use = (this.targetname != "" && Q3COMPAT_COMMON) ? plat_target_use : plat_trigger_use; } #ifdef SVQC