From 2b0aea4922ea2858724fb87e7da7772461fdb0e3 Mon Sep 17 00:00:00 2001 From: Vonsant Date: Wed, 7 Aug 2024 23:26:15 +0300 Subject: [PATCH 01/14] PacifiedZone --- .../PacifiedZoneGeneratorComponent.cs | 32 ++++++ .../PacifiedlZoneGeneratorSystem.cs | 94 ++++++++++++++++++ .../_NF/Entities/Markers/pacified_zone.yml | 77 ++++++++++++++ .../_NF/Markers/pacifiedzone.rsi/meta.json | 14 +++ .../pacifiedzone.rsi/pacified_zone.png | Bin 0 -> 840 bytes 5 files changed, 217 insertions(+) create mode 100644 Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs create mode 100644 Content.Server/_NF/PacifiedZone/PacifiedlZoneGeneratorSystem.cs create mode 100644 Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml create mode 100644 Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json create mode 100644 Resources/Textures/_NF/Markers/pacifiedzone.rsi/pacified_zone.png diff --git a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs new file mode 100644 index 00000000000..aa218514558 --- /dev/null +++ b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs @@ -0,0 +1,32 @@ +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; +using Content.Shared.Containers.ItemSlots; +using Robust.Server.GameObjects; +using Content.Shared.Roles; +using Content.Shared.Roles.Jobs; + +namespace Content.Server._NF.PacifiedZone +{ + [RegisterComponent] + public sealed partial class PacifiedZoneGeneratorComponent : Component + { + public List OldListEntities = new(); + public List IntermediateListEntities = new(); + + [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + public TimeSpan NextUpdate; + + /// + /// The interval at which this component updates. + /// + [DataField] + public TimeSpan UpdateInterval = TimeSpan.FromSeconds(1); + + [DataField("radius")] + public int Radius = 5; + + [DataField("rolesImmun")] + public List> RolesImmun = new(); + } +} \ No newline at end of file diff --git a/Content.Server/_NF/PacifiedZone/PacifiedlZoneGeneratorSystem.cs b/Content.Server/_NF/PacifiedZone/PacifiedlZoneGeneratorSystem.cs new file mode 100644 index 00000000000..863e61f2365 --- /dev/null +++ b/Content.Server/_NF/PacifiedZone/PacifiedlZoneGeneratorSystem.cs @@ -0,0 +1,94 @@ +using Robust.Server.GameObjects; +using Robust.Shared.Timing; +using Content.Shared.Humanoid; +using Content.Shared.CombatMode.Pacification; +using Content.Shared.Mind; +using Content.Shared.Roles; +using Content.Shared.Roles.Jobs; + + +namespace Content.Server._NF.PacifiedZone +{ + public sealed class PacifiedZoneGeneratorSystem : EntitySystem + { + [Dependency] private readonly UserInterfaceSystem _userInterface = default!; + [Dependency] private readonly EntityLookupSystem _lookup = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly IEntityManager _entMan = default!; + [Dependency] private readonly SharedMindSystem _mindSystem = default!; + [Dependency] private readonly SharedJobSystem _jobSystem = default!; + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnComponentInit); + } + + private void OnComponentInit(EntityUid uid, PacifiedZoneGeneratorComponent component, ComponentInit args) + { + foreach (var humanoid_uid in _lookup.GetEntitiesInRange(Transform(uid).Coordinates, component.Radius)) + { + if (TryComp(humanoid_uid, out var pacifComp)) + continue; + + if (!_mindSystem.TryGetMind(humanoid_uid, out var mindId, out var mind)) + continue; + + _jobSystem.MindTryGetJobId(mindId, out var jobId); + + if (jobId != null) + if (component.RolesImmun.Contains(jobId!.Value)) + continue; + + AddComp(humanoid_uid); + component.OldListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); + } + + component.NextUpdate = _gameTiming.CurTime + component.UpdateInterval; + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + + var gen_query = AllEntityQuery(); + while (gen_query.MoveNext(out var gen_uid, out var component)) + { + var query = _lookup.GetEntitiesInRange(Transform(gen_uid).Coordinates, component.Radius); + foreach (var humanoid_uid in query) + { + if (!_mindSystem.TryGetMind(humanoid_uid, out var mindId, out var mind)) + continue; + + _jobSystem.MindTryGetJobId(mindId, out var jobId); + + if (jobId != null) + if (component.RolesImmun.Contains(jobId!.Value)) + continue; + + if (component.OldListEntities.Contains(_entMan.GetNetEntity(humanoid_uid))) + { + component.IntermediateListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); + component.OldListEntities.Remove(_entMan.GetNetEntity(humanoid_uid)); + } + else + { + AddComp(humanoid_uid); + component.IntermediateListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); + } + } + + foreach (var humanoid_net_uid in component.OldListEntities) + { + RemComp(GetEntity(humanoid_net_uid)); + } + + component.OldListEntities.Clear(); + component.OldListEntities.AddRange(component.IntermediateListEntities); + component.IntermediateListEntities.Clear(); + + component.NextUpdate += component.UpdateInterval; + } + } + } +} \ No newline at end of file diff --git a/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml b/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml new file mode 100644 index 00000000000..2672b4cc1fa --- /dev/null +++ b/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml @@ -0,0 +1,77 @@ +- type: entity + parent: MarkerBase + id: PacifiedZone10 + name: Pacified zone + description: It's just a NanoTrasen miracle... + suffix: 10 + components: + - type: Sprite + sprite: _NF/Markers/pacifiedzone.rsi + state: pacified_zone + - type: PacifiedZoneGenerator + radius: 10 + rolesImmun: + - Bailiff + - Brigmedic + - Cadet + - Deputy + - DetectiveNF + - SeniorOfficer + - Sheriff + - SecurityGuard + - StationRepresentative + - StationTrafficController +- type: entity + parent: PacifiedZone10 + id: PacifiedZone20 + suffix: 20 + components: + - type: PacifiedZoneGenerator + radius: 20 + rolesImmun: + - Bailiff + - Brigmedic + - Cadet + - Deputy + - DetectiveNF + - SeniorOfficer + - Sheriff + - SecurityGuard + - StationRepresentative + - StationTrafficController +- type: entity + parent: PacifiedZone10 + id: PacifiedZone50 + suffix: 50 + components: + - type: PacifiedZoneGenerator + radius: 50 + rolesImmun: + - Bailiff + - Brigmedic + - Cadet + - Deputy + - DetectiveNF + - SeniorOfficer + - Sheriff + - SecurityGuard + - StationRepresentative + - StationTrafficController +- type: entity + parent: PacifiedZone10 + id: PacifiedZone100 + suffix: 100 + components: + - type: PacifiedZoneGenerator + radius: 100 + rolesImmun: + - Bailiff + - Brigmedic + - Cadet + - Deputy + - DetectiveNF + - SeniorOfficer + - Sheriff + - SecurityGuard + - StationRepresentative + - StationTrafficController \ No newline at end of file diff --git a/Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json b/Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json new file mode 100644 index 00000000000..5f5dac2752e --- /dev/null +++ b/Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Made by BeatusCrow(github/discord 1153000512325681183)", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "pacified_zone" + } + ] +} \ No newline at end of file diff --git a/Resources/Textures/_NF/Markers/pacifiedzone.rsi/pacified_zone.png b/Resources/Textures/_NF/Markers/pacifiedzone.rsi/pacified_zone.png new file mode 100644 index 0000000000000000000000000000000000000000..afbff623fb9b7a126814866d48d8ae5f3750505b GIT binary patch literal 840 zcmV-O1GoH%P)Px&0!c(cR9JgP@4=MYg@vZemj^nZPsZYRmz;)3#hfW0nKp_!BtKGr$ z)Fc2PUA&Zx*g62*H#_)z`d3=dyHWl=JvAxrmpGqj1ONb9?G84|*T}6d0s#M2*V&r7 z&ahFwMj;V1(FDNLly{@1qu|e0sX=Q$sjppbboL{u&TXpb^^qV{CBeZ#Mh4kf@fx)2If@XBE$?> zf-)&hV$>?}fm;FqB+F}(2sINLj(`9_^HrG08L=uv6{8a&4vb%c3LUvh#O4jrYZ0h{ zQKH$n9gP4}!Hoh#Wk5W4_U;|7j9&md`($|y2X0AA9wz<307WRmT=C(Hk6~m*C{}*h z=tm}Ckk4)`0z~Mdx94UxmLn1{O!R#P6cRC%-kG~Fm0XSf>||SNTm}+g&&~3UuMdDf zKi+au?{FpXy_*WJ)$ZWx&YUGvcm#CYDzTkfee*pO>DkFP*#4`#2KFv|BcCni1Fs4*|_aVo_C|XC)~U6k;&vhL_9DN>K_pi5wh7G)aws?k~OD= zL=5R-SH#O#UyM-$kkVeSKOmdk0TIEnEU6!m?gb*b@7Hj1bBk*ATyhKqy4=9JnD(Wm zWh^W_hiykNKmQE7yPsfL7Uz}(q*9yw)*_HI8)Dt9sj6AjkK}wG69E9W9l`$oH@+?% z0gD=dN)7;4x_HU&462YG#b#Bj=L9TkMT_Wn(+Sw--6(y0VGpz?q-|&n?d%^dHovnf SPuti40000 Date: Wed, 7 Aug 2024 18:54:30 -0400 Subject: [PATCH 02/14] PacifiedlZoneGeneratorSystem.cs->PacifiedZone... --- ...fiedlZoneGeneratorSystem.cs => PacifiedZoneGeneratorSystem.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Content.Server/_NF/PacifiedZone/{PacifiedlZoneGeneratorSystem.cs => PacifiedZoneGeneratorSystem.cs} (100%) diff --git a/Content.Server/_NF/PacifiedZone/PacifiedlZoneGeneratorSystem.cs b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs similarity index 100% rename from Content.Server/_NF/PacifiedZone/PacifiedlZoneGeneratorSystem.cs rename to Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs From 7a539f9602b2dba5d481b7243fc77903d4b640dc Mon Sep 17 00:00:00 2001 From: Whatstone Date: Wed, 7 Aug 2024 19:25:55 -0400 Subject: [PATCH 03/14] Keep track of naturally pacified entities --- .../PacifiedZone/PacifiedByZoneComponent.cs | 10 +++++ .../PacifiedZoneGeneratorComponent.cs | 12 ++---- .../PacifiedZoneGeneratorSystem.cs | 38 ++++++++++++------- 3 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 Content.Server/_NF/PacifiedZone/PacifiedByZoneComponent.cs diff --git a/Content.Server/_NF/PacifiedZone/PacifiedByZoneComponent.cs b/Content.Server/_NF/PacifiedZone/PacifiedByZoneComponent.cs new file mode 100644 index 00000000000..432344d4b9d --- /dev/null +++ b/Content.Server/_NF/PacifiedZone/PacifiedByZoneComponent.cs @@ -0,0 +1,10 @@ +namespace Content.Server._NF.PacifiedZone +{ + // Denotes an entity as being pacified by a zone. + // An entity with PacifiedComponent but not PacifiedByZoneComponent is naturally pacified + // (e.g. through Pax, or the Pious trait) + [RegisterComponent] + public sealed partial class PacifiedByZoneComponent : Component + { + } +} \ No newline at end of file diff --git a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs index aa218514558..742ab82f49f 100644 --- a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs +++ b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs @@ -1,18 +1,14 @@ using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; -using Content.Shared.Containers.ItemSlots; -using Robust.Server.GameObjects; using Content.Shared.Roles; -using Content.Shared.Roles.Jobs; namespace Content.Server._NF.PacifiedZone { [RegisterComponent] public sealed partial class PacifiedZoneGeneratorComponent : Component { + [ViewVariables] public List OldListEntities = new(); - public List IntermediateListEntities = new(); [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] public TimeSpan NextUpdate; @@ -23,10 +19,10 @@ public sealed partial class PacifiedZoneGeneratorComponent : Component [DataField] public TimeSpan UpdateInterval = TimeSpan.FromSeconds(1); - [DataField("radius")] + [DataField] public int Radius = 5; - [DataField("rolesImmun")] - public List> RolesImmun = new(); + [DataField] + public List> ImmuneRoles = new(); } } \ No newline at end of file diff --git a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs index 863e61f2365..a9c69beaa5a 100644 --- a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs +++ b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs @@ -3,7 +3,6 @@ using Content.Shared.Humanoid; using Content.Shared.CombatMode.Pacification; using Content.Shared.Mind; -using Content.Shared.Roles; using Content.Shared.Roles.Jobs; @@ -28,19 +27,20 @@ private void OnComponentInit(EntityUid uid, PacifiedZoneGeneratorComponent compo { foreach (var humanoid_uid in _lookup.GetEntitiesInRange(Transform(uid).Coordinates, component.Radius)) { - if (TryComp(humanoid_uid, out var pacifComp)) + if (HasComp(humanoid_uid)) continue; - if (!_mindSystem.TryGetMind(humanoid_uid, out var mindId, out var mind)) + if (!_mindSystem.TryGetMind(humanoid_uid, out var mindId, out var _)) continue; _jobSystem.MindTryGetJobId(mindId, out var jobId); if (jobId != null) - if (component.RolesImmun.Contains(jobId!.Value)) + if (component.ImmuneRoles.Contains(jobId!.Value)) continue; AddComp(humanoid_uid); + AddComp(humanoid_uid); component.OldListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); } @@ -54,6 +54,11 @@ public override void Update(float frameTime) var gen_query = AllEntityQuery(); while (gen_query.MoveNext(out var gen_uid, out var component)) { + List newListEntities = new List(); + // Not yet update time, skip this + if (_gameTiming.CurTime < component.NextUpdate) + continue; + var query = _lookup.GetEntitiesInRange(Transform(gen_uid).Coordinates, component.Radius); foreach (var humanoid_uid in query) { @@ -62,32 +67,37 @@ public override void Update(float frameTime) _jobSystem.MindTryGetJobId(mindId, out var jobId); - if (jobId != null) - if (component.RolesImmun.Contains(jobId!.Value)) - continue; + // Player matches an immune role, should not be pacified. + if (jobId != null && component.ImmuneRoles.Contains(jobId.Value)) + continue; + + // Player is permanently pacified, + if (HasComp(humanoid_uid) && !HasComp(humanoid_uid)) + continue; if (component.OldListEntities.Contains(_entMan.GetNetEntity(humanoid_uid))) { - component.IntermediateListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); + // Entity still in zone. + newListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); component.OldListEntities.Remove(_entMan.GetNetEntity(humanoid_uid)); } else { + // New entity in zone, needs the Pacified comp. AddComp(humanoid_uid); - component.IntermediateListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); + AddComp(humanoid_uid); + newListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); } } foreach (var humanoid_net_uid in component.OldListEntities) { RemComp(GetEntity(humanoid_net_uid)); + RemComp(GetEntity(humanoid_net_uid)); } - component.OldListEntities.Clear(); - component.OldListEntities.AddRange(component.IntermediateListEntities); - component.IntermediateListEntities.Clear(); - - component.NextUpdate += component.UpdateInterval; + component.OldListEntities = newListEntities; + component.NextUpdate = _gameTiming.CurTime + component.UpdateInterval; } } } From 17325baf63c8b44eaef41294b9d6ec02a701e476 Mon Sep 17 00:00:00 2001 From: Whatstone Date: Wed, 7 Aug 2024 19:28:13 -0400 Subject: [PATCH 04/14] Comment cleanup --- .../_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs index a9c69beaa5a..2ddd8e18526 100644 --- a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs +++ b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs @@ -35,9 +35,8 @@ private void OnComponentInit(EntityUid uid, PacifiedZoneGeneratorComponent compo _jobSystem.MindTryGetJobId(mindId, out var jobId); - if (jobId != null) - if (component.ImmuneRoles.Contains(jobId!.Value)) - continue; + if (jobId != null && component.ImmuneRoles.Contains(jobId.Value)) + continue; AddComp(humanoid_uid); AddComp(humanoid_uid); @@ -71,7 +70,7 @@ public override void Update(float frameTime) if (jobId != null && component.ImmuneRoles.Contains(jobId.Value)) continue; - // Player is permanently pacified, + // Player is naturally pacified, skip them. if (HasComp(humanoid_uid) && !HasComp(humanoid_uid)) continue; From 9afa062b505b42416fcce0054ee2cc4dd6e54bb6 Mon Sep 17 00:00:00 2001 From: Vonsant Date: Wed, 7 Aug 2024 23:26:15 +0300 Subject: [PATCH 05/14] PacifiedZone --- .../PacifiedZoneGeneratorComponent.cs | 32 ++++++ .../PacifiedlZoneGeneratorSystem.cs | 94 ++++++++++++++++++ .../_NF/Entities/Markers/pacified_zone.yml | 77 ++++++++++++++ .../_NF/Markers/pacifiedzone.rsi/meta.json | 14 +++ .../pacifiedzone.rsi/pacified_zone.png | Bin 0 -> 840 bytes 5 files changed, 217 insertions(+) create mode 100644 Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs create mode 100644 Content.Server/_NF/PacifiedZone/PacifiedlZoneGeneratorSystem.cs create mode 100644 Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml create mode 100644 Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json create mode 100644 Resources/Textures/_NF/Markers/pacifiedzone.rsi/pacified_zone.png diff --git a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs new file mode 100644 index 00000000000..aa218514558 --- /dev/null +++ b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs @@ -0,0 +1,32 @@ +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; +using Content.Shared.Containers.ItemSlots; +using Robust.Server.GameObjects; +using Content.Shared.Roles; +using Content.Shared.Roles.Jobs; + +namespace Content.Server._NF.PacifiedZone +{ + [RegisterComponent] + public sealed partial class PacifiedZoneGeneratorComponent : Component + { + public List OldListEntities = new(); + public List IntermediateListEntities = new(); + + [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + public TimeSpan NextUpdate; + + /// + /// The interval at which this component updates. + /// + [DataField] + public TimeSpan UpdateInterval = TimeSpan.FromSeconds(1); + + [DataField("radius")] + public int Radius = 5; + + [DataField("rolesImmun")] + public List> RolesImmun = new(); + } +} \ No newline at end of file diff --git a/Content.Server/_NF/PacifiedZone/PacifiedlZoneGeneratorSystem.cs b/Content.Server/_NF/PacifiedZone/PacifiedlZoneGeneratorSystem.cs new file mode 100644 index 00000000000..863e61f2365 --- /dev/null +++ b/Content.Server/_NF/PacifiedZone/PacifiedlZoneGeneratorSystem.cs @@ -0,0 +1,94 @@ +using Robust.Server.GameObjects; +using Robust.Shared.Timing; +using Content.Shared.Humanoid; +using Content.Shared.CombatMode.Pacification; +using Content.Shared.Mind; +using Content.Shared.Roles; +using Content.Shared.Roles.Jobs; + + +namespace Content.Server._NF.PacifiedZone +{ + public sealed class PacifiedZoneGeneratorSystem : EntitySystem + { + [Dependency] private readonly UserInterfaceSystem _userInterface = default!; + [Dependency] private readonly EntityLookupSystem _lookup = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly IEntityManager _entMan = default!; + [Dependency] private readonly SharedMindSystem _mindSystem = default!; + [Dependency] private readonly SharedJobSystem _jobSystem = default!; + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnComponentInit); + } + + private void OnComponentInit(EntityUid uid, PacifiedZoneGeneratorComponent component, ComponentInit args) + { + foreach (var humanoid_uid in _lookup.GetEntitiesInRange(Transform(uid).Coordinates, component.Radius)) + { + if (TryComp(humanoid_uid, out var pacifComp)) + continue; + + if (!_mindSystem.TryGetMind(humanoid_uid, out var mindId, out var mind)) + continue; + + _jobSystem.MindTryGetJobId(mindId, out var jobId); + + if (jobId != null) + if (component.RolesImmun.Contains(jobId!.Value)) + continue; + + AddComp(humanoid_uid); + component.OldListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); + } + + component.NextUpdate = _gameTiming.CurTime + component.UpdateInterval; + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + + var gen_query = AllEntityQuery(); + while (gen_query.MoveNext(out var gen_uid, out var component)) + { + var query = _lookup.GetEntitiesInRange(Transform(gen_uid).Coordinates, component.Radius); + foreach (var humanoid_uid in query) + { + if (!_mindSystem.TryGetMind(humanoid_uid, out var mindId, out var mind)) + continue; + + _jobSystem.MindTryGetJobId(mindId, out var jobId); + + if (jobId != null) + if (component.RolesImmun.Contains(jobId!.Value)) + continue; + + if (component.OldListEntities.Contains(_entMan.GetNetEntity(humanoid_uid))) + { + component.IntermediateListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); + component.OldListEntities.Remove(_entMan.GetNetEntity(humanoid_uid)); + } + else + { + AddComp(humanoid_uid); + component.IntermediateListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); + } + } + + foreach (var humanoid_net_uid in component.OldListEntities) + { + RemComp(GetEntity(humanoid_net_uid)); + } + + component.OldListEntities.Clear(); + component.OldListEntities.AddRange(component.IntermediateListEntities); + component.IntermediateListEntities.Clear(); + + component.NextUpdate += component.UpdateInterval; + } + } + } +} \ No newline at end of file diff --git a/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml b/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml new file mode 100644 index 00000000000..2672b4cc1fa --- /dev/null +++ b/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml @@ -0,0 +1,77 @@ +- type: entity + parent: MarkerBase + id: PacifiedZone10 + name: Pacified zone + description: It's just a NanoTrasen miracle... + suffix: 10 + components: + - type: Sprite + sprite: _NF/Markers/pacifiedzone.rsi + state: pacified_zone + - type: PacifiedZoneGenerator + radius: 10 + rolesImmun: + - Bailiff + - Brigmedic + - Cadet + - Deputy + - DetectiveNF + - SeniorOfficer + - Sheriff + - SecurityGuard + - StationRepresentative + - StationTrafficController +- type: entity + parent: PacifiedZone10 + id: PacifiedZone20 + suffix: 20 + components: + - type: PacifiedZoneGenerator + radius: 20 + rolesImmun: + - Bailiff + - Brigmedic + - Cadet + - Deputy + - DetectiveNF + - SeniorOfficer + - Sheriff + - SecurityGuard + - StationRepresentative + - StationTrafficController +- type: entity + parent: PacifiedZone10 + id: PacifiedZone50 + suffix: 50 + components: + - type: PacifiedZoneGenerator + radius: 50 + rolesImmun: + - Bailiff + - Brigmedic + - Cadet + - Deputy + - DetectiveNF + - SeniorOfficer + - Sheriff + - SecurityGuard + - StationRepresentative + - StationTrafficController +- type: entity + parent: PacifiedZone10 + id: PacifiedZone100 + suffix: 100 + components: + - type: PacifiedZoneGenerator + radius: 100 + rolesImmun: + - Bailiff + - Brigmedic + - Cadet + - Deputy + - DetectiveNF + - SeniorOfficer + - Sheriff + - SecurityGuard + - StationRepresentative + - StationTrafficController \ No newline at end of file diff --git a/Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json b/Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json new file mode 100644 index 00000000000..5f5dac2752e --- /dev/null +++ b/Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Made by BeatusCrow(github/discord 1153000512325681183)", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "pacified_zone" + } + ] +} \ No newline at end of file diff --git a/Resources/Textures/_NF/Markers/pacifiedzone.rsi/pacified_zone.png b/Resources/Textures/_NF/Markers/pacifiedzone.rsi/pacified_zone.png new file mode 100644 index 0000000000000000000000000000000000000000..afbff623fb9b7a126814866d48d8ae5f3750505b GIT binary patch literal 840 zcmV-O1GoH%P)Px&0!c(cR9JgP@4=MYg@vZemj^nZPsZYRmz;)3#hfW0nKp_!BtKGr$ z)Fc2PUA&Zx*g62*H#_)z`d3=dyHWl=JvAxrmpGqj1ONb9?G84|*T}6d0s#M2*V&r7 z&ahFwMj;V1(FDNLly{@1qu|e0sX=Q$sjppbboL{u&TXpb^^qV{CBeZ#Mh4kf@fx)2If@XBE$?> zf-)&hV$>?}fm;FqB+F}(2sINLj(`9_^HrG08L=uv6{8a&4vb%c3LUvh#O4jrYZ0h{ zQKH$n9gP4}!Hoh#Wk5W4_U;|7j9&md`($|y2X0AA9wz<307WRmT=C(Hk6~m*C{}*h z=tm}Ckk4)`0z~Mdx94UxmLn1{O!R#P6cRC%-kG~Fm0XSf>||SNTm}+g&&~3UuMdDf zKi+au?{FpXy_*WJ)$ZWx&YUGvcm#CYDzTkfee*pO>DkFP*#4`#2KFv|BcCni1Fs4*|_aVo_C|XC)~U6k;&vhL_9DN>K_pi5wh7G)aws?k~OD= zL=5R-SH#O#UyM-$kkVeSKOmdk0TIEnEU6!m?gb*b@7Hj1bBk*ATyhKqy4=9JnD(Wm zWh^W_hiykNKmQE7yPsfL7Uz}(q*9yw)*_HI8)Dt9sj6AjkK}wG69E9W9l`$oH@+?% z0gD=dN)7;4x_HU&462YG#b#Bj=L9TkMT_Wn(+Sw--6(y0VGpz?q-|&n?d%^dHovnf SPuti40000 Date: Thu, 8 Aug 2024 20:39:08 +0300 Subject: [PATCH 06/14] Update pacified_zone.yml --- .../_NF/Entities/Markers/pacified_zone.yml | 51 +++++-------------- 1 file changed, 13 insertions(+), 38 deletions(-) diff --git a/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml b/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml index 2672b4cc1fa..f3ce74bf22d 100644 --- a/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml +++ b/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml @@ -1,9 +1,9 @@ - type: entity parent: MarkerBase - id: PacifiedZone10 + id: BasePacifiedZone name: Pacified zone description: It's just a NanoTrasen miracle... - suffix: 10 + abstract: true components: - type: Sprite sprite: _NF/Markers/pacifiedzone.rsi @@ -21,57 +21,32 @@ - SecurityGuard - StationRepresentative - StationTrafficController + +- type: entity + parent: BasePacifiedZone + id: PacifiedZone10 + suffix: 10 + - type: entity - parent: PacifiedZone10 + parent: BasePacifiedZone id: PacifiedZone20 suffix: 20 components: - type: PacifiedZoneGenerator radius: 20 - rolesImmun: - - Bailiff - - Brigmedic - - Cadet - - Deputy - - DetectiveNF - - SeniorOfficer - - Sheriff - - SecurityGuard - - StationRepresentative - - StationTrafficController + - type: entity - parent: PacifiedZone10 + parent: BasePacifiedZone id: PacifiedZone50 suffix: 50 components: - type: PacifiedZoneGenerator radius: 50 - rolesImmun: - - Bailiff - - Brigmedic - - Cadet - - Deputy - - DetectiveNF - - SeniorOfficer - - Sheriff - - SecurityGuard - - StationRepresentative - - StationTrafficController + - type: entity - parent: PacifiedZone10 + parent: BasePacifiedZone id: PacifiedZone100 suffix: 100 components: - type: PacifiedZoneGenerator radius: 100 - rolesImmun: - - Bailiff - - Brigmedic - - Cadet - - Deputy - - DetectiveNF - - SeniorOfficer - - Sheriff - - SecurityGuard - - StationRepresentative - - StationTrafficController \ No newline at end of file From 90fe984dbd345be1f52cbdc576ab5b5cf1d23ee4 Mon Sep 17 00:00:00 2001 From: Dvir <39403717+dvir001@users.noreply.github.com> Date: Thu, 8 Aug 2024 20:39:24 +0300 Subject: [PATCH 07/14] Update pacified_zone.yml --- Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml b/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml index f3ce74bf22d..09942a807f5 100644 --- a/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml +++ b/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml @@ -1,7 +1,7 @@ - type: entity parent: MarkerBase id: BasePacifiedZone - name: Pacified zone + name: pacified zone description: It's just a NanoTrasen miracle... abstract: true components: From aed4cd0b68d3e81273bf0ac65513eeacb0b17859 Mon Sep 17 00:00:00 2001 From: Whatstone Date: Thu, 8 Aug 2024 19:34:04 -0400 Subject: [PATCH 08/14] PacifiedZone: handle only non-pacified entities --- .../_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs index 2ddd8e18526..a15ed7bddc8 100644 --- a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs +++ b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs @@ -70,10 +70,6 @@ public override void Update(float frameTime) if (jobId != null && component.ImmuneRoles.Contains(jobId.Value)) continue; - // Player is naturally pacified, skip them. - if (HasComp(humanoid_uid) && !HasComp(humanoid_uid)) - continue; - if (component.OldListEntities.Contains(_entMan.GetNetEntity(humanoid_uid))) { // Entity still in zone. @@ -82,6 +78,10 @@ public override void Update(float frameTime) } else { + // Player is pacified (either naturally or by another zone), skip them. + if (HasComp(humanoid_uid)) + continue; + // New entity in zone, needs the Pacified comp. AddComp(humanoid_uid); AddComp(humanoid_uid); @@ -89,12 +89,14 @@ public override void Update(float frameTime) } } + // Anything left in our old set has left the zone, remove their pacified status. foreach (var humanoid_net_uid in component.OldListEntities) { RemComp(GetEntity(humanoid_net_uid)); RemComp(GetEntity(humanoid_net_uid)); } + // Update state for next run. component.OldListEntities = newListEntities; component.NextUpdate = _gameTiming.CurTime + component.UpdateInterval; } From 7142b4a7cb7d266bbff15aba9ee440bc359e5883 Mon Sep 17 00:00:00 2001 From: Whatstone Date: Thu, 8 Aug 2024 19:41:03 -0400 Subject: [PATCH 09/14] NetEntity->EntityUid (running locally on server) --- .../PacifiedZoneGeneratorComponent.cs | 2 +- .../PacifiedZoneGeneratorSystem.cs | 32 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs index 742ab82f49f..b5e2bccc163 100644 --- a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs +++ b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs @@ -8,7 +8,7 @@ namespace Content.Server._NF.PacifiedZone public sealed partial class PacifiedZoneGeneratorComponent : Component { [ViewVariables] - public List OldListEntities = new(); + public List TrackedEntities = new(); [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] public TimeSpan NextUpdate; diff --git a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs index a15ed7bddc8..d7883af2082 100644 --- a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs +++ b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs @@ -10,10 +10,8 @@ namespace Content.Server._NF.PacifiedZone { public sealed class PacifiedZoneGeneratorSystem : EntitySystem { - [Dependency] private readonly UserInterfaceSystem _userInterface = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; - [Dependency] private readonly IEntityManager _entMan = default!; [Dependency] private readonly SharedMindSystem _mindSystem = default!; [Dependency] private readonly SharedJobSystem _jobSystem = default!; @@ -21,6 +19,7 @@ public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnComponentInit); + SubscribeLocalEvent(OnComponentShutdown); } private void OnComponentInit(EntityUid uid, PacifiedZoneGeneratorComponent component, ComponentInit args) @@ -40,12 +39,21 @@ private void OnComponentInit(EntityUid uid, PacifiedZoneGeneratorComponent compo AddComp(humanoid_uid); AddComp(humanoid_uid); - component.OldListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); + component.TrackedEntities.Add(humanoid_uid); } component.NextUpdate = _gameTiming.CurTime + component.UpdateInterval; } + private void OnComponentShutdown(EntityUid uid, PacifiedZoneGeneratorComponent component, ComponentShutdown args) + { + foreach (var entity in component.TrackedEntities) + { + RemComp(entity); + RemComp(entity); + } + } + public override void Update(float frameTime) { base.Update(frameTime); @@ -53,7 +61,7 @@ public override void Update(float frameTime) var gen_query = AllEntityQuery(); while (gen_query.MoveNext(out var gen_uid, out var component)) { - List newListEntities = new List(); + List newEntities = new List(); // Not yet update time, skip this if (_gameTiming.CurTime < component.NextUpdate) continue; @@ -70,11 +78,11 @@ public override void Update(float frameTime) if (jobId != null && component.ImmuneRoles.Contains(jobId.Value)) continue; - if (component.OldListEntities.Contains(_entMan.GetNetEntity(humanoid_uid))) + if (component.TrackedEntities.Contains(humanoid_uid)) { // Entity still in zone. - newListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); - component.OldListEntities.Remove(_entMan.GetNetEntity(humanoid_uid)); + newEntities.Add(humanoid_uid); + component.TrackedEntities.Remove(humanoid_uid); } else { @@ -85,19 +93,19 @@ public override void Update(float frameTime) // New entity in zone, needs the Pacified comp. AddComp(humanoid_uid); AddComp(humanoid_uid); - newListEntities.Add(_entMan.GetNetEntity(humanoid_uid)); + newEntities.Add(humanoid_uid); } } // Anything left in our old set has left the zone, remove their pacified status. - foreach (var humanoid_net_uid in component.OldListEntities) + foreach (var humanoid_net_uid in component.TrackedEntities) { - RemComp(GetEntity(humanoid_net_uid)); - RemComp(GetEntity(humanoid_net_uid)); + RemComp(humanoid_net_uid); + RemComp(humanoid_net_uid); } // Update state for next run. - component.OldListEntities = newListEntities; + component.TrackedEntities = newEntities; component.NextUpdate = _gameTiming.CurTime + component.UpdateInterval; } } From b05e82b8b069589ad2237aba08f96237fc140600 Mon Sep 17 00:00:00 2001 From: Whatstone Date: Thu, 8 Aug 2024 19:46:59 -0400 Subject: [PATCH 10/14] NextUpdate: not a DataField --- .../_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs index b5e2bccc163..bf26f399f95 100644 --- a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs +++ b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorComponent.cs @@ -1,5 +1,4 @@ using Robust.Shared.Prototypes; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; using Content.Shared.Roles; namespace Content.Server._NF.PacifiedZone @@ -10,7 +9,7 @@ public sealed partial class PacifiedZoneGeneratorComponent : Component [ViewVariables] public List TrackedEntities = new(); - [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [ViewVariables] public TimeSpan NextUpdate; /// From a96edefd29f133b5a0d7a96c2f18169f1f01b1fe Mon Sep 17 00:00:00 2001 From: Whatstone Date: Thu, 8 Aug 2024 21:07:18 -0400 Subject: [PATCH 11/14] PacifiedZone: override alert --- .../PacifiedZoneGeneratorSystem.cs | 61 +++++++++----- Resources/Locale/en-US/_NF/alerts/alerts.ftl | 2 + .../Prototypes/_NF/Alerts/pacified_zone.yml | 7 ++ .../_NF/Entities/Markers/pacified_zone.yml | 80 ++++--------------- 4 files changed, 63 insertions(+), 87 deletions(-) create mode 100644 Resources/Locale/en-US/_NF/alerts/alerts.ftl create mode 100644 Resources/Prototypes/_NF/Alerts/pacified_zone.yml diff --git a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs index d7883af2082..da6591a6237 100644 --- a/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs +++ b/Content.Server/_NF/PacifiedZone/PacifiedZoneGeneratorSystem.cs @@ -1,11 +1,10 @@ -using Robust.Server.GameObjects; using Robust.Shared.Timing; -using Content.Shared.Humanoid; +using Content.Shared.Alert; using Content.Shared.CombatMode.Pacification; +using Content.Shared.Humanoid; using Content.Shared.Mind; using Content.Shared.Roles.Jobs; - namespace Content.Server._NF.PacifiedZone { public sealed class PacifiedZoneGeneratorSystem : EntitySystem @@ -14,6 +13,9 @@ public sealed class PacifiedZoneGeneratorSystem : EntitySystem [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly SharedMindSystem _mindSystem = default!; [Dependency] private readonly SharedJobSystem _jobSystem = default!; + [Dependency] private readonly AlertsSystem _alerts = default!; + + private const string Alert = "PacifiedZone"; public override void Initialize() { @@ -24,12 +26,12 @@ public override void Initialize() private void OnComponentInit(EntityUid uid, PacifiedZoneGeneratorComponent component, ComponentInit args) { - foreach (var humanoid_uid in _lookup.GetEntitiesInRange(Transform(uid).Coordinates, component.Radius)) + foreach (var humanoidUid in _lookup.GetEntitiesInRange(Transform(uid).Coordinates, component.Radius)) { - if (HasComp(humanoid_uid)) + if (HasComp(humanoidUid)) continue; - if (!_mindSystem.TryGetMind(humanoid_uid, out var mindId, out var _)) + if (!_mindSystem.TryGetMind(humanoidUid, out var mindId, out var _)) continue; _jobSystem.MindTryGetJobId(mindId, out var jobId); @@ -37,9 +39,10 @@ private void OnComponentInit(EntityUid uid, PacifiedZoneGeneratorComponent compo if (jobId != null && component.ImmuneRoles.Contains(jobId.Value)) continue; - AddComp(humanoid_uid); - AddComp(humanoid_uid); - component.TrackedEntities.Add(humanoid_uid); + var pacifiedComponent = AddComp(humanoidUid); + EnableAlert(humanoidUid, pacifiedComponent); + AddComp(humanoidUid); + component.TrackedEntities.Add(humanoidUid); } component.NextUpdate = _gameTiming.CurTime + component.UpdateInterval; @@ -51,6 +54,7 @@ private void OnComponentShutdown(EntityUid uid, PacifiedZoneGeneratorComponent c { RemComp(entity); RemComp(entity); + DisableAlert(entity); } } @@ -58,18 +62,18 @@ public override void Update(float frameTime) { base.Update(frameTime); - var gen_query = AllEntityQuery(); - while (gen_query.MoveNext(out var gen_uid, out var component)) + var genQuery = AllEntityQuery(); + while (genQuery.MoveNext(out var genUid, out var component)) { List newEntities = new List(); // Not yet update time, skip this if (_gameTiming.CurTime < component.NextUpdate) continue; - var query = _lookup.GetEntitiesInRange(Transform(gen_uid).Coordinates, component.Radius); - foreach (var humanoid_uid in query) + var query = _lookup.GetEntitiesInRange(Transform(genUid).Coordinates, component.Radius); + foreach (var humanoidUid in query) { - if (!_mindSystem.TryGetMind(humanoid_uid, out var mindId, out var mind)) + if (!_mindSystem.TryGetMind(humanoidUid, out var mindId, out var mind)) continue; _jobSystem.MindTryGetJobId(mindId, out var jobId); @@ -78,22 +82,23 @@ public override void Update(float frameTime) if (jobId != null && component.ImmuneRoles.Contains(jobId.Value)) continue; - if (component.TrackedEntities.Contains(humanoid_uid)) + if (component.TrackedEntities.Contains(humanoidUid)) { // Entity still in zone. - newEntities.Add(humanoid_uid); - component.TrackedEntities.Remove(humanoid_uid); + newEntities.Add(humanoidUid); + component.TrackedEntities.Remove(humanoidUid); } else { // Player is pacified (either naturally or by another zone), skip them. - if (HasComp(humanoid_uid)) + if (HasComp(humanoidUid)) continue; // New entity in zone, needs the Pacified comp. - AddComp(humanoid_uid); - AddComp(humanoid_uid); - newEntities.Add(humanoid_uid); + var pacifiedComponent = AddComp(humanoidUid); + EnableAlert(humanoidUid, pacifiedComponent); + AddComp(humanoidUid); + newEntities.Add(humanoidUid); } } @@ -102,6 +107,7 @@ public override void Update(float frameTime) { RemComp(humanoid_net_uid); RemComp(humanoid_net_uid); + DisableAlert(humanoid_net_uid); } // Update state for next run. @@ -109,5 +115,18 @@ public override void Update(float frameTime) component.NextUpdate = _gameTiming.CurTime + component.UpdateInterval; } } + + // Overrides the default Pacified alert with one for the pacified zone. + private void EnableAlert(EntityUid entity, PacifiedComponent pacified) + { + _alerts.ClearAlert(entity, pacified.PacifiedAlert); + _alerts.ShowAlert(entity, Alert); + } + + // Hides our pacified zone alert. + private void DisableAlert(EntityUid entity) + { + _alerts.ClearAlert(entity, Alert); + } } } \ No newline at end of file diff --git a/Resources/Locale/en-US/_NF/alerts/alerts.ftl b/Resources/Locale/en-US/_NF/alerts/alerts.ftl new file mode 100644 index 00000000000..61fa886596b --- /dev/null +++ b/Resources/Locale/en-US/_NF/alerts/alerts.ftl @@ -0,0 +1,2 @@ +alerts-pacified-zone-name = [color=royalblue]Pacified Zone[/color] +alerts-pacified-zone-desc = You're in a pacified zone, you need to leave before harming living things. diff --git a/Resources/Prototypes/_NF/Alerts/pacified_zone.yml b/Resources/Prototypes/_NF/Alerts/pacified_zone.yml new file mode 100644 index 00000000000..8fc8a36ef90 --- /dev/null +++ b/Resources/Prototypes/_NF/Alerts/pacified_zone.yml @@ -0,0 +1,7 @@ +- type: alert + id: PacifiedZone + icons: + - sprite: _NF/Markers/pacifiedzone.rsi + state: pacified_zone + name: alerts-pacified-zone-name + description: alerts-pacified-zone-desc diff --git a/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml b/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml index f662c27657e..6b780f6caaf 100644 --- a/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml +++ b/Resources/Prototypes/_NF/Entities/Markers/pacified_zone.yml @@ -1,23 +1,18 @@ - type: entity - parent: MarkerBase -<<<<<<< HEAD - id: PacifiedZone10 - name: Pacified zone - description: It's just a NanoTrasen miracle... - suffix: 10 -======= + parent: MarkerBase id: BasePacifiedZone name: pacified zone - description: It's just a NanoTrasen miracle... abstract: true ->>>>>>> 90fe984dbd345be1f52cbdc576ab5b5cf1d23ee4 components: - type: Sprite sprite: _NF/Markers/pacifiedzone.rsi - state: pacified_zone + layers: + - sprite: Markers/cross.rsi + state: pink + - state: pacified_zone - type: PacifiedZoneGenerator radius: 10 - rolesImmun: + immuneRoles: - Bailiff - Brigmedic - Cadet @@ -28,83 +23,36 @@ - SecurityGuard - StationRepresentative - StationTrafficController -<<<<<<< HEAD -- type: entity - parent: PacifiedZone10 -======= - type: entity - parent: BasePacifiedZone + parent: BasePacifiedZone id: PacifiedZone10 + description: Players will not be able to attack living things within a 10 block radius of this point. suffix: 10 - type: entity - parent: BasePacifiedZone ->>>>>>> 90fe984dbd345be1f52cbdc576ab5b5cf1d23ee4 + parent: BasePacifiedZone id: PacifiedZone20 + description: Players will not be able to attack living things within a 20 block radius of this point. suffix: 20 components: - type: PacifiedZoneGenerator radius: 20 -<<<<<<< HEAD - rolesImmun: - - Bailiff - - Brigmedic - - Cadet - - Deputy - - DetectiveNF - - SeniorOfficer - - Sheriff - - SecurityGuard - - StationRepresentative - - StationTrafficController -- type: entity - parent: PacifiedZone10 -======= - type: entity - parent: BasePacifiedZone ->>>>>>> 90fe984dbd345be1f52cbdc576ab5b5cf1d23ee4 + parent: BasePacifiedZone id: PacifiedZone50 + description: Players will not be able to attack living things within a 50 block radius of this point. suffix: 50 components: - type: PacifiedZoneGenerator radius: 50 -<<<<<<< HEAD - rolesImmun: - - Bailiff - - Brigmedic - - Cadet - - Deputy - - DetectiveNF - - SeniorOfficer - - Sheriff - - SecurityGuard - - StationRepresentative - - StationTrafficController -- type: entity - parent: PacifiedZone10 -======= - type: entity - parent: BasePacifiedZone ->>>>>>> 90fe984dbd345be1f52cbdc576ab5b5cf1d23ee4 + parent: BasePacifiedZone id: PacifiedZone100 + description: Players will not be able to attack living things within a 100 block radius of this point. suffix: 100 components: - type: PacifiedZoneGenerator radius: 100 -<<<<<<< HEAD - rolesImmun: - - Bailiff - - Brigmedic - - Cadet - - Deputy - - DetectiveNF - - SeniorOfficer - - Sheriff - - SecurityGuard - - StationRepresentative - - StationTrafficController -======= ->>>>>>> 90fe984dbd345be1f52cbdc576ab5b5cf1d23ee4 From b49f849528edf323058e952a860a37112f3d5d23 Mon Sep 17 00:00:00 2001 From: Kill_Me_I_Noobs <118206719+Vonsant@users.noreply.github.com> Date: Fri, 9 Aug 2024 11:58:14 +0300 Subject: [PATCH 12/14] fix meta Clarification of the meta at the author's request. --- Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json b/Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json index 5f5dac2752e..d962ddc16be 100644 --- a/Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json +++ b/Resources/Textures/_NF/Markers/pacifiedzone.rsi/meta.json @@ -1,7 +1,7 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "Made by BeatusCrow(github/discord 1153000512325681183)", + "copyright": "Made by BeatusCrow(github/discord)", "size": { "x": 32, "y": 32 @@ -11,4 +11,4 @@ "name": "pacified_zone" } ] -} \ No newline at end of file +} From 5358dcd4d495977f3f8a71c9e7049db2d45df0eb Mon Sep 17 00:00:00 2001 From: Dvir Date: Fri, 9 Aug 2024 20:24:46 +0300 Subject: [PATCH 13/14] Whatstone fixup for hairballs --- .../Nyanotrasen/Abilities/Felinid/FelinidSystem.cs | 8 ++++++++ Resources/Locale/en-US/_NF/pacified/pacified.ftl | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 Resources/Locale/en-US/_NF/pacified/pacified.ftl diff --git a/Content.Server/Nyanotrasen/Abilities/Felinid/FelinidSystem.cs b/Content.Server/Nyanotrasen/Abilities/Felinid/FelinidSystem.cs index e066da5c2f3..28213f71350 100644 --- a/Content.Server/Nyanotrasen/Abilities/Felinid/FelinidSystem.cs +++ b/Content.Server/Nyanotrasen/Abilities/Felinid/FelinidSystem.cs @@ -21,6 +21,7 @@ using Robust.Shared.Prototypes; using Content.Shared.Nutrition.EntitySystems; using Content.Shared.Nyanotrasen.Abilities; +using Content.Shared.CombatMode.Pacification; // Frontier namespace Content.Server.Abilities.Felinid { @@ -47,6 +48,8 @@ public override void Initialize() SubscribeLocalEvent(OnUnequipped); SubscribeLocalEvent(OnHairballHit); SubscribeLocalEvent(OnHairballPickupAttempt); + + SubscribeLocalEvent(OnHairballAttemptPacifiedThrow); // Frontier - Block hairball abuse } private Queue RemQueue = new(); @@ -190,6 +193,11 @@ private void OnHairballPickupAttempt(EntityUid uid, HairballComponent component, args.Cancel(); } } + + private void OnHairballAttemptPacifiedThrow(Entity ent, ref AttemptPacifiedThrowEvent args) // Frontier - Block hairball abuse + { + args.Cancel("pacified-cannot-throw-hairball"); + } } } diff --git a/Resources/Locale/en-US/_NF/pacified/pacified.ftl b/Resources/Locale/en-US/_NF/pacified/pacified.ftl new file mode 100644 index 00000000000..7ca98d11afc --- /dev/null +++ b/Resources/Locale/en-US/_NF/pacified/pacified.ftl @@ -0,0 +1,4 @@ + +## Messages shown to Pacified players when they try to do violence: + +pacified-cannot-throw-hairball = I can't possibly throw { THE($projectile) }, what if somebody vomits? \ No newline at end of file From 046fc9adf1c508674d5f39a2bb4a4eeb0d66e902 Mon Sep 17 00:00:00 2001 From: Dvir Date: Fri, 9 Aug 2024 20:36:58 +0300 Subject: [PATCH 14/14] Added zones --- Resources/Maps/_NF/Outpost/frontier.yml | 72 ++++++++------------ Resources/Maps/_NF/Shuttles/Bus/publicts.yml | 14 ++++ 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Resources/Maps/_NF/Outpost/frontier.yml b/Resources/Maps/_NF/Outpost/frontier.yml index e3491ea2ade..a25ffeb1b80 100644 --- a/Resources/Maps/_NF/Outpost/frontier.yml +++ b/Resources/Maps/_NF/Outpost/frontier.yml @@ -1762,8 +1762,8 @@ entities: 2400: 7,25 2401: 0,21 2402: 0,21 - 2457: -37,12 - 2458: -38,12 + 2451: -37,12 + 2452: -38,12 - node: cleanable: True zIndex: 180 @@ -2253,7 +2253,7 @@ entities: 2351: 40,11 2352: 40,10 2353: 37,11 - 2456: -35,12 + 2450: -35,12 - node: cleanable: True zIndex: 180 @@ -2505,10 +2505,10 @@ entities: 2218: 31,18 2219: 32,17 2272: 42,16 - 2459: -33,12 - 2460: -34,12 - 2461: -32,12 - 2462: -31,12 + 2453: -33,12 + 2454: -34,12 + 2455: -32,12 + 2456: -31,12 - node: color: '#334E6DC8' id: FullTileOverlayGreyscale @@ -2975,45 +2975,45 @@ entities: color: '#FFFFFFFF' id: WarnCornerNE decals: - 2448: -39,16 + 2442: -39,16 - node: color: '#FFFFFFFF' id: WarnCornerNW decals: - 2450: -41,16 + 2444: -41,16 - node: color: '#FFFFFFFF' id: WarnCornerSE decals: - 2452: -39,14 + 2446: -39,14 - node: color: '#FFFFFFFF' id: WarnCornerSW decals: - 2454: -41,14 + 2448: -41,14 - node: color: '#EFB34196' id: WarnFull decals: - 2447: -32,6 + 2441: -32,6 - node: color: '#52B4E996' id: WarnFullGreyscale decals: - 2469: -36,6 - 2470: -35,6 + 2459: -36,6 + 2460: -35,6 - node: color: '#D4D4D496' id: WarnFullGreyscale decals: - 2471: -34,6 - 2472: -33,6 + 2461: -34,6 + 2462: -33,6 - node: color: '#DE3A3A96' id: WarnFullGreyscale decals: - 2467: -38,6 - 2468: -37,6 + 2457: -38,6 + 2458: -37,6 - node: color: '#FFFFFFFF' id: WarnLineE @@ -3076,7 +3076,7 @@ entities: 2359: 35,22 2360: 35,23 2403: -57,2 - 2453: -39,15 + 2447: -39,15 - node: color: '#FFFFFFFF' id: WarnLineN @@ -3129,7 +3129,7 @@ entities: 2238: 37,19 2239: 36,21 2240: 37,21 - 2455: -40,14 + 2449: -40,14 - node: cleanable: True color: '#FFFFFFFF' @@ -3198,7 +3198,7 @@ entities: 2357: 35,22 2358: 35,23 2404: -57,2 - 2451: -41,15 + 2445: -41,15 - node: color: '#FFFFFFFF' id: WarnLineW @@ -3253,7 +3253,7 @@ entities: 2242: 37,19 2243: 37,21 2244: 36,21 - 2449: -40,16 + 2443: -40,16 - node: cleanable: True color: '#FFFFFFFF' @@ -5054,9 +5054,6 @@ entities: parent: 2173 - type: DeviceLinkSink invokeCounter: 2 - links: - - 3745 - - 3746 - type: DeviceLinkSource linkedPorts: 3746: @@ -5071,9 +5068,6 @@ entities: parent: 2173 - type: DeviceLinkSink invokeCounter: 2 - links: - - 3745 - - 3746 - type: DeviceLinkSource linkedPorts: 3746: @@ -5088,9 +5082,6 @@ entities: parent: 2173 - type: DeviceLinkSink invokeCounter: 2 - links: - - 2982 - - 2976 - type: DeviceLinkSource linkedPorts: 2976: @@ -5105,9 +5096,6 @@ entities: parent: 2173 - type: DeviceLinkSink invokeCounter: 2 - links: - - 2976 - - 2982 - type: DeviceLinkSource linkedPorts: 2976: @@ -14674,9 +14662,6 @@ entities: rot: 1.5707963267948966 rad pos: 52.5,18.5 parent: 2173 - - type: DeviceLinkSink - links: - - 6145 - proto: CrateTrashCart entities: - uid: 1990 @@ -28057,6 +28042,13 @@ entities: - type: Transform pos: -35.5,6.5 parent: 2173 +- proto: PacifiedZone100 + entities: + - uid: 2054 + components: + - type: Transform + pos: -0.5,12.5 + parent: 2173 - proto: Paper entities: - uid: 2038 @@ -36898,9 +36890,6 @@ entities: rot: 3.141592653589793 rad pos: 4.5,24.5 parent: 2173 - - type: DeviceLinkSink - links: - - 2642 - type: DeviceLinkSource linkedPorts: 2642: @@ -36918,9 +36907,6 @@ entities: - type: Transform pos: 4.5,24.5 parent: 2173 - - type: DeviceLinkSink - links: - - 2643 - type: DeviceLinkSource linkedPorts: 2643: diff --git a/Resources/Maps/_NF/Shuttles/Bus/publicts.yml b/Resources/Maps/_NF/Shuttles/Bus/publicts.yml index e54f4a80488..f43aa385124 100644 --- a/Resources/Maps/_NF/Shuttles/Bus/publicts.yml +++ b/Resources/Maps/_NF/Shuttles/Bus/publicts.yml @@ -194,6 +194,13 @@ entities: rot: -1.5707963267948966 rad pos: -3.5,0.5 parent: 8756 +- proto: AntiAnomalyZone + entities: + - uid: 85 + components: + - type: Transform + pos: -0.5,-0.5 + parent: 8756 - proto: APCBasic entities: - uid: 8819 @@ -671,6 +678,13 @@ entities: parent: 8756 - type: Physics bodyType: Static +- proto: PacifiedZone10 + entities: + - uid: 84 + components: + - type: Transform + pos: -0.5,-2.5 + parent: 8756 - proto: PottedPlantRandom entities: - uid: 49