diff --git a/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs b/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs index f9185b965ec..54314b4ee2b 100644 --- a/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs +++ b/Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Robust.Shared.Audio; +using Robust.Shared.Serialization; namespace Content.Server.Corvax.Elzuosa { @@ -16,5 +11,15 @@ public sealed partial class ElzuosaColorComponent : Component [DataField("cycleRate")] public float CycleRate = 1f; + + [DataField("stannedByEMP")] + public bool StannedByEmp = false; } + + /*[Serializable, NetSerializable] + public enum ElzuosaState : byte + { + Normal, + Emagged + }*/ } diff --git a/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs b/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs index f45f4c4a71b..17d9a6f0498 100644 --- a/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs +++ b/Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs @@ -2,18 +2,121 @@ using Content.Shared.Preferences; using Robust.Server.GameObjects; using Content.Server.GameTicking; +using Content.Shared.Damage.Components; +using Content.Shared.Damage.Systems; +using Content.Shared.Emag.Systems; +using Content.Shared.IdentityManagement; +using Content.Shared.Light; +using Content.Shared.Light.Components; +using Content.Shared.Nutrition.Components; +using Content.Shared.Popups; + namespace Content.Server.Corvax.Elzuosa { public sealed class ElzuosaColorSystem : EntitySystem { [Dependency] private readonly PointLightSystem _pointLightSystem = default!; + [Dependency] private readonly SharedRgbLightControllerSystem _rgbSystem = default!; + [Dependency] private readonly SharedPopupSystem _popupSystem = default!; + [Dependency] private readonly StaminaSystem _stamina = default!; + + public bool SelfEmagged; + + public StaminaComponent? StaminaComponent; + public HungerComponent? HungerComponent; + private PointLightComponent? _pointLightComponent; + public override void Initialize() { base.Initialize(); - + SubscribeLocalEvent(OnEmagged); SubscribeLocalEvent(OnPlayerSpawn); } + public override void Update(float frameTime) + { + base.Update(frameTime); + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var elzuosaColorComponent)) + { + + var hunger = EntityManager.EnsureComponent(uid).CurrentHunger; + if (TryComp(uid, out _pointLightComponent)) + //Да простит меня боженька... + if(hunger <= 50) + _pointLightSystem.SetRadius(uid,(float)0.5); + else if(hunger <= 55) + _pointLightSystem.SetRadius(uid,(float)1.05); + else if(hunger <= 60) + _pointLightSystem.SetRadius(uid,(float)1.1); + else if(hunger <= 65) + _pointLightSystem.SetRadius(uid,(float)1.2); + else if(hunger <= 70) + _pointLightSystem.SetRadius(uid,(float)1.4); + else if(hunger <= 75) + _pointLightSystem.SetRadius(uid,(float)1.6); + else if(hunger <= 80) + _pointLightSystem.SetRadius(uid,(float)1.8); + else if(hunger <= 85) + _pointLightSystem.SetRadius(uid,(float)2); + else if(hunger > 90) + _pointLightSystem.SetRadius(uid,(float)2.3); + + if (elzuosaColorComponent.StannedByEmp) + { + _stamina.TakeStaminaDamage(uid,120,StaminaComponent); + elzuosaColorComponent.StannedByEmp = false; + } + } + } + + private void OnEmagged(EntityUid uid, ElzuosaColorComponent comp, ref GotEmaggedEvent args) + { + if ((args.UserUid == uid)) + SelfEmagged = true; + else + SelfEmagged = false; + + comp.Hacked = !comp.Hacked; + + + + if (SelfEmagged) + { + if (comp.Hacked) + { + _popupSystem.PopupEntity(Loc.GetString("elzuosa-selfemag-success"),uid); + var rgb = EnsureComp(uid); + _rgbSystem.SetCycleRate(uid, comp.CycleRate, rgb); + } + else + { + _popupSystem.PopupEntity(Loc.GetString("elzuosa-selfdeemag-success"),uid); + RemComp(uid); + } + } + else + { + if (comp.Hacked) + { + _popupSystem.PopupEntity(Loc.GetString("elzuosa-emag-success",("target", Identity.Entity(uid, EntityManager))),uid, + args.UserUid); + _popupSystem.PopupEntity(Loc.GetString("elzuosa-emagged-success",("user", Identity.Entity(args.UserUid, EntityManager))),args.UserUid, + uid); + var rgb = EnsureComp(uid); + _rgbSystem.SetCycleRate(uid, comp.CycleRate, rgb); + } + else + { + _popupSystem.PopupEntity(Loc.GetString("elzuosa-deemag-success",("target", Identity.Entity(uid, EntityManager))),uid, + args.UserUid); + _popupSystem.PopupEntity(Loc.GetString("elzuosa-deemagged-success",("user", Identity.Entity(args.UserUid, EntityManager))),args.UserUid, + uid); + RemComp(uid); + } + } + } + private void OnPlayerSpawn(EntityUid uid, ElzuosaColorComponent comp, PlayerSpawnCompleteEvent args) { if (!HasComp(uid)) @@ -31,7 +134,6 @@ public void SetEntityPointLightColor(EntityUid uid, HumanoidCharacterProfile? pr var color = profile.Appearance.SkinColor; _pointLightSystem.SetColor(uid,color); - } } } diff --git a/Content.Server/Emp/EmpSystem.cs b/Content.Server/Emp/EmpSystem.cs index 765121f97d9..4631123ba20 100644 --- a/Content.Server/Emp/EmpSystem.cs +++ b/Content.Server/Emp/EmpSystem.cs @@ -1,3 +1,4 @@ +using Content.Server.Corvax.Elzuosa; //Corvax-Frontier using Content.Server.Entry; using Content.Server.Explosion.EntitySystems; using Content.Server.Power.EntitySystems; @@ -51,6 +52,13 @@ public void EmpPulse(MapCoordinates coordinates, float range, float energyConsum if (HasComp(gridUid)) continue; + //Corvax-Frontier start + if (HasComp(uid)) + if (TryComp(uid, out ElzuosaColorComponent? elzuosaColorComponent)) + elzuosaColorComponent.StannedByEmp = true; + + //Corvax-Frontier end + TryEmpEffects(uid, energyConsumption, duration); } Spawn(EmpPulseEffectPrototype, coordinates); diff --git a/Resources/Locale/ru-RU/corvax/interaction/interaction-popup-component.ftl b/Resources/Locale/ru-RU/corvax/interaction/interaction-popup-component.ftl index b1575edcc40..c26eacaae98 100644 --- a/Resources/Locale/ru-RU/corvax/interaction/interaction-popup-component.ftl +++ b/Resources/Locale/ru-RU/corvax/interaction/interaction-popup-component.ftl @@ -4,4 +4,10 @@ pat-success-elzuosa = вы обнимаете { $target }, чувствуя, как по вам проходит высоковольтный ток. pat-success-elzuosa-others = { CAPITALIZE($user) } обнимает { $target }, наэлектризовываясь. -pat-success-elzuosa-target = { CAPITALIZE($user) } обнимает вас. \ No newline at end of file +pat-success-elzuosa-target = { CAPITALIZE($user) } обнимает вас. +elzuosa-selfemag-success = Вы успешно себя взломали! +elzuosa-selfdeemag-success = Вы успешно вернули свой цвет! +elzuosa-emag-success = Вы успешно взломали { $target }! +elzuosa-deemag-success = Вы успешно вернули цвет { $target }! +elzuosa-emagged-success = Вас взломал { CAPITALIZE($user) }! +elzuosa-deemagged-success = { CAPITALIZE($user) } вернул ваш цвет! \ No newline at end of file