]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
func_plat: don't spawn a "start moving" trigger when .targetname is set on Q3 maps
authorbones_was_here <bones_was_here@xonotic.au>
Fri, 15 Sep 2023 06:37:11 +0000 (16:37 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 15 Sep 2023 07:11:45 +0000 (17:11 +1000)
qcsrc/common/mapobjects/func/plat.qc
qcsrc/common/mapobjects/platforms.qc

index 2376c5956de1adbdc227654e30b819c8d5137b0f..15f21b1d4d8fc8c41f44b4a26ff52100fec44e75 100644 (file)
@@ -7,7 +7,9 @@ void plat_link(entity this);
 void plat_delayedinit(entity this)
 {
        plat_link(this);
-       plat_spawn_inside_trigger(this); // the "start moving" trigger
+       // Q3 uses only a truth check of .targetname to decide whether to spawn a trigger
+       if (!Q3COMPAT_COMMON || this.targetname == "")
+               plat_spawn_inside_trigger(this); // the "start moving" trigger
 }
 
 float plat_send(entity this, entity to, float sf)
@@ -186,7 +188,8 @@ NET_HANDLE(ENT_CLIENT_PLAT, bool isnew)
                set_movetype(this, MOVETYPE_PUSH);
                this.move_time = time;
 
-               plat_spawn_inside_trigger(this);
+               if (!Q3COMPAT_COMMON || this.targetname == "")
+                       plat_spawn_inside_trigger(this);
        }
 
        if(sf & SF_TRIGGER_RESET)
index ccc5be22bca6c026d78ff9c8deec59d964160b8f..08458a630b3aa1187e330039111104a4ae7406c4 100644 (file)
@@ -173,6 +173,14 @@ 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;
@@ -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