From: bones_was_here Date: Thu, 20 Aug 2020 02:25:36 +0000 (+1000) Subject: q3df: Spawn waypoints for all entities able to trigger a checkpoint and be directly... X-Git-Tag: xonotic-v0.8.5~352^2~46 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ef4840d7c839235f73f7dda865435c74055b29fc;p=xonotic%2Fxonotic-data.pk3dir.git q3df: Spawn waypoints for all entities able to trigger a checkpoint and be directly activated by a player (Fixes #2465) --- diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index c2de3c9cc..377bcb706 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -754,6 +754,32 @@ bool race_waypointsprite_visible_for_player(entity this, entity player, entity v return false; } +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; + + vector o = (t.absmin + t.absmax) * 0.5; + + WaypointSprite_SpawnFixed(s, o, t, sprite, RADARICON_NONE); + + t.sprite.realowner = checkpoint; + t.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player; + } + + if(t.targetname) + defrag_waypointsprites(t, checkpoint); + } +} + void trigger_race_checkpoint_verify(entity this) { static bool have_verified; @@ -832,37 +858,39 @@ void trigger_race_checkpoint_verify(entity this) g_race_qualifying = qual; - IL_EACH(g_race_targets, it.classname == "target_checkpoint" || it.classname == "target_startTimer" || it.classname == "target_stopTimer", - { - if(it.targetname == "" || !it.targetname) // somehow this is a case... - continue; - entity cpt = it; - FOREACH_ENTITY_STRING(target, cpt.targetname, - { - vector org = (it.absmin + it.absmax) * 0.5; - if(cpt.race_checkpoint == 0) - WaypointSprite_SpawnFixed(WP_RaceStart, org, it, sprite, RADARICON_NONE); - else - WaypointSprite_SpawnFixed(WP_RaceCheckpoint, org, it, sprite, RADARICON_NONE); - - it.sprite.realowner = cpt; - it.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player; - }); - }); +// IL_EACH(g_race_targets, it.classname == "target_checkpoint" || it.classname == "target_startTimer" || it.classname == "target_stopTimer", +// { +// if(it.targetname == "" || !it.targetname) // somehow this is a case... +// continue; +// entity cpt = it; +// FOREACH_ENTITY_STRING(target, cpt.targetname, +// { +// vector org = (it.absmin + it.absmax) * 0.5; +// if(cpt.race_checkpoint == 0) +// WaypointSprite_SpawnFixed(WP_RaceStart, org, it, sprite, RADARICON_NONE); +// else +// WaypointSprite_SpawnFixed(WP_RaceCheckpoint, org, it, sprite, RADARICON_NONE); +// +// it.sprite.realowner = cpt; +// it.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player; +// }); +// defrag_waypointsprites(it, it); +// }); if (race_timed_checkpoint) { if (defrag_ents) { IL_EACH(g_race_targets, it.classname == "target_checkpoint" || it.classname == "target_startTimer" || it.classname == "target_stopTimer", { - entity cpt = it; - if(it.classname == "target_startTimer" || it.classname == "target_stopTimer") { - if(it.targetname == "" || !it.targetname) // somehow this is a case... - continue; - FOREACH_ENTITY_STRING(target, cpt.targetname, { - if(it.sprite) - WaypointSprite_UpdateSprites(it.sprite, ((cpt.classname == "target_startTimer") ? WP_RaceStart : WP_RaceFinish), WP_Null, WP_Null); - }); - } +// entity cpt = it; +// if(it.classname == "target_startTimer" || it.classname == "target_stopTimer") { +// if(it.targetname == "" || !it.targetname) // somehow this is a case... +// continue; +// FOREACH_ENTITY_STRING(target, cpt.targetname, { +// if(it.sprite) +// WaypointSprite_UpdateSprites(it.sprite, ((cpt.classname == "target_startTimer") ? WP_RaceStart : WP_RaceFinish), WP_Null, WP_Null); +// }); +// } + defrag_waypointsprites(it, it); if(it.classname == "target_checkpoint") { if(it.race_checkpoint == -2) defragcpexists = -1; // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes