13void GlowVision::DestroyPair(GlowPair& pair)
29void GlowVision::CreatePair(
int slot, GlowPair& pair)
31 Pawn pawn = _entities.
Pawn(slot);
38 const Team team = pawn.TeamNum();
45 relayKv.Set(
"model", model.c_str())
48 const Entity relay = _entities.Spawn(
"prop_dynamic", relayKv);
54 relay.AcceptInput(
"FollowEntity",
"!activator", pawn);
56 _entities.SpawnOutline(relay, model, {.Color = team ==
Team::T ? _config.TerroristColor : _config.CtColor});
63 pair.Relay = relay.Ref();
64 pair.Glow = glow.Ref();
66 pair.Model = std::move(model);
68 ShowToViewers(pair.Relay);
69 ShowToViewers(pair.Glow);
72void GlowVision::ShowToViewers(
EntityRef entity)
76 _visibility.ShowOnlyTo(entity, _viewerSlot);
80 _visibility.ShowOnlyToTeam(entity, _viewerTeam);
88 auto& pair = _pairs[slot];
90 Pawn pawn = _entities.Pawn(slot);
91 const Team team = pawn.TeamNum();
93 bool desired = slot != _viewerSlot && pawn && pawn.
IsAlive() &&
IsPlaying(team) &&
94 !_visibility.IsPawnHidden(slot) && (!_config.Filter || _config.Filter(slot));
98 bool stale = !desired || team != pair.Team || !_entities.Get(pair.Relay) || !_entities.Get(pair.Glow) ||
106 if (!pair.Active() && desired)
108 CreatePair(slot, pair);
115 for (
auto& pair : _pairs)
VoltMod::Pawn Pawn(int slot)
Entity Get(EntityRef ref)
A player's body: health, armor, movement, aim, weapons. The engine replaces it on every spawn; the Co...
std::string ModelName() const
void ShowToEveryone(EntityRef entity)
constexpr bool IsPlaying(Team team)
static constexpr int PropSpawnFlags