]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Entcs: fix health/armor bar above enemies not updated switching from player to observ...
authorterencehill <piuntn@gmail.com>
Fri, 22 Jan 2021 14:20:31 +0000 (15:20 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 22 Jan 2021 14:20:31 +0000 (15:20 +0100)
qcsrc/common/ent_cs.qc
qcsrc/common/ent_cs.qh
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc
qcsrc/server/client.qc

index 3d9127cbb5029af38ab53079f7ad1ed0f3345925..d5815c01ef07ebaacba4a3cb91a563c8562279d6 100644 (file)
@@ -159,12 +159,23 @@ ENTCS_PROP(SOLID, true, sv_solid, solid, ENTCS_SET_NORMAL,
 
 #ifdef SVQC
 
-       int ENTCS_PUBLICMASK = 0;
+       int ENTCS_PUBLICMASK = 0, ENTCS_PRIVATEMASK = 0;
        STATIC_INIT(ENTCS_PUBLICMASK)
        {
-               FOREACH(EntCSProps, it.m_public,
+               FOREACH(EntCSProps, true,
                {
-                       ENTCS_PUBLICMASK |= BIT(it.m_id);
+                       if (it.m_public)
+                               ENTCS_PUBLICMASK |= BIT(it.m_id);
+                       else
+                               ENTCS_PRIVATEMASK |= BIT(it.m_id);
+               });
+       }
+
+       void entcs_update_players(entity player)
+       {
+               FOREACH_CLIENT(it != player && IS_PLAYER(it),
+               {
+                       CS(it).entcs.SendFlags |= ENTCS_PRIVATEMASK;
                });
        }
 
index 8ae89fd3b6c49707e06a958ea31ae1700159a8b6..db0dc466ba9144c076f9f60284e5366c68055645 100644 (file)
@@ -12,9 +12,6 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
 .bool m_entcs_private;
 
 /** True when origin is available */
-// FIXME: it seems sometimes this is false when observing even though observers should be able to know about all players
-// easily reproducible on heart_v2 or The_Yard with bots - might be because they lack waypoints and bots stand still
-// it has happened in matches with players and no bots but much more rarely
 .bool has_origin;
 
 /** True when a recent server sent origin has been received */
@@ -47,6 +44,8 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
 
        void entcs_force_origin(entity player);
 
+       void entcs_update_players(entity player);
+
        bool radar_showenemies;
 
 #endif
index 73d127bd40c707f39a29bcb7f31f0b64afa0e4a2..bb23f51c8087833caa2e6511a46476ae4b8137c9 100644 (file)
@@ -310,7 +310,10 @@ MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver)
        if (IS_PLAYER(player) && !IS_DEAD(player))
                ca_LastPlayerForTeam_Notify(player);
        if (player.killindicator_teamchange == -2) // player wants to spectate
+       {
+               entcs_update_players(player);
                player.caplayer = 0;
+       }
        if (player.caplayer)
                player.frags = FRAGS_PLAYER_OUT_OF_GAME;
        if (!warmup_stage)
index d398ecf3aae553245dd3f7727120d46cf4ff0871..e2208fb34e3837c8a4a5b05011135ce9e3fca359 100644 (file)
@@ -252,8 +252,6 @@ NET_HANDLE(damagetext, bool isNew)
         }
         make_impure(NEW(DamageText, server_entity_index, entcs.origin, false, health, armor, potential_damage, deathtype, friendlyfire));
     } else if (autocvar_cl_damagetext_2d && spectatee_status != -1) {
-        // never show 2d damagetext when observing - might be a bug in .has_origin
-
         // screen coords only
         vector screen_pos = vec2(vid_conwidth * autocvar_cl_damagetext_2d_pos.x, vid_conheight * autocvar_cl_damagetext_2d_pos.y);
         IL_EACH(g_drawables_2d, it.instanceOfDamageText && it.m_screen_coords && it.m_group == server_entity_index, {
index 69e36d7c448da44922b574429d5eed256426ac9a..7c73dee423bd675fac1abac930d2114fd5da593a 100644 (file)
@@ -253,6 +253,7 @@ void PutObserverInServer(entity this)
                        if (vote_called) { VoteCount(false); }
                        ReadyCount();
                }
+               entcs_update_players(this);
        }
 
        entity spot = SelectSpawnPoint(this, true);