]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/platforms.qc
Merge branch 'master' into z411/bai-server
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / platforms.qc
index afd349673c5cba98654d9ee6d97b57f4b35309f8..08458a630b3aa1187e330039111104a4ae7406c4 100644 (file)
@@ -20,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;
@@ -174,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)
 {
-       if(this.targetname && this.targetname != "")
+       if (this.targetname && this.targetname != "" && !Q3COMPAT_COMMON)
        {
                setorigin(this, this.pos1);
                this.state = STATE_UP;
@@ -190,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