From 8ec2d9fc5a179af3e1ce77e069ceba73cc0bd10f Mon Sep 17 00:00:00 2001 From: Mor-Dast Date: Wed, 11 Dec 2024 15:17:29 +0300 Subject: [PATCH 1/2] mics --- .../ADT/NightVision/NightVisionSystem.cs | 7 + .../_Silver/ThermalVisionComponent.cs | 26 +++ Content.Server/_Silver/ThermalVisionSystem.cs | 65 ++++++ .../ADTNightVisionVisibleComponent.cs | 25 +++ .../ADT/NightVision/NightVisionComponent.cs | 38 ++++ .../NightVision/NightVisionItemComponent.cs | 28 +++ .../ADT/NightVision/NightVisionItemVisuals.cs | 11 + .../NightVision/SharedNightVisionSystem.cs | 201 ++++++++++++++++++ .../ADT/NightVision/ToggleNightVision.cs | 13 ++ .../Prototypes/_Silver/Surgery/implants.yml | 38 ++++ Resources/Prototypes/_Silver/supermatter.yml | 87 ++++++++ .../_Silver/supermattergen.rsi/meta.json | 14 ++ .../supermattergen.rsi/supermatter.png | Bin 0 -> 934 bytes 13 files changed, 553 insertions(+) create mode 100644 Content.Server/ADT/NightVision/NightVisionSystem.cs create mode 100644 Content.Server/_Silver/ThermalVisionComponent.cs create mode 100644 Content.Server/_Silver/ThermalVisionSystem.cs create mode 100644 Content.Shared/ADT/NightVision/ADTNightVisionVisibleComponent.cs create mode 100644 Content.Shared/ADT/NightVision/NightVisionComponent.cs create mode 100644 Content.Shared/ADT/NightVision/NightVisionItemComponent.cs create mode 100644 Content.Shared/ADT/NightVision/NightVisionItemVisuals.cs create mode 100644 Content.Shared/ADT/NightVision/SharedNightVisionSystem.cs create mode 100644 Content.Shared/ADT/NightVision/ToggleNightVision.cs create mode 100644 Resources/Prototypes/_Silver/Surgery/implants.yml create mode 100644 Resources/Textures/_Silver/supermattergen.rsi/meta.json create mode 100644 Resources/Textures/_Silver/supermattergen.rsi/supermatter.png diff --git a/Content.Server/ADT/NightVision/NightVisionSystem.cs b/Content.Server/ADT/NightVision/NightVisionSystem.cs new file mode 100644 index 00000000000..5f6a3602a1c --- /dev/null +++ b/Content.Server/ADT/NightVision/NightVisionSystem.cs @@ -0,0 +1,7 @@ +// taken and adapted from https://github.com/RMC-14/RMC-14?ysclid=lzx00zxd6e53093995 + +using Content.Shared.ADT.NightVision; + +namespace Content.Server.ADT.NightVision; + +public sealed class NightVisionSystem : SharedNightVisionSystem; diff --git a/Content.Server/_Silver/ThermalVisionComponent.cs b/Content.Server/_Silver/ThermalVisionComponent.cs new file mode 100644 index 00000000000..dbd455556ca --- /dev/null +++ b/Content.Server/_Silver/ThermalVisionComponent.cs @@ -0,0 +1,26 @@ +using Robust.Shared.GameObjects; +using Robust.Shared.ViewVariables; + +namespace Content.Server._Silver.ThermalVision +{ + [RegisterComponent] + public class ThermalVisionComponent : Component + { + public override string Name => "ThermalVision"; + + [ViewVariables(VVAccess.ReadWrite)] + public float VisionRadius { get; set; } = 10.0f; + + protected override void OnAdd() + { + base.OnAdd(); + EntitySystem.Get().Register(this); + } + + protected override void OnRemove() + { + base.OnRemove(); + EntitySystem.Get().Unregister(this); + } + } +} \ No newline at end of file diff --git a/Content.Server/_Silver/ThermalVisionSystem.cs b/Content.Server/_Silver/ThermalVisionSystem.cs new file mode 100644 index 00000000000..b6e486f0dd3 --- /dev/null +++ b/Content.Server/_Silver/ThermalVisionSystem.cs @@ -0,0 +1,65 @@ +using Robust.Shared.GameObjects; +using Robust.Shared.Map; +using Robust.Shared.Physics; +using Robust.Server.GameObjects; +using Robust.Shared.IoC; +using System.Collections.Generic; + +namespace Content.Server.Systems +{ + public class WallVisionSystem : EntitySystem + { + [Dependency] private readonly IMapManager _mapManager = default!; + + private readonly HashSet _wallVisionComponents = new(); + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnPlayerAttached); + } + + public void Register(WallVisionComponent component) + { + _wallVisionComponents.Add(component); + } + + public void Unregister(WallVisionComponent component) + { + _wallVisionComponents.Remove(component); + } + + private void OnPlayerAttached(EntityUid uid, WallVisionComponent component, PlayerAttachSystemMessage args) + { + UpdateVision(component, args.PlayerSession.AttachedEntity); + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + + foreach (var component in _wallVisionComponents) + { + if (component.Owner.TryGetComponent(out IMapGridComponent? grid) && + component.Owner.TryGetComponent(out TransformComponent? transform)) + { + UpdateVision(component, component.Owner); + } + } + } + + private void UpdateVision(WallVisionComponent component, IEntity owner) + { + var mapGrid = _mapManager.GetGrid(owner.Transform.GridID); + var worldPosition = owner.Transform.WorldPosition; + + foreach (var entity in mapGrid.GetEntitiesInRange(owner.Transform.Coordinates, component.VisionRadius)) + { + if (entity.HasComponent()) // Assuming MobComponent denotes a living entity + { + entity.Visible = true; + } + } + } + } +} \ No newline at end of file diff --git a/Content.Shared/ADT/NightVision/ADTNightVisionVisibleComponent.cs b/Content.Shared/ADT/NightVision/ADTNightVisionVisibleComponent.cs new file mode 100644 index 00000000000..6c5a997453e --- /dev/null +++ b/Content.Shared/ADT/NightVision/ADTNightVisionVisibleComponent.cs @@ -0,0 +1,25 @@ +// taken and adapted from https://github.com/RMC-14/RMC-14?ysclid=lzx00zxd6e53093995 + +using Robust.Shared.GameStates; + +namespace Content.Shared.ADT.NightVision; + +/// +/// For rendering sprites on top of FOV when the user has a . +/// +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +public sealed partial class NightVisionVisibleComponent : Component +{ + /// + /// Priority for rendering order. + /// Rendered from lowest to highest, which means higher numbers will be rendered above lower numbers. + /// + [DataField, AutoNetworkedField] + public int Priority = 0; + + /// + /// Transparency of the rendered sprite. + /// + [DataField, AutoNetworkedField] + public float? Transparency = null; +} diff --git a/Content.Shared/ADT/NightVision/NightVisionComponent.cs b/Content.Shared/ADT/NightVision/NightVisionComponent.cs new file mode 100644 index 00000000000..b0033594900 --- /dev/null +++ b/Content.Shared/ADT/NightVision/NightVisionComponent.cs @@ -0,0 +1,38 @@ +// taken and adapted from https://github.com/RMC-14/RMC-14?ysclid=lzx00zxd6e53093995 + +using Content.Shared.Alert; +using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization; + +namespace Content.Shared.ADT.NightVision; + +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)] +[Access(typeof(SharedNightVisionSystem))] +public sealed partial class NightVisionComponent : Component +{ + [DataField] + public ProtoId? Alert; + + [DataField, AutoNetworkedField] + public NightVisionState State = NightVisionState.Full; + + [DataField, AutoNetworkedField] + public bool Overlay; + + [DataField, AutoNetworkedField] + public bool Innate; + + [DataField, AutoNetworkedField] + public bool SeeThroughContainers; +} + +[Serializable, NetSerializable] +public enum NightVisionState +{ + Off, + Half, + Full +} + +public sealed partial class ToggleNightVision : BaseAlertEvent; diff --git a/Content.Shared/ADT/NightVision/NightVisionItemComponent.cs b/Content.Shared/ADT/NightVision/NightVisionItemComponent.cs new file mode 100644 index 00000000000..887d94c0a5a --- /dev/null +++ b/Content.Shared/ADT/NightVision/NightVisionItemComponent.cs @@ -0,0 +1,28 @@ +// taken and adapted from https://github.com/RMC-14/RMC-14?ysclid=lzx00zxd6e53093995 + +using Content.Shared.Inventory; +using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; + +namespace Content.Shared.ADT.NightVision; + +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[Access(typeof(SharedNightVisionSystem))] +public sealed partial class NightVisionItemComponent : Component +{ + [DataField, AutoNetworkedField] + public EntProtoId ActionId = "ActionToggleNinjaNightVision"; + + [DataField, AutoNetworkedField] + public EntityUid? Action; + + [DataField, AutoNetworkedField] + public EntityUid? User; + + [DataField, AutoNetworkedField] + public bool Toggleable = true; + + // Only allows for a single slotflag right now because some code uses strings and some code uses enums to determine slots :( + [DataField, AutoNetworkedField] + public SlotFlags SlotFlags { get; set; } = SlotFlags.EYES; +} diff --git a/Content.Shared/ADT/NightVision/NightVisionItemVisuals.cs b/Content.Shared/ADT/NightVision/NightVisionItemVisuals.cs new file mode 100644 index 00000000000..a0602cd1910 --- /dev/null +++ b/Content.Shared/ADT/NightVision/NightVisionItemVisuals.cs @@ -0,0 +1,11 @@ +// taken and adapted from https://github.com/RMC-14/RMC-14?ysclid=lzx00zxd6e53093995 + +using Robust.Shared.Serialization; + +namespace Content.Shared.ADT.NightVision; + +[Serializable, NetSerializable] +public enum NightVisionItemVisuals +{ + Active, +} diff --git a/Content.Shared/ADT/NightVision/SharedNightVisionSystem.cs b/Content.Shared/ADT/NightVision/SharedNightVisionSystem.cs new file mode 100644 index 00000000000..85a7bff3663 --- /dev/null +++ b/Content.Shared/ADT/NightVision/SharedNightVisionSystem.cs @@ -0,0 +1,201 @@ +// taken and adapted from https://github.com/RMC-14/RMC-14?ysclid=lzx00zxd6e53093995 + +using Content.Shared.Actions; +using Content.Shared.Alert; +using Content.Shared.Inventory.Events; +using Content.Shared.Rounding; +using Content.Shared.Toggleable; +using Robust.Shared.Timing; + +namespace Content.Shared.ADT.NightVision; + +public abstract class SharedNightVisionSystem : EntitySystem +{ + [Dependency] private readonly SharedActionsSystem _actions = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly AlertsSystem _alerts = default!; + [Dependency] private readonly IGameTiming _timing = default!; + + public override void Initialize() + { + SubscribeLocalEvent(OnNightVisionStartup); + SubscribeLocalEvent(OnNightVisionMapInit); + SubscribeLocalEvent(OnNightVisionAfterHandle); + SubscribeLocalEvent(OnNightVisionRemove); + + SubscribeLocalEvent(OnNightVisionItemGetActions); + SubscribeLocalEvent(OnNightVisionItemToggle); + SubscribeLocalEvent(OnNightVisionItemGotEquipped); + SubscribeLocalEvent(OnNightVisionItemGotUnequipped); + SubscribeLocalEvent(OnNightVisionItemActionRemoved); + SubscribeLocalEvent(OnNightVisionItemRemove); + SubscribeLocalEvent(OnNightVisionItemTerminating); + } + + private void OnNightVisionStartup(Entity ent, ref ComponentStartup args) + { + NightVisionChanged(ent); + } + + private void OnNightVisionAfterHandle(Entity ent, ref AfterAutoHandleStateEvent args) + { + NightVisionChanged(ent); + } + + private void OnNightVisionMapInit(Entity ent, ref MapInitEvent args) + { + UpdateAlert(ent); + } + + private void OnNightVisionRemove(Entity ent, ref ComponentRemove args) + { + if (ent.Comp.Alert is { } alert) + _alerts.ClearAlert(ent, alert); + + NightVisionRemoved(ent); + } + + private void OnNightVisionItemGetActions(Entity ent, ref GetItemActionsEvent args) + { + if (args.InHands || !ent.Comp.Toggleable) + return; + + if (ent.Comp.SlotFlags != args.SlotFlags) + return; + + args.AddAction(ref ent.Comp.Action, ent.Comp.ActionId); + } + + private void OnNightVisionItemToggle(Entity ent, ref ToggleActionEvent args) + { + if (args.Handled) + return; + + args.Handled = true; + ToggleNightVisionItem(ent, args.Performer); + } + + private void OnNightVisionItemGotEquipped(Entity ent, ref GotEquippedEvent args) + { + if (ent.Comp.SlotFlags != args.SlotFlags) + return; + + EnableNightVisionItem(ent, args.Equipee); + } + + private void OnNightVisionItemGotUnequipped(Entity ent, ref GotUnequippedEvent args) + { + if (ent.Comp.SlotFlags != args.SlotFlags) + return; + + DisableNightVisionItem(ent, args.Equipee); + } + + private void OnNightVisionItemActionRemoved(Entity ent, ref ActionRemovedEvent args) + { + DisableNightVisionItem(ent, ent.Comp.User); + } + + private void OnNightVisionItemRemove(Entity ent, ref ComponentRemove args) + { + DisableNightVisionItem(ent, ent.Comp.User); + } + + private void OnNightVisionItemTerminating(Entity ent, ref EntityTerminatingEvent args) + { + DisableNightVisionItem(ent, ent.Comp.User); + } + + public void Toggle(Entity ent) + { + if (!Resolve(ent, ref ent.Comp)) + return; + + ent.Comp.State = ent.Comp.State switch + { + NightVisionState.Off => NightVisionState.Half, + NightVisionState.Half => NightVisionState.Full, + NightVisionState.Full => NightVisionState.Off, + _ => throw new ArgumentOutOfRangeException(), + }; + + Dirty(ent); + UpdateAlert((ent, ent.Comp)); + } + + private void UpdateAlert(Entity ent) + { + if (ent.Comp.Alert is { } alert) + { + var level = MathF.Max((int) NightVisionState.Off, (int) ent.Comp.State); + var max = _alerts.GetMaxSeverity(alert); + var severity = max - ContentHelpers.RoundToLevels(level, (int) NightVisionState.Full, max + 1); + _alerts.ShowAlert(ent, alert, (short) severity); + } + + NightVisionChanged(ent); + } + + private void ToggleNightVisionItem(Entity item, EntityUid user) + { + if (item.Comp.User == user && item.Comp.Toggleable) + { + DisableNightVisionItem(item, item.Comp.User); + return; + } + + EnableNightVisionItem(item, user); + } + + private void EnableNightVisionItem(Entity item, EntityUid user) + { + DisableNightVisionItem(item, item.Comp.User); + + item.Comp.User = user; + Dirty(item); + + _appearance.SetData(item, NightVisionItemVisuals.Active, true); + + if (!_timing.ApplyingState) + { + var nightVision = EnsureComp(user); + nightVision.State = NightVisionState.Full; + Dirty(user, nightVision); + } + + _actions.SetToggled(item.Comp.Action, true); + } + + protected virtual void NightVisionChanged(Entity ent) + { + } + + protected virtual void NightVisionRemoved(Entity ent) + { + } + + protected void DisableNightVisionItem(Entity item, EntityUid? user) + { + _actions.SetToggled(item.Comp.Action, false); + + item.Comp.User = null; + Dirty(item); + + _appearance.SetData(item, NightVisionItemVisuals.Active, false); + + if (TryComp(user, out NightVisionComponent? nightVision) && + !nightVision.Innate) + { + RemCompDeferred(user.Value); + } + } + + public void SetSeeThroughContainers(Entity ent, bool see) + { + if (!Resolve(ent, ref ent.Comp, false)) + return; + + ent.Comp.SeeThroughContainers = see; + Dirty(ent); + } +} diff --git a/Content.Shared/ADT/NightVision/ToggleNightVision.cs b/Content.Shared/ADT/NightVision/ToggleNightVision.cs new file mode 100644 index 00000000000..45c739d015a --- /dev/null +++ b/Content.Shared/ADT/NightVision/ToggleNightVision.cs @@ -0,0 +1,13 @@ +//using Content.Shared.Alert; + +//namespace Content.Shared.ADT.NightVision; + +//[DataDefinition] +//public sealed partial class ToggleNightVision : IAlertClick +//{ +// public void AlertClicked(EntityUid player) +// { +// var entities = IoCManager.Resolve(); +// entities.System().Toggle(player); +// } +//} diff --git a/Resources/Prototypes/_Silver/Surgery/implants.yml b/Resources/Prototypes/_Silver/Surgery/implants.yml new file mode 100644 index 00000000000..259161659e0 --- /dev/null +++ b/Resources/Prototypes/_Silver/Surgery/implants.yml @@ -0,0 +1,38 @@ +# - type: NightVisionItem # RMC Night vision +# - type: ItemToggle + +- type: entity + parent: BasicCyberneticEyes + id: NightVisionCyberneticEyes + name: cybernetic eyes + description: A pair of cybernetic eyes that enhance your vision, and protect you from eye damage. + components: + - type: Organ + onAdd: + - type: InstantAction + icon: + sprite: Clothing/Eyes/Glasses/ninjavisor.rsi + state: icon + iconOn: + sprite: Clothing/Eyes/Glasses/ninjavisor.rsi + state: icon + event: !type:ToggleActionEvent + useDelay: 0.25 + - NightVisionComponent + - NightVisionItemComponent + +- type: entity + id: ActionToggleNinjaNightVision + categories: [HideSpawnMenu] + name: Toggle ninja visor nightvision + description: Allows you to see even in complete darkness. + components: + - type: InstantAction + icon: + sprite: Clothing/Eyes/Glasses/ninjavisor.rsi + state: icon + iconOn: + sprite: Clothing/Eyes/Glasses/ninjavisor.rsi + state: icon + event: !type:ToggleActionEvent + useDelay: 0.25 \ No newline at end of file diff --git a/Resources/Prototypes/_Silver/supermatter.yml b/Resources/Prototypes/_Silver/supermatter.yml index 7718bfe6521..b3b4612e0d3 100644 --- a/Resources/Prototypes/_Silver/supermatter.yml +++ b/Resources/Prototypes/_Silver/supermatter.yml @@ -61,3 +61,90 @@ maxIntensity: 25000 intensitySlope: 5 totalIntensity: 25000 + +- type: entity + id: SupermaterGenerator + description: Бессконечный источник электричества + name: суперматерьевый генератор + placement: + mode: SnapgridCenter + components: + - type: AmbientSound + range: 5 + sound: + path: /Audio/Ambience/Objects/engine_hum.ogg + - type: Clickable + - type: InteractionOutline + - type: Physics + bodyType: Static + - type: Fixtures + fixtures: + fix1: + shape: + !type:PhysShapeAabb + bounds: "-0.4,-0.5,0.4,0.3" + density: 190 + mask: + - MachineMask + layer: + - MachineLayer + - type: Transform + anchored: true + noRot: true + - type: Sprite + sprite: Structures/Power/power.rsi + state: generator + snapCardinals: true + - type: NodeContainer + examinable: true + nodes: + output: + !type:CableDeviceNode + nodeGroupID: HVPower + - type: PowerMonitoringDevice + group: Generator + loadNode: output + sprite: _Silver\supermattergen.rsi + state: supermatter + - type: PowerSupplier + supplyRate: 30000 + supplyRampRate: 500 + supplyRampTolerance: 500 + - type: Anchorable + - type: Pullable + - type: Damageable + damageContainer: StructuralInorganic + damageModifierSet: Metallic + - type: PacifismDangerousAttack + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 200 + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] + - trigger: + !type:DamageTrigger + damage: 100 + behaviors: + - !type:DoActsBehavior + acts: ["Destruction"] + - !type:PlaySoundBehavior + sound: + collection: MetalBreak + - !type:ExplodeBehavior + - type: Explosive + explosionType: Default + # Same as AME, but numbers still picked from a hat. + maxIntensity: 300 + intensitySlope: 2 + totalIntensity: 600 + - type: StaticPrice + price: 500 + - type: Electrified + onHandInteract: false + onInteractUsing: false + onBump: false + requirePower: true + highVoltageNode: output \ No newline at end of file diff --git a/Resources/Textures/_Silver/supermattergen.rsi/meta.json b/Resources/Textures/_Silver/supermattergen.rsi/meta.json new file mode 100644 index 00000000000..775fa1069f6 --- /dev/null +++ b/Resources/Textures/_Silver/supermattergen.rsi/meta.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "copyright": "Taken from https://github.com/tgstation/tgstation/blob/master/icons/obj/supermatter.dmi", + "license": "CC-BY-SA-3.0", + "size": { + "x": 32, + "y": 48 + }, + "states": [ + { + "name": "supermatter" + } + ] +} \ No newline at end of file diff --git a/Resources/Textures/_Silver/supermattergen.rsi/supermatter.png b/Resources/Textures/_Silver/supermattergen.rsi/supermatter.png new file mode 100644 index 0000000000000000000000000000000000000000..8447503b6e864144edbb1c8fda770e3569842525 GIT binary patch literal 934 zcmV;X16lluP)Px&U`a$lR9J=WmoaD?R~W~CDp`t9qaipaWF$Gp=k#h^B9~AHGB|^3GQ`M97IzDU zx?R-S;3*I?T1#o6P@2J8B)XkdTBn#c5E9cG^(x6!@hMVu5iV9O4i8DH4$3?0q>FX3 z-KqJ5(7jLJ_x=Cxd+&RC2e0vehX)`Yk2i%OolblH3!+zXoDdJQv$Ld9Db6$7Y!CeF zO!nAB2#$C>-V`EEI601ahXBZ$j{yh<14kmRRI0YIq9_2(bUN*E6yPR_Tl5m|S^&UT zOXn#)521g%jvh5>B^?d0C!r?U)(-$);$G?*|!T3Yk8E-=vqK$1$GlZx(4g>Q5_-zxxg)qt0ia-XN7qF+V@g;s;+c<{ctyKIZ1i$CiJwSmf(Z zz60RJu&?Q7wRm$k7)mGQ2s%rgKC=~dqs#8YipW>f{r1x#Hjuq(K9G%PHw1dI<&^pKt z_6pdp;L_)rTJ=m!PBo`5T|oWeXIqk9C>eF8FI_;>G;1P{?yq{f1hk6~ z5aiJ6l#t{Xx7xlS$OW;0<4cHiI$*sU2yy|@u7^P<`D+0D3-?TWd#vr)o&W#<07*qo IM6N<$g7z%BD*ylh literal 0 HcmV?d00001 From 020aaee5d569c803deefb9a5fc31ebaac939382a Mon Sep 17 00:00:00 2001 From: Mor-Dast Date: Wed, 11 Dec 2024 15:33:57 +0300 Subject: [PATCH 2/2] mics --- .../_Silver/ThermalVisionComponent.cs | 26 -------- Content.Server/_Silver/ThermalVisionSystem.cs | 65 ------------------- .../_Silver/supermattergen.rsi/meta.json | 2 +- 3 files changed, 1 insertion(+), 92 deletions(-) delete mode 100644 Content.Server/_Silver/ThermalVisionComponent.cs delete mode 100644 Content.Server/_Silver/ThermalVisionSystem.cs diff --git a/Content.Server/_Silver/ThermalVisionComponent.cs b/Content.Server/_Silver/ThermalVisionComponent.cs deleted file mode 100644 index dbd455556ca..00000000000 --- a/Content.Server/_Silver/ThermalVisionComponent.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Robust.Shared.GameObjects; -using Robust.Shared.ViewVariables; - -namespace Content.Server._Silver.ThermalVision -{ - [RegisterComponent] - public class ThermalVisionComponent : Component - { - public override string Name => "ThermalVision"; - - [ViewVariables(VVAccess.ReadWrite)] - public float VisionRadius { get; set; } = 10.0f; - - protected override void OnAdd() - { - base.OnAdd(); - EntitySystem.Get().Register(this); - } - - protected override void OnRemove() - { - base.OnRemove(); - EntitySystem.Get().Unregister(this); - } - } -} \ No newline at end of file diff --git a/Content.Server/_Silver/ThermalVisionSystem.cs b/Content.Server/_Silver/ThermalVisionSystem.cs deleted file mode 100644 index b6e486f0dd3..00000000000 --- a/Content.Server/_Silver/ThermalVisionSystem.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Robust.Shared.GameObjects; -using Robust.Shared.Map; -using Robust.Shared.Physics; -using Robust.Server.GameObjects; -using Robust.Shared.IoC; -using System.Collections.Generic; - -namespace Content.Server.Systems -{ - public class WallVisionSystem : EntitySystem - { - [Dependency] private readonly IMapManager _mapManager = default!; - - private readonly HashSet _wallVisionComponents = new(); - - public override void Initialize() - { - base.Initialize(); - SubscribeLocalEvent(OnPlayerAttached); - } - - public void Register(WallVisionComponent component) - { - _wallVisionComponents.Add(component); - } - - public void Unregister(WallVisionComponent component) - { - _wallVisionComponents.Remove(component); - } - - private void OnPlayerAttached(EntityUid uid, WallVisionComponent component, PlayerAttachSystemMessage args) - { - UpdateVision(component, args.PlayerSession.AttachedEntity); - } - - public override void Update(float frameTime) - { - base.Update(frameTime); - - foreach (var component in _wallVisionComponents) - { - if (component.Owner.TryGetComponent(out IMapGridComponent? grid) && - component.Owner.TryGetComponent(out TransformComponent? transform)) - { - UpdateVision(component, component.Owner); - } - } - } - - private void UpdateVision(WallVisionComponent component, IEntity owner) - { - var mapGrid = _mapManager.GetGrid(owner.Transform.GridID); - var worldPosition = owner.Transform.WorldPosition; - - foreach (var entity in mapGrid.GetEntitiesInRange(owner.Transform.Coordinates, component.VisionRadius)) - { - if (entity.HasComponent()) // Assuming MobComponent denotes a living entity - { - entity.Visible = true; - } - } - } - } -} \ No newline at end of file diff --git a/Resources/Textures/_Silver/supermattergen.rsi/meta.json b/Resources/Textures/_Silver/supermattergen.rsi/meta.json index 775fa1069f6..7d982d8b585 100644 --- a/Resources/Textures/_Silver/supermattergen.rsi/meta.json +++ b/Resources/Textures/_Silver/supermattergen.rsi/meta.json @@ -4,7 +4,7 @@ "license": "CC-BY-SA-3.0", "size": { "x": 32, - "y": 48 + "y": 32 }, "states": [ {