From: bones_was_here Date: Wed, 21 Jul 2021 23:12:15 +0000 (+1000) Subject: Document and slightly refactor defrag_waypointsprites() X-Git-Tag: xonotic-v0.8.5~352^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5604ea4b240f6ebc90f93c549df6d546a2b808d0;p=xonotic%2Fxonotic-data.pk3dir.git Document and slightly refactor defrag_waypointsprites() --- diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 715d00d46..5ccb607e9 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -841,26 +841,26 @@ bool race_waypointsprite_visible_for_player(entity this, entity player, entity v void defrag_waypointsprites(entity targeted, entity checkpoint) { - for(entity t = findchain(target, targeted.targetname); t; t = t.chain) - { - if(t.modelindex) - { - entity s = WP_RaceStart; - - if(checkpoint.classname == "target_checkpoint") - s = WP_RaceCheckpoint; - else if(checkpoint.classname == "target_stopTimer") - s = WP_RaceFinish; + // bones_was_here: spawn a waypoint for every entity with a bmodel + // that directly or indirectly targets this checkpoint + // (anything a player could touch or shoot to activate this cp) - vector o = (t.absmin + t.absmax) * 0.5; - - WaypointSprite_SpawnFixed(s, o, t, sprite, RADARICON_NONE); + entity s = WP_RaceCheckpoint; + if (checkpoint.classname == "target_startTimer") + s = WP_RaceStart; + else if (checkpoint.classname == "target_stopTimer") + s = WP_RaceFinish; + for (entity t = findchain(target, targeted.targetname); t; t = t.chain) + { + if (t.modelindex) + { + WaypointSprite_SpawnFixed(s, (t.absmin + t.absmax) * 0.5, t, sprite, RADARICON_NONE); t.sprite.realowner = checkpoint; t.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player; } - if(t.targetname) + if (t.targetname) defrag_waypointsprites(t, checkpoint); } }