From 39c19b4eccd411d99ee5910d62a1a1650e9ce244 Mon Sep 17 00:00:00 2001 From: Sh1ntra Date: Wed, 26 Jun 2024 23:40:05 +0300 Subject: [PATCH 1/4] =?UTF-8?q?=D1=87=D0=B5=D1=82=D0=BE=20=D0=BD=D0=B0?= =?UTF-8?q?=D1=87=D0=B0=D0=BB=20=D0=BF=D1=83=D0=BA=D0=B0=D1=82=D1=8C=20?= =?UTF-8?q?=D0=B2=20=D1=81=D1=82=D0=BE=D1=80=D0=BE=D0=BD=D1=83=20=D1=8D?= =?UTF-8?q?=D0=BB=D1=8C=D0=B7=D1=83=D0=BE=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoDeleteItems/AutoDeleteSystem.cs | 6 +-- .../Corvax/Elzuosa/ElzuosaColorComponent.cs | 14 +++++ .../Corvax/Elzuosa/ElzuosaColorSystem.cs | 52 +++++++++++++++++++ .../Corvax/Entities/Mobs/Species/elzuosa.yml | 5 +- 4 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs create mode 100644 Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs diff --git a/Content.Server/Corvax/AutoDeleteItems/AutoDeleteSystem.cs b/Content.Server/Corvax/AutoDeleteItems/AutoDeleteSystem.cs index 3d80078d80a..fcc3c210c4b 100644 --- a/Content.Server/Corvax/AutoDeleteItems/AutoDeleteSystem.cs +++ b/Content.Server/Corvax/AutoDeleteItems/AutoDeleteSystem.cs @@ -30,7 +30,7 @@ public override void Update(float frameTime) { return; } - + if (autoDeleteComponent.NextTimeToCheck > _gameTiming.CurTime) return; @@ -47,12 +47,12 @@ public override void Update(float frameTime) { autoDeleteComponent.IsSSDNear = false; } - + if (iterator.Owner == uid) continue; var humanoids = new HashSet>(); - + _lookup.GetEntitiesInRange(xform.Coordinates, autoDeleteComponent.DistanceToCheck, humanoids); if (humanoids.Count > 0 && !autoDeleteComponent.IsSSDNear) diff --git a/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs b/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs new file mode 100644 index 00000000000..060718bc687 --- /dev/null +++ b/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Content.Server.Corvax.Elzuosa +{ + [RegisterComponent] + public sealed partial class ElzuosaColorComponent : Component + { + public Color SkinColor { get; set; } + } +} diff --git a/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs b/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs new file mode 100644 index 00000000000..79a456e0580 --- /dev/null +++ b/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs @@ -0,0 +1,52 @@ +using Content.Server.Humanoid; +using Content.Shared.Humanoid; +using Content.Shared.Interaction; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Content.Server.Corvax.Elzuosa +{ + public sealed class ElzuosaColorSystem : EntitySystem + { + [Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearance = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnMapInit); + SubscribeLocalEvent(OnInteractUsing); + } + + private void OnMapInit(EntityUid uid, ElzuosaColorComponent comp, MapInitEvent args) + { + if (!HasComp(uid)) + return; + + _humanoidAppearance.SetSkinColor(uid, comp.SkinColor, true, true); + } + + private void OnInteractUsing(EntityUid uid, ElzuosaColorComponent comp, InteractUsingEvent args) + { + if (args.Handled) + return; + + if (!TryComp(args.Used, out ToolComponent? tool) || !tool.Qualities.ContainsAny("Pulsing")) + return; + + args.Handled = true; + comp.Hacked = !comp.Hacked; + + if (comp.Hacked) + { + var rgb = EnsureComp(uid); + _rgbSystem.SetCycleRate(uid, comp.CycleRate, rgb); + } + else + RemComp(uid); + } + } +} diff --git a/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml b/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml index 778005284c0..40d95b0bb25 100644 --- a/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml +++ b/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml @@ -41,9 +41,8 @@ shockTime: 2 - type: PointLight enabled: true - radius: 2 - - type: RgbLightController - cycleRate: 0.01 + radius: 2.3 + - type: ElzuosaColor - type: InteractionPopup successChance: 1 interactSuccessString: pat-success-elzuosa From 0809e2cb59f7e7daa312d311ee42796a4b7f9816 Mon Sep 17 00:00:00 2001 From: Sh1ntra Date: Wed, 26 Jun 2024 23:55:11 +0300 Subject: [PATCH 2/4] =?UTF-8?q?=D1=85=D0=B7=20=D1=87=D0=BE=20=D1=82=D1=83?= =?UTF-8?q?=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml b/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml index fcc0674829c..8fa906dad37 100644 --- a/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml +++ b/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml @@ -42,6 +42,10 @@ - type: PointLight enabled: true radius: 2 + cycleRate: 0.01 + cycleRate: 0.01 + cycleRate: 0.01 + cycleRate: 0.01 - type: InteractionPopup successChance: 1 interactSuccessString: pat-success-elzuosa From ddc4ac82e38b00e5eec0d15630c5c6abddb10c09 Mon Sep 17 00:00:00 2001 From: Sh1ntra Date: Thu, 4 Jul 2024 02:48:05 +0300 Subject: [PATCH 3/4] =?UTF-8?q?=D1=8D=D0=BB=D1=8C=D0=B7=D1=83=D0=BE=D1=81?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Corvax/Elzuosa/ElzuosaColorComponent.cs | 5 +++ .../Corvax/Elzuosa/ElzuosaColorSystem.cs | 31 ++++++++++++++++--- .../Corvax/Entities/Mobs/Species/elzuosa.yml | 3 -- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs b/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs index 060718bc687..f76ec875f82 100644 --- a/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs +++ b/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs @@ -10,5 +10,10 @@ namespace Content.Server.Corvax.Elzuosa public sealed partial class ElzuosaColorComponent : Component { public Color SkinColor { get; set; } + + public bool Hacked { get; set; } = false; + + [DataField("cycleRate")] + public float CycleRate = 1f; } } diff --git a/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs b/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs index 79a456e0580..e0b30f322be 100644 --- a/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs +++ b/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs @@ -6,34 +6,57 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using Content.Server.Chat.Systems; +using Content.Shared.Light; +using Content.Shared.Light.Components; +using Content.Shared.Tools.Components; +using FastAccessors; +using Robust.Server.GameObjects; +using Robust.Shared.Network; namespace Content.Server.Corvax.Elzuosa { public sealed class ElzuosaColorSystem : EntitySystem { [Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearance = default!; - + [Dependency] private readonly SharedRgbLightControllerSystem _rgbSystem = default!; + [Dependency] private readonly SharedPointLightSystem _sharedPointLightSystem = default!; + [Dependency] private readonly INetManager _netManager = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnInteractUsing); + //SubscribeLocalEvent(OnInit); } private void OnMapInit(EntityUid uid, ElzuosaColorComponent comp, MapInitEvent args) { if (!HasComp(uid)) return; - - _humanoidAppearance.SetSkinColor(uid, comp.SkinColor, true, true); + if (TryComp(uid, out var humanoid)) + { + var color = humanoid.SkinColor; + _sharedPointLightSystem.SetColor(uid, color); + } } + /*private void OnInit(EntityUid uid, ElzuosaColorComponent comp, AfterAutoHandleStateEvent args) + { + if (!HasComp(uid)) + return; + if (TryComp(uid, out var humanoid)) + { + var color = humanoid.SkinColor; + _sharedPointLightSystem.SetColor(uid, color); + } + }*/ private void OnInteractUsing(EntityUid uid, ElzuosaColorComponent comp, InteractUsingEvent args) { if (args.Handled) return; - + if (!TryComp(args.Used, out ToolComponent? tool) || !tool.Qualities.ContainsAny("Pulsing")) return; diff --git a/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml b/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml index 8fa906dad37..fd2073b70ca 100644 --- a/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml +++ b/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml @@ -43,9 +43,6 @@ enabled: true radius: 2 cycleRate: 0.01 - cycleRate: 0.01 - cycleRate: 0.01 - cycleRate: 0.01 - type: InteractionPopup successChance: 1 interactSuccessString: pat-success-elzuosa From 25199c71fc9e12b987b7cfb94bef378bd4713940 Mon Sep 17 00:00:00 2001 From: Sh1ntra Date: Thu, 4 Jul 2024 04:56:41 +0300 Subject: [PATCH 4/4] =?UTF-8?q?=D0=A2=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20?= =?UTF-8?q?=D1=86=D0=B2=D0=B5=D1=82=20=D1=81=D0=B2=D0=B5=D1=82=D0=B0=20?= =?UTF-8?q?=D0=B2=D0=BE=D0=BA=D1=80=D1=83=D0=B3=20=D1=8D=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D1=83=D0=BE=D1=81=20=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D1=82?= =?UTF-8?q?=20=D0=BE=D1=82=20=D1=86=D0=B2=D0=B5=D1=82=D0=B0=20=D0=B8=D1=85?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=B6=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Corvax/Elzuosa/ElzuosaColorComponent.cs | 1 + .../Corvax/Elzuosa/ElzuosaColorSystem.cs | 64 ++++--------------- .../Corvax/Entities/Mobs/Species/elzuosa.yml | 1 + 3 files changed, 15 insertions(+), 51 deletions(-) diff --git a/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs b/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs index f76ec875f82..242a352e82a 100644 --- a/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs +++ b/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using Robust.Shared.Audio; namespace Content.Server.Corvax.Elzuosa { diff --git a/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs b/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs index e0b30f322be..632708e7915 100644 --- a/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs +++ b/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs @@ -1,75 +1,37 @@ -using Content.Server.Humanoid; using Content.Shared.Humanoid; -using Content.Shared.Interaction; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Content.Server.Chat.Systems; -using Content.Shared.Light; -using Content.Shared.Light.Components; -using Content.Shared.Tools.Components; -using FastAccessors; +using Content.Shared.Preferences; using Robust.Server.GameObjects; -using Robust.Shared.Network; - +using Content.Server.GameTicking; namespace Content.Server.Corvax.Elzuosa { public sealed class ElzuosaColorSystem : EntitySystem { - [Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearance = default!; - [Dependency] private readonly SharedRgbLightControllerSystem _rgbSystem = default!; - [Dependency] private readonly SharedPointLightSystem _sharedPointLightSystem = default!; - [Dependency] private readonly INetManager _netManager = default!; + [Dependency] private readonly PointLightSystem _pointLightSystem = default!; public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnMapInit); - SubscribeLocalEvent(OnInteractUsing); - //SubscribeLocalEvent(OnInit); + SubscribeLocalEvent(OnPlayerSpawn); } - private void OnMapInit(EntityUid uid, ElzuosaColorComponent comp, MapInitEvent args) + private void OnPlayerSpawn(EntityUid uid, ElzuosaColorComponent comp, PlayerSpawnCompleteEvent args) { if (!HasComp(uid)) return; - if (TryComp(uid, out var humanoid)) - { - var color = humanoid.SkinColor; - _sharedPointLightSystem.SetColor(uid, color); - } - } - /*private void OnInit(EntityUid uid, ElzuosaColorComponent comp, AfterAutoHandleStateEvent args) - { - if (!HasComp(uid)) + if (args == null) return; - if (TryComp(uid, out var humanoid)) - { - var color = humanoid.SkinColor; - _sharedPointLightSystem.SetColor(uid, color); - } - }*/ + var profile = args.Profile; + SetEntityPointLightColor(uid, profile); + } - private void OnInteractUsing(EntityUid uid, ElzuosaColorComponent comp, InteractUsingEvent args) + public void SetEntityPointLightColor(EntityUid uid, HumanoidCharacterProfile? profile) { - if (args.Handled) - return; - - if (!TryComp(args.Used, out ToolComponent? tool) || !tool.Qualities.ContainsAny("Pulsing")) + if (profile == null) return; - args.Handled = true; - comp.Hacked = !comp.Hacked; + var color = profile.Appearance.SkinColor; + _pointLightSystem.SetColor(uid,color); - if (comp.Hacked) - { - var rgb = EnsureComp(uid); - _rgbSystem.SetCycleRate(uid, comp.CycleRate, rgb); - } - else - RemComp(uid); } } } diff --git a/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml b/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml index fd2073b70ca..94b628deaa1 100644 --- a/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml +++ b/Resources/Prototypes/Corvax/Entities/Mobs/Species/elzuosa.yml @@ -4,6 +4,7 @@ name: Urist McElzuosa abstract: true components: + - type: ElzuosaColor - type: Hunger # Corvax-Frontier starvationDamage: types: