Context menu tweaks (#10883)

This commit is contained in:
metalgearsloth
2022-09-06 13:40:31 +10:00
committed by GitHub
parent 2b1c6524a8
commit 34b7e31e76
5 changed files with 47 additions and 18 deletions

View File

@@ -21,6 +21,7 @@ using Robust.Shared.Containers;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Utility;
namespace Content.Client.Verbs namespace Content.Client.Verbs
{ {
@@ -130,43 +131,53 @@ namespace Content.Client.Verbs
// remove any entities in containers // remove any entities in containers
if ((visibility & MenuVisibility.InContainer) == 0) if ((visibility & MenuVisibility.InContainer) == 0)
{ {
foreach (var entity in entities.ToList()) for (var i = entities.Count - 1; i >= 0; i--)
{ {
if (!ContainerSystem.IsInSameOrTransparentContainer(player.Value, entity)) var entity = entities[i];
entities.Remove(entity);
if (ContainerSystem.IsInSameOrTransparentContainer(player.Value, entity))
continue;
entities.RemoveSwap(i);
} }
} }
// remove any invisible entities // remove any invisible entities
if ((visibility & MenuVisibility.Invisible) == 0) if ((visibility & MenuVisibility.Invisible) == 0)
{ {
foreach (var entity in entities.ToList()) var spriteQuery = GetEntityQuery<SpriteComponent>();
{ var tagQuery = GetEntityQuery<TagComponent>();
if (!EntityManager.TryGetComponent(entity, out ISpriteComponent? spriteComponent) ||
!spriteComponent.Visible)
{
entities.Remove(entity);
continue;
}
if (_tagSystem.HasTag(entity, "HideContextMenu")) for (var i = entities.Count - 1; i >= 0; i--)
entities.Remove(entity); {
var entity = entities[i];
if (!spriteQuery.TryGetComponent(entity, out var spriteComponent) ||
!spriteComponent.Visible ||
_tagSystem.HasTag(entity, "HideContextMenu", tagQuery))
{
entities.RemoveSwap(i);
}
} }
} }
// Remove any entities that do not have LOS // Remove any entities that do not have LOS
if ((visibility & MenuVisibility.NoFov) == 0) if ((visibility & MenuVisibility.NoFov) == 0)
{ {
var playerPos = EntityManager.GetComponent<TransformComponent>(player.Value).MapPosition; var xformQuery = GetEntityQuery<TransformComponent>();
foreach (var entity in entities.ToList()) var playerPos = xformQuery.GetComponent(player.Value).MapPosition;
for (var i = entities.Count - 1; i >= 0; i--)
{ {
var entity = entities[i];
if (!ExamineSystemShared.InRangeUnOccluded( if (!ExamineSystemShared.InRangeUnOccluded(
playerPos, playerPos,
EntityManager.GetComponent<TransformComponent>(entity).MapPosition, xformQuery.GetComponent(entity).MapPosition,
ExamineSystemShared.ExamineRange, ExamineSystemShared.ExamineRange,
null)) null))
{ {
entities.Remove(entity); entities.RemoveSwap(i);
} }
} }
} }

View File

@@ -6,7 +6,7 @@
lifetime: 2 lifetime: 2
- type: Sprite - type: Sprite
netsync: false netsync: false
drawdepth: Effects drawdepth: SmallMobs
noRot: true noRot: true
layers: layers:
- shader: unshaded - shader: unshaded
@@ -14,6 +14,9 @@
sprite: Effects/atmospherics.rsi sprite: Effects/atmospherics.rsi
state: frezon_old state: frezon_old
- type: EffectVisuals - type: EffectVisuals
- type: Tag
tags:
- HideContextMenu
- type: AnimationPlayer - type: AnimationPlayer
- type: entity - type: entity

View File

@@ -10,6 +10,9 @@
- shader: unshaded - shader: unshaded
map: ["enum.EffectLayers.Unshaded"] map: ["enum.EffectLayers.Unshaded"]
- type: EffectVisuals - type: EffectVisuals
- type: Tag
tags:
- HideContextMenu
- type: AnimationPlayer - type: AnimationPlayer
- type: hitscan - type: hitscan

View File

@@ -13,6 +13,9 @@
sprite: Objects/Weapons/Guns/Projectiles/projectiles_tg.rsi sprite: Objects/Weapons/Guns/Projectiles/projectiles_tg.rsi
state: impact_bullet state: impact_bullet
- type: EffectVisuals - type: EffectVisuals
- type: Tag
tags:
- HideContextMenu
- type: entity - type: entity
id: BulletImpactEffectDisabler id: BulletImpactEffectDisabler
@@ -29,6 +32,9 @@
sprite: Objects/Weapons/Guns/Projectiles/projectiles_tg.rsi sprite: Objects/Weapons/Guns/Projectiles/projectiles_tg.rsi
state: impact_laser_blue state: impact_laser_blue
- type: EffectVisuals - type: EffectVisuals
- type: Tag
tags:
- HideContextMenu
- type: entity - type: entity
id: BulletImpactEffectKinetic id: BulletImpactEffectKinetic
@@ -45,3 +51,6 @@
sprite: Effects/arcs.rsi sprite: Effects/arcs.rsi
state: punch state: punch
- type: EffectVisuals - type: EffectVisuals
- type: Tag
tags:
- HideContextMenu

View File

@@ -13,6 +13,9 @@
sprite: Objects/Weapons/Guns/Projectiles/projectiles.rsi sprite: Objects/Weapons/Guns/Projectiles/projectiles.rsi
state: muzzle_bullet state: muzzle_bullet
- type: EffectVisuals - type: EffectVisuals
- type: Tag
tags:
- HideContextMenu
- type: AnimationPlayer - type: AnimationPlayer
# One bullet to bring them all into the darkness and bind them # One bullet to bring them all into the darkness and bind them