]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/platforms.qc
func_door and func_plat fixes and Q3 compatibility
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / platforms.qc
index 832b25b6b4e8f6513bd30655347ef0472f8c3468..9e1f635b32c9982ab594d10c3036bad243f6e00e 100644 (file)
@@ -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;
@@ -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