From: bones_was_here Date: Fri, 15 Sep 2023 06:37:11 +0000 (+1000) Subject: func_plat: don't spawn a "start moving" trigger when .targetname is set on Q3 maps X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=24e85b08e926ae6fa1be129b41fe65a7c208b1fe;p=xonotic%2Fxonotic-data.pk3dir.git func_plat: don't spawn a "start moving" trigger when .targetname is set on Q3 maps --- diff --git a/qcsrc/common/mapobjects/func/plat.qc b/qcsrc/common/mapobjects/func/plat.qc index 2376c5956..15f21b1d4 100644 --- a/qcsrc/common/mapobjects/func/plat.qc +++ b/qcsrc/common/mapobjects/func/plat.qc @@ -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) diff --git a/qcsrc/common/mapobjects/platforms.qc b/qcsrc/common/mapobjects/platforms.qc index ccc5be22b..08458a630 100644 --- a/qcsrc/common/mapobjects/platforms.qc +++ b/qcsrc/common/mapobjects/platforms.qc @@ -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