From 7c8a5ae4c2d03f32fbd385bce38239b60358793a Mon Sep 17 00:00:00 2001 From: Vigers Ray Date: Mon, 2 Dec 2024 07:31:30 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D1=8D=D0=BD=D0=B5?= =?UTF-8?q?=D1=80=D0=B3=D0=BE=20=D0=BC=D0=B5=D1=87=D0=B5=D0=B9.=20=D0=A4?= =?UTF-8?q?=D0=B8=D0=BA=D1=81=20=D1=81=D0=BC=D0=B5=D0=BD=D1=8B=20=D1=86?= =?UTF-8?q?=D0=B2=D0=B5=D1=82=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B?= =?UTF-8?q?=20=D0=BA=D0=B0=D1=80=D0=B3=D0=BE=D0=B9=20=D0=B0=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=D0=B0.=20=D0=BA=D0=B0=D1=80=D1=82=D1=83=20=D0=B0?= =?UTF-8?q?=D0=B3=D0=B5=D0=BD=D1=82=D0=B0,=20=D1=8D=D1=81=D0=B2=D0=BE?= =?UTF-8?q?=D1=80=D0=B4=D1=8B,=20=D0=BF=D0=98=D0=98=20=D1=81=D0=B8=D0=BD?= =?UTF-8?q?=D0=B4=D0=B8=D0=BA=D0=B0=D1=82=D0=B0=20=D0=B8=20=D0=BE=D0=B4?= =?UTF-8?q?=D0=B5=D0=B6=D0=B4=D1=83=20=D1=85=D0=B0=D0=BC=D0=B5=D0=BB=D0=B5?= =?UTF-8?q?=D0=BE=D0=BD=D0=B0=20=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B5=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=BC=D0=BE=D0=B3=D1=83=D1=82=20=D0=B8=D1=81?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D1=81=D0=B8=D0=BD=D0=B4=D0=B8=D0=BA=D0=B0=D1=82?= =?UTF-8?q?=D1=8B.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Access/Systems/AgentIDCardSystem.cs | 16 ++++- .../Access/Systems/IdCardConsoleSystem.cs | 6 +- .../Access/Systems/PresetIdCardSystem.cs | 22 +----- .../Systems/ChameleonClothingSystem.cs | 12 +++- .../Ghost/Roles/ToggleableGhostRoleSystem.cs | 18 +++++ .../Access/Systems/SharedIdCardSystem.cs | 19 +++++ .../ItemToggleActiveSoundComponent.cs | 2 +- .../Item/ItemToggle/ItemToggleSystem.cs | 70 ++++++++++++++++++- Content.Shared/PAI/SharedPAISystem.cs | 6 +- .../UserInterface/ActivatableUISystem.cs | 42 +++++++++++ Content.Shared/Wieldable/WieldableSystem.cs | 18 +++++ .../_Sunrise/Biocode/BiocodeComponent.cs | 16 +++++ .../_Sunrise/Biocode/BiocodeSystem.cs | 22 ++++++ .../Prototypes/Catalog/uplink_catalog.yml | 8 --- .../Entities/Clothing/Back/specific.yml | 5 ++ .../Entities/Clothing/Ears/specific.yml | 5 ++ .../Entities/Clothing/Eyes/specific.yml | 5 ++ .../Entities/Clothing/Hands/specific.yml | 5 ++ .../Entities/Clothing/Head/specific.yml | 5 ++ .../Entities/Clothing/Masks/specific.yml | 5 ++ .../Entities/Clothing/Neck/specific.yml | 5 ++ .../Clothing/OuterClothing/specific.yml | 5 ++ .../Entities/Clothing/Shoes/specific.yml | 5 ++ .../Entities/Clothing/Uniforms/specific.yml | 5 ++ .../Prototypes/Entities/Objects/Fun/pai.yml | 3 + .../Objects/Misc/identification_cards.yml | 5 ++ .../Objects/Weapons/Melee/e_sword.yml | 26 +++---- .../Specific/Robotics/borg_modules.yml | 3 +- .../Objects/Weapons/Melee/biocode.yml | 25 ++++++- 29 files changed, 332 insertions(+), 57 deletions(-) create mode 100644 Content.Shared/_Sunrise/Biocode/BiocodeComponent.cs create mode 100644 Content.Shared/_Sunrise/Biocode/BiocodeSystem.cs diff --git a/Content.Server/Access/Systems/AgentIDCardSystem.cs b/Content.Server/Access/Systems/AgentIDCardSystem.cs index a38aefce93..272166320f 100644 --- a/Content.Server/Access/Systems/AgentIDCardSystem.cs +++ b/Content.Server/Access/Systems/AgentIDCardSystem.cs @@ -9,6 +9,8 @@ using Robust.Server.GameObjects; using Robust.Shared.Prototypes; using Content.Shared.Roles; using System.Diagnostics.CodeAnalysis; +using Content.Shared._Sunrise.Biocode; +using BiocodeComponent = Content.Shared._Sunrise.Biocode.BiocodeComponent; namespace Content.Server.Access.Systems { @@ -18,6 +20,7 @@ namespace Content.Server.Access.Systems [Dependency] private readonly IdCardSystem _cardSystem = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly BiocodeSystem _biocodeSystem = default!; public override void Initialize() { @@ -35,6 +38,14 @@ namespace Content.Server.Access.Systems if (args.Target == null || !args.CanReach || !TryComp(args.Target, out var targetAccess) || !HasComp(args.Target)) return; + // Sunrise-Start + if (TryComp(uid, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + if (!TryComp(uid, out var access) || !HasComp(uid)) return; @@ -98,7 +109,10 @@ namespace Content.Server.Access.Systems _cardSystem.TryChangeJobIcon(uid, jobIcon, idCard); if (TryFindJobProtoFromIcon(jobIcon, out var job)) - _cardSystem.TryChangeJobDepartment(uid, job, idCard); + { + _cardSystem.TryChangeJobColor(uid, _cardSystem.GetJobColor(_prototypeManager, job), job.RadioIsBold); + _cardSystem.TryChangeJobDepartment(uid, job, idCard); // Sunrise-Edit + } } private bool TryFindJobProtoFromIcon(JobIconPrototype jobIcon, [NotNullWhen(true)] out JobPrototype? job) diff --git a/Content.Server/Access/Systems/IdCardConsoleSystem.cs b/Content.Server/Access/Systems/IdCardConsoleSystem.cs index 124c32ffb1..172577db1f 100644 --- a/Content.Server/Access/Systems/IdCardConsoleSystem.cs +++ b/Content.Server/Access/Systems/IdCardConsoleSystem.cs @@ -134,11 +134,7 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem _idCard.TryChangeJobIcon(targetId, jobIcon, player: player); _idCard.TryChangeJobDepartment(targetId, job); // Sunrise-Start - _idCard.TryChangeJobColor( - targetId, - PresetIdCardSystem.GetJobColor(_prototype, job), - job.RadioIsBold - ); + _idCard.TryChangeJobColor(targetId,_idCard.GetJobColor(_prototype, job), job.RadioIsBold); // Sunrise-End } diff --git a/Content.Server/Access/Systems/PresetIdCardSystem.cs b/Content.Server/Access/Systems/PresetIdCardSystem.cs index 4ad5832d60..c9230f40b5 100644 --- a/Content.Server/Access/Systems/PresetIdCardSystem.cs +++ b/Content.Server/Access/Systems/PresetIdCardSystem.cs @@ -82,29 +82,9 @@ public sealed class PresetIdCardSystem : EntitySystem _cardSystem.TryChangeJobTitle(uid, job.LocalizedName); _cardSystem.TryChangeJobDepartment(uid, job); - _cardSystem.TryChangeJobColor(uid, GetJobColor(_prototypeManager, job), job.RadioIsBold); // Sunrise-End + _cardSystem.TryChangeJobColor(uid, _cardSystem.GetJobColor(_prototypeManager, job), job.RadioIsBold); // Sunrise-End if (_prototypeManager.TryIndex(job.Icon, out var jobIcon)) _cardSystem.TryChangeJobIcon(uid, jobIcon); } - - // Sunrise-Start - public static string GetJobColor(IPrototypeManager prototypeManager, IPrototype job) - { - var jobCode = job.ID; - - var departments = prototypeManager.EnumeratePrototypes().ToList(); - departments.Sort((a, b) => a.Sort.CompareTo(b.Sort)); - - foreach (var department in from department in departments - from jobId in department.Roles - where jobId == jobCode - select department) - { - return department.Color.ToHex(); - } - - return string.Empty; - } - // Sunrise-End } diff --git a/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs b/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs index feb3428884..2789c1dcd0 100644 --- a/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs +++ b/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs @@ -1,4 +1,5 @@ using Content.Server.IdentityManagement; +using Content.Shared._Sunrise.Biocode; using Content.Shared.Clothing.Components; using Content.Shared.Clothing.EntitySystems; using Content.Shared.IdentityManagement.Components; @@ -17,6 +18,7 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IdentitySystem _identity = default!; + [Dependency] private readonly BiocodeSystem _biocodeSystem = default!; public override void Initialize() { @@ -33,9 +35,17 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem private void OnVerb(EntityUid uid, ChameleonClothingComponent component, GetVerbsEvent args) { - if (!args.CanAccess || !args.CanInteract || component.User != args.User) + if (!args.CanAccess || !args.CanInteract) // || component.User != args.User // Sunrise-Edit: Не надо return; + // Sunrise-Start + if (TryComp(uid, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + args.Verbs.Add(new InteractionVerb() { Text = Loc.GetString("chameleon-component-verb-text"), diff --git a/Content.Server/Ghost/Roles/ToggleableGhostRoleSystem.cs b/Content.Server/Ghost/Roles/ToggleableGhostRoleSystem.cs index 1f46bacaa0..bac1b3c9aa 100644 --- a/Content.Server/Ghost/Roles/ToggleableGhostRoleSystem.cs +++ b/Content.Server/Ghost/Roles/ToggleableGhostRoleSystem.cs @@ -1,4 +1,5 @@ using Content.Server.Ghost.Roles.Components; +using Content.Shared._Sunrise.Biocode; using Content.Shared.Examine; using Content.Shared.Interaction.Events; using Content.Shared.Mind; @@ -16,6 +17,7 @@ public sealed class ToggleableGhostRoleSystem : EntitySystem [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedMindSystem _mind = default!; + [Dependency] private readonly BiocodeSystem _biocodeSystem = default!; /// public override void Initialize() @@ -32,6 +34,14 @@ public sealed class ToggleableGhostRoleSystem : EntitySystem if (args.Handled) return; + // Sunrise-Start + if (TryComp(uid, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + args.Handled = true; // check if a mind is present @@ -100,6 +110,14 @@ public sealed class ToggleableGhostRoleSystem : EntitySystem if (args.Hands == null || !args.CanAccess || !args.CanInteract) return; + // Sunrise-Start + if (TryComp(uid, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + if (TryComp(uid, out var mind) && mind.HasMind) { ActivationVerb verb = new() diff --git a/Content.Shared/Access/Systems/SharedIdCardSystem.cs b/Content.Shared/Access/Systems/SharedIdCardSystem.cs index e610aa07a4..cf54ce981e 100644 --- a/Content.Shared/Access/Systems/SharedIdCardSystem.cs +++ b/Content.Shared/Access/Systems/SharedIdCardSystem.cs @@ -1,4 +1,5 @@ using System.Globalization; +using System.Linq; using Content.Shared.Access.Components; using Content.Shared.Administration.Logs; using Content.Shared.Database; @@ -213,6 +214,24 @@ public abstract class SharedIdCardSystem : EntitySystem return true; } + + public string GetJobColor(IPrototypeManager prototypeManager, IPrototype job) + { + var jobCode = job.ID; + + var departments = prototypeManager.EnumeratePrototypes().ToList(); + departments.Sort((a, b) => a.Sort.CompareTo(b.Sort)); + + foreach (var department in from department in departments + from jobId in department.Roles + where jobId == jobCode + select department) + { + return department.Color.ToHex(); + } + + return string.Empty; + } // Sunrise-End /// diff --git a/Content.Shared/Item/ItemToggle/Components/ItemToggleActiveSoundComponent.cs b/Content.Shared/Item/ItemToggle/Components/ItemToggleActiveSoundComponent.cs index cdac49ae6d..8a9a33e57e 100644 --- a/Content.Shared/Item/ItemToggle/Components/ItemToggleActiveSoundComponent.cs +++ b/Content.Shared/Item/ItemToggle/Components/ItemToggleActiveSoundComponent.cs @@ -18,6 +18,6 @@ public sealed partial class ItemToggleActiveSoundComponent : Component /// /// Used when the item emits sound while active. /// - [DataField] + [DataField, AutoNetworkedField] public EntityUid? PlayingStream; } diff --git a/Content.Shared/Item/ItemToggle/ItemToggleSystem.cs b/Content.Shared/Item/ItemToggle/ItemToggleSystem.cs index f6752a67f6..ce5cc02bd1 100644 --- a/Content.Shared/Item/ItemToggle/ItemToggleSystem.cs +++ b/Content.Shared/Item/ItemToggle/ItemToggleSystem.cs @@ -1,3 +1,7 @@ +using Content.Shared._Sunrise.Biocode; +using Content.Shared.Hands; +using Content.Shared.Hands.Components; +using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Item.ItemToggle.Components; @@ -23,6 +27,8 @@ public sealed class ItemToggleSystem : EntitySystem [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; + [Dependency] private readonly SharedHandsSystem _handsSystem = default!; + [Dependency] private readonly BiocodeSystem _biocodeSystem = default!; private EntityQuery _query; @@ -43,6 +49,16 @@ public sealed class ItemToggleSystem : EntitySystem SubscribeLocalEvent(OnIsHotEvent); SubscribeLocalEvent(UpdateActiveSound); + + SubscribeLocalEvent(OnItemToggleHandUnequipped); + } + + private void OnItemToggleHandUnequipped(Entity ent, ref GotUnequippedHandEvent args) + { + if (!ent.Comp.Activated || ent.Owner != args.Unequipped) + return; + + Toggle((ent.Owner, ent.Comp), args.User, predicted: ent.Comp.Predictable); } private void OnStartup(Entity ent, ref ComponentStartup args) @@ -64,6 +80,22 @@ public sealed class ItemToggleSystem : EntitySystem if (args.Handled || !ent.Comp.OnUse) return; + // Sunrise-Start + if (TryComp(args.User, out var handsComp)) + { + if (!_handsSystem.TryGetActiveItem((args.User, handsComp), out var itemInHand)) + return; + if (itemInHand != ent.Owner) + return; + } + + if (TryComp(ent.Owner, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + args.Handled = true; Toggle((ent, ent.Comp), args.User, predicted: ent.Comp.Predictable); @@ -75,6 +107,21 @@ public sealed class ItemToggleSystem : EntitySystem return; var user = args.User; + // Sunrise-Start + if (TryComp(args.User, out var handsComp)) + { + if (!_handsSystem.TryGetActiveItem((args.User, handsComp), out var itemInHand)) + return; + if (itemInHand != ent.Owner) + return; + } + + if (TryComp(ent.Owner, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End args.Verbs.Add(new ActivationVerb() { @@ -91,6 +138,22 @@ public sealed class ItemToggleSystem : EntitySystem if (args.Handled || !ent.Comp.OnActivate) return; + // Sunrise-Start + if (TryComp(args.User, out var handsComp)) + { + if (!_handsSystem.TryGetActiveItem((args.User, handsComp), out var itemInHand)) + return; + if (itemInHand != ent.Owner) + return; + } + + if (TryComp(ent.Owner, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + args.Handled = true; Toggle((ent.Owner, ent.Comp), args.User, predicted: ent.Comp.Predictable); } @@ -273,6 +336,9 @@ public sealed class ItemToggleSystem : EntitySystem /// private void UpdateActiveSound(Entity ent, ref ItemToggledEvent args) { + if (_netManager.IsClient) + return; + var (uid, comp) = ent; if (!args.Activated) { @@ -283,9 +349,7 @@ public sealed class ItemToggleSystem : EntitySystem if (comp.ActiveSound != null && comp.PlayingStream == null) { var loop = comp.ActiveSound.Params.WithLoop(true); - var stream = args.Predicted - ? _audio.PlayPredicted(comp.ActiveSound, uid, args.User, loop) - : _audio.PlayPvs(comp.ActiveSound, uid, loop); + var stream = _audio.PlayPvs(comp.ActiveSound, uid, loop); if (stream?.Entity is {} entity) comp.PlayingStream = entity; } diff --git a/Content.Shared/PAI/SharedPAISystem.cs b/Content.Shared/PAI/SharedPAISystem.cs index d66365eb85..e0e6d52ffc 100644 --- a/Content.Shared/PAI/SharedPAISystem.cs +++ b/Content.Shared/PAI/SharedPAISystem.cs @@ -26,13 +26,15 @@ namespace Content.Shared.PAI private void OnMapInit(EntityUid uid, PAIComponent component, MapInitEvent args) { _actionsSystem.AddAction(uid, ref component.MidiAction, component.MidiActionId); - _actionsSystem.AddAction(uid, ref component.MapAction, component.MapActionId); + // Sunrise-Edit + //_actionsSystem.AddAction(uid, ref component.MapAction, component.MapActionId); } private void OnShutdown(EntityUid uid, PAIComponent component, ComponentShutdown args) { _actionsSystem.RemoveAction(uid, component.MidiAction); - _actionsSystem.RemoveAction(uid, component.MapAction); + // Sunrise-Edit + //_actionsSystem.RemoveAction(uid, component.MapAction); } } } diff --git a/Content.Shared/UserInterface/ActivatableUISystem.cs b/Content.Shared/UserInterface/ActivatableUISystem.cs index 7eb195c0b1..aa8a0f1834 100644 --- a/Content.Shared/UserInterface/ActivatableUISystem.cs +++ b/Content.Shared/UserInterface/ActivatableUISystem.cs @@ -1,3 +1,4 @@ +using Content.Shared._Sunrise.Biocode; using Content.Shared.ActionBlocker; using Content.Shared.Administration.Managers; using Content.Shared.Ghost; @@ -21,6 +22,7 @@ public sealed partial class ActivatableUISystem : EntitySystem [Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly SharedHandsSystem _hands = default!; [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; + [Dependency] private readonly BiocodeSystem _biocodeSystem = default!; public override void Initialize() { @@ -70,6 +72,14 @@ public sealed partial class ActivatableUISystem : EntitySystem if (component.VerbOnly || !ShouldAddVerb(uid, component, args)) return; + // Sunrise-Start + if (TryComp(uid, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + args.Verbs.Add(new ActivationVerb { Act = () => InteractUI(args.User, uid, component), @@ -84,6 +94,14 @@ public sealed partial class ActivatableUISystem : EntitySystem if (!component.VerbOnly || !ShouldAddVerb(uid, component, args)) return; + // Sunrise-Start + if (TryComp(uid, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + args.Verbs.Add(new Verb { Act = () => InteractUI(args.User, uid, component), @@ -130,6 +148,14 @@ public sealed partial class ActivatableUISystem : EntitySystem if (component.RequiredItems != null) return; + // Sunrise-Start + if (TryComp(uid, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + args.Handled = InteractUI(args.User, uid, component); } @@ -144,6 +170,14 @@ public sealed partial class ActivatableUISystem : EntitySystem if (component.RequiredItems != null) return; + // Sunrise-Start + if (TryComp(uid, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + args.Handled = InteractUI(args.User, uid, component); } @@ -158,6 +192,14 @@ public sealed partial class ActivatableUISystem : EntitySystem if (component.RequiredItems == null) return; + // Sunrise-Start + if (TryComp(uid, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + if (_whitelistSystem.IsWhitelistFail(component.RequiredItems, args.Used)) return; diff --git a/Content.Shared/Wieldable/WieldableSystem.cs b/Content.Shared/Wieldable/WieldableSystem.cs index 0a193576bf..63c4d200cf 100644 --- a/Content.Shared/Wieldable/WieldableSystem.cs +++ b/Content.Shared/Wieldable/WieldableSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using Content.Shared._Sunrise.Biocode; using Content.Shared.Examine; using Content.Shared.Hands; using Content.Shared.Hands.Components; @@ -35,6 +36,7 @@ public sealed class WieldableSystem : EntitySystem [Dependency] private readonly SharedGunSystem _gun = default!; [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly INetManager _netManager = default!; + [Dependency] private readonly BiocodeSystem _biocodeSystem = default!; public override void Initialize() { @@ -138,6 +140,14 @@ public sealed class WieldableSystem : EntitySystem if (args.Hands == null || !args.CanAccess || !args.CanInteract) return; + // Sunrise-Start + if (TryComp(uid, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + if (!_handsSystem.IsHolding(args.User, uid, out _, args.Hands)) return; @@ -161,6 +171,14 @@ public sealed class WieldableSystem : EntitySystem if (args.Handled) return; + // Sunrise-Start + if (TryComp(uid, out var biocodedComponent)) + { + if (!_biocodeSystem.CanUse(args.User, biocodedComponent.Factions)) + return; + } + // Sunrise-End + if (!component.Wielded) args.Handled = TryWield(uid, component, args.User); else if (component.UnwieldOnUse) diff --git a/Content.Shared/_Sunrise/Biocode/BiocodeComponent.cs b/Content.Shared/_Sunrise/Biocode/BiocodeComponent.cs new file mode 100644 index 0000000000..701a4867c6 --- /dev/null +++ b/Content.Shared/_Sunrise/Biocode/BiocodeComponent.cs @@ -0,0 +1,16 @@ +using Content.Shared.NPC.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set; + +namespace Content.Shared._Sunrise.Biocode; + +[RegisterComponent] +public sealed partial class BiocodeComponent : Component +{ + [ViewVariables(VVAccess.ReadWrite)] + [DataField("alertText")] + public string AlertText = ""; + + [ViewVariables(VVAccess.ReadWrite), + DataField("factions", customTypeSerializer:typeof(PrototypeIdHashSetSerializer))] + public HashSet Factions = new(); +} diff --git a/Content.Shared/_Sunrise/Biocode/BiocodeSystem.cs b/Content.Shared/_Sunrise/Biocode/BiocodeSystem.cs new file mode 100644 index 0000000000..c1458c6325 --- /dev/null +++ b/Content.Shared/_Sunrise/Biocode/BiocodeSystem.cs @@ -0,0 +1,22 @@ +using Content.Shared.NPC.Components; + +namespace Content.Shared._Sunrise.Biocode; + +public sealed class BiocodeSystem : EntitySystem +{ + + public bool CanUse(EntityUid user, HashSet factions) + { + var canUse = false; + if (!TryComp(user, out var npcFactionMemberComponent)) + return canUse; + + foreach (var faction in npcFactionMemberComponent.Factions) + { + if (factions.Contains(faction)) + canUse = true; + } + + return canUse; + } +} diff --git a/Resources/Prototypes/Catalog/uplink_catalog.yml b/Resources/Prototypes/Catalog/uplink_catalog.yml index 27352ac619..c7c654c7c9 100644 --- a/Resources/Prototypes/Catalog/uplink_catalog.yml +++ b/Resources/Prototypes/Catalog/uplink_catalog.yml @@ -81,14 +81,6 @@ Telecrystal: 8 categories: - UplinkWeaponry -#Sunrise-start - conditions: - - !type:StoreWhitelistCondition - blacklist: - tags: - - SyndieAgentUplink - - AssaultOpsUplink -#Sunrise-end - type: listing id: UplinkEnergyDagger diff --git a/Resources/Prototypes/Entities/Clothing/Back/specific.yml b/Resources/Prototypes/Entities/Clothing/Back/specific.yml index fcdecffc8f..3e81ea7120 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/specific.yml @@ -18,6 +18,11 @@ type: StorageBoundUserInterface enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End - type: entity parent: Clothing diff --git a/Resources/Prototypes/Entities/Clothing/Ears/specific.yml b/Resources/Prototypes/Entities/Clothing/Ears/specific.yml index 83612ac4b2..27e44e297f 100644 --- a/Resources/Prototypes/Entities/Clothing/Ears/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Ears/specific.yml @@ -18,3 +18,8 @@ interfaces: enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End diff --git a/Resources/Prototypes/Entities/Clothing/Eyes/specific.yml b/Resources/Prototypes/Entities/Clothing/Eyes/specific.yml index fa87ed398e..be48023109 100644 --- a/Resources/Prototypes/Entities/Clothing/Eyes/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Eyes/specific.yml @@ -18,4 +18,9 @@ interfaces: enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End diff --git a/Resources/Prototypes/Entities/Clothing/Hands/specific.yml b/Resources/Prototypes/Entities/Clothing/Hands/specific.yml index 6140bcd8ed..ba00701044 100644 --- a/Resources/Prototypes/Entities/Clothing/Hands/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Hands/specific.yml @@ -21,6 +21,11 @@ interfaces: enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End - type: entity parent: ClothingHandsChameleon diff --git a/Resources/Prototypes/Entities/Clothing/Head/specific.yml b/Resources/Prototypes/Entities/Clothing/Head/specific.yml index 636f922d85..96ddce90f0 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/specific.yml @@ -18,3 +18,8 @@ interfaces: enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End diff --git a/Resources/Prototypes/Entities/Clothing/Masks/specific.yml b/Resources/Prototypes/Entities/Clothing/Masks/specific.yml index d8da80611c..031d7c76a8 100644 --- a/Resources/Prototypes/Entities/Clothing/Masks/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Masks/specific.yml @@ -23,6 +23,11 @@ - type: HideLayerClothing slots: - Snout + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End - type: entity parent: ClothingMaskGasChameleon diff --git a/Resources/Prototypes/Entities/Clothing/Neck/specific.yml b/Resources/Prototypes/Entities/Clothing/Neck/specific.yml index b98cdd02e0..139797e483 100644 --- a/Resources/Prototypes/Entities/Clothing/Neck/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Neck/specific.yml @@ -18,3 +18,8 @@ interfaces: enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/specific.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/specific.yml index c3d9bb1224..2c201648ed 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/specific.yml @@ -18,3 +18,8 @@ interfaces: enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml index 87a0c06c4a..e11b3619e7 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml @@ -198,6 +198,11 @@ interfaces: enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End - type: entity parent: ClothingShoesChameleon diff --git a/Resources/Prototypes/Entities/Clothing/Uniforms/specific.yml b/Resources/Prototypes/Entities/Clothing/Uniforms/specific.yml index a2c903bac3..3d13799cae 100644 --- a/Resources/Prototypes/Entities/Clothing/Uniforms/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Uniforms/specific.yml @@ -40,3 +40,8 @@ interfaces: enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End diff --git a/Resources/Prototypes/Entities/Objects/Fun/pai.yml b/Resources/Prototypes/Entities/Objects/Fun/pai.yml index f3a735d2dc..353d5c53b9 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/pai.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/pai.yml @@ -127,6 +127,9 @@ worldTargetActions: - Emag - HandheldHealthAnalyzerUnpowered + - type: Biocode + factions: + - Syndicate # Sunrise-End - type: entity diff --git a/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml b/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml index fe5ec44f25..529f71fe90 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml @@ -606,6 +606,11 @@ type: AgentIDCardBoundUserInterface enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End - type: entity name: passenger ID card diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml index 11ef634721..fe1a1304df 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml @@ -39,15 +39,15 @@ variation: 0.125 activatedDamage: types: - Slash: 15 - Heat: 15 + Slash: 12 + Heat: 12 Structural: 20 - type: MeleeWeapon wideAnimationRotation: -135 attackRate: 1 damage: types: - Blunt: 4.5 + Blunt: 1 - type: Item size: Small - type: UseDelay @@ -188,8 +188,8 @@ variation: 0.250 activatedDamage: types: - Slash: 10 - Heat: 10 + Slash: 8 + Heat: 8 - type: ComponentToggler components: - type: Sharp @@ -244,7 +244,7 @@ state: e_dagger - type: SpawnItemsOnUse items: - - id: EnergyDagger + - id: EnergyDaggerBiocode # Sunrise-Edit sound: path: /Audio/Effects/unwrap.ogg @@ -297,9 +297,9 @@ variation: 0.250 activatedDamage: types: - Slash: 12 - Heat: 12 - Structural: 15 + Slash: 6 + Heat: 6 + Structural: 10 - type: ItemToggleActiveSound activeSound: path: /Audio/Weapons/ebladehum.ogg @@ -316,11 +316,11 @@ wieldSound: null # esword light sound instead - type: MeleeWeapon wideAnimationRotation: -135 - attackRate: 1.5 + attackRate: 1.75 angle: 100 damage: types: - Blunt: 4.5 + Blunt: 1 - type: Sprite sprite: Objects/Weapons/Melee/e_sword_double.rsi layers: @@ -334,8 +334,8 @@ size: Small sprite: Objects/Weapons/Melee/e_sword_double-inhands.rsi - type: Reflect - reflectProb: .75 - spread: 75 + reflectProb: .50 + spread: 100 - type: entity suffix: One-Handed, For Borgs diff --git a/Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml b/Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml index 5d2f219676..db41410346 100644 --- a/Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml +++ b/Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml @@ -206,6 +206,7 @@ items: - SyndicateJawsOfLife - PinpointerNuclear + - WeaponPistolEchis - type: entity id: BorgModuleSyndicateMedical @@ -233,7 +234,7 @@ - state: icon-syndicate - type: ItemBorgModule items: - - EnergySword + - EnergyDaggerLoud - LightMachineGunBorg - type: entity diff --git a/Resources/Prototypes/_Sunrise/Entities/Objects/Weapons/Melee/biocode.yml b/Resources/Prototypes/_Sunrise/Entities/Objects/Weapons/Melee/biocode.yml index 5afab7e785..1b3de22de3 100644 --- a/Resources/Prototypes/_Sunrise/Entities/Objects/Weapons/Melee/biocode.yml +++ b/Resources/Prototypes/_Sunrise/Entities/Objects/Weapons/Melee/biocode.yml @@ -10,6 +10,11 @@ - type: Construction graph: EnergySwordDoubleGraph node: DoubleEnergySwordNode + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End - type: entity parent: EnergySword @@ -25,4 +30,22 @@ - EnergySword - type: Construction graph: EnergySwordDoubleGraph - node: start \ No newline at end of file + node: start + # Sunrise-Start + - type: Biocode + factions: + - Syndicate + # Sunrise-End + +- type: entity + parent: EnergyDagger + id: EnergyDaggerBiocode + suffix: BIOCODE + components: + - type: FactionWeaponBlocker + factions: + - Syndicate + alertText: Данное оружие биокодировано. Вы не можете его использовать. + - type: Biocode + factions: + - Syndicate