From c5a488b3cb9604a54b72d97d38a93c67bf347b91 Mon Sep 17 00:00:00 2001 From: MartynDew Date: Sun, 31 May 2026 10:44:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D1=83=D0=BB=D1=8C=D1=82=20=D0=BA=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=20=D0=B8=20=D0=B5=D0=B3=D0=BE=20=D1=80=D1=83?= =?UTF-8?q?=D1=87=D0=BD=D1=8B=D0=B5=20=D0=B7=D0=B0=D0=BA=D0=BB=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20(#411)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * da * Revert "da" This reverts commit fb9b5ef577c290264fb24e8ab8a2cd3c5b7922b3. * additional method * meow * Update bloodcultist.yml --- .../BloodCult/BloodCultSystem.Abilities.cs | 124 +++++++++--------- .../_Wega/Roles/Antags/bloodcultist.yml | 34 ----- 2 files changed, 59 insertions(+), 99 deletions(-) diff --git a/Content.Server/_Wega/BloodCult/BloodCultSystem.Abilities.cs b/Content.Server/_Wega/BloodCult/BloodCultSystem.Abilities.cs index b6c54be9db..3d84760d12 100644 --- a/Content.Server/_Wega/BloodCult/BloodCultSystem.Abilities.cs +++ b/Content.Server/_Wega/BloodCult/BloodCultSystem.Abilities.cs @@ -37,6 +37,8 @@ using Content.Shared.Standing; using Content.Shared.StatusEffectNew; using Content.Shared.Stunnable; using Content.Shared.Timing; +using Content.Shared.Hands.Components; +using Content.Shared.Examine; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Containers; @@ -46,7 +48,6 @@ using Robust.Shared.Physics.Systems; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; -using Content.Shared.Examine; namespace Content.Server.Blood.Cult; @@ -186,28 +187,20 @@ public sealed partial class BloodCultSystem private void OnStun(EntityUid cultist, BloodCultistComponent component, BloodCultStunActionEvent args) { - var spellGear = new ProtoId("BloodCultSpellStunGear"); - - var dropEvent = new DropHandItemsEvent(); - RaiseLocalEvent(cultist, ref dropEvent); - List> gear = new() { spellGear }; - _loadout.Equip(cultist, gear, null); - - args.Handled = true; - EmpoweringCheck(args.Action, component); + if (TrySpawnSpellInHand(cultist, "BloodCultSpellStun")) + { + args.Handled = true; + EmpoweringCheck(args.Action, component); + } } private void OnTeleport(EntityUid cultist, BloodCultistComponent component, BloodCultTeleportActionEvent args) { - var spellGear = new ProtoId("BloodCultSpellTeleportGear"); - - var dropEvent = new DropHandItemsEvent(); - RaiseLocalEvent(cultist, ref dropEvent); - List> gear = new() { spellGear }; - _loadout.Equip(cultist, gear, null); - - args.Handled = true; - EmpoweringCheck(args.Action, component); + if (TrySpawnSpellInHand(cultist, "BloodCultSpellTeleport")) + { + args.Handled = true; + EmpoweringCheck(args.Action, component); + } } private void OnElectromagneticPulse(EntityUid cultist, BloodCultistComponent component, BloodCultElectromagneticPulseActionEvent args) @@ -248,41 +241,29 @@ public sealed partial class BloodCultSystem private void OnShadowShackles(EntityUid cultist, BloodCultistComponent component, BloodCultShadowShacklesActionEvent args) { - var spellGear = new ProtoId("BloodCultSpellShadowShacklesGear"); - - var dropEvent = new DropHandItemsEvent(); - RaiseLocalEvent(cultist, ref dropEvent); - List> gear = new() { spellGear }; - _loadout.Equip(cultist, gear, null); - - args.Handled = true; - EmpoweringCheck(args.Action, component); + if (TrySpawnSpellInHand(cultist, "BloodCultSpellShadowShackles")) + { + args.Handled = true; + EmpoweringCheck(args.Action, component); + } } private void OnTwistedConstruction(EntityUid cultist, BloodCultistComponent component, BloodCultTwistedConstructionActionEvent args) { - var spellGear = new ProtoId("BloodCultSpellTwistedConstructionGear"); - - var dropEvent = new DropHandItemsEvent(); - RaiseLocalEvent(cultist, ref dropEvent); - List> gear = new() { spellGear }; - _loadout.Equip(cultist, gear, null); - - args.Handled = true; - EmpoweringCheck(args.Action, component); + if (TrySpawnSpellInHand(cultist, "BloodCultSpellTwistedConstruction")) + { + args.Handled = true; + EmpoweringCheck(args.Action, component); + } } private void OnSummonEquipment(EntityUid cultist, BloodCultistComponent component, BloodCultSummonEquipmentActionEvent args) { - var spellGear = new ProtoId("BloodCultSpellSummonEquipmentGear"); - - var dropEvent = new DropHandItemsEvent(); - RaiseLocalEvent(cultist, ref dropEvent); - List> gear = new() { spellGear }; - _loadout.Equip(cultist, gear, null); - - args.Handled = true; - EmpoweringCheck(args.Action, component); + if (TrySpawnSpellInHand(cultist, "BloodCultSpellSummonEquipment")) + { + args.Handled = true; + EmpoweringCheck(args.Action, component); + } } private void OnSummonDagger(EntityUid cultist, BloodCultistComponent component, BloodCultSummonDaggerActionEvent args) @@ -398,15 +379,11 @@ public sealed partial class BloodCultSystem #region Blood Rites private void OnBloodRites(EntityUid cultist, BloodCultistComponent component, BloodCultBloodRitesActionEvent args) { - var spellGear = new ProtoId("BloodCultSpellBloodRitesGear"); - - var dropEvent = new DropHandItemsEvent(); - RaiseLocalEvent(cultist, ref dropEvent); - List> gear = new() { spellGear }; - _loadout.Equip(cultist, gear, null); - - args.Handled = true; - EmpoweringCheck(args.Action, component); + if (TrySpawnSpellInHand(cultist, "BloodCultSpellBloodRites")) + { + args.Handled = true; + EmpoweringCheck(args.Action, component); + } } private void OnExamine(EntityUid uid, BloodSpellComponent spell, ExaminedEvent args) @@ -603,16 +580,13 @@ public sealed partial class BloodCultSystem _popup.PopupEntity(Loc.GetString("blood-cult-bolt-barrage-failed"), cultist, cultist, PopupType.SmallCaution); return; } - - var boltBarrageGear = new ProtoId("BloodCultSpellBloodBarrageGear"); - var dropEvent = new DropHandItemsEvent(); - RaiseLocalEvent(cultist, ref dropEvent); - List> gear = new() { boltBarrageGear }; - _loadout.Equip(cultist, gear, null); - - component.BloodCount -= 200; - _action.RemoveAction(cultist, args.Action!); - args.Handled = true; + + if (TrySpawnSpellInHand(cultist, "BloodCultSpellBloodBarrage")) + { + component.BloodCount -= 200; + _action.RemoveAction(cultist, args.Action!); + args.Handled = true; + } } #endregion Blood Rites #endregion Abilities @@ -1055,5 +1029,25 @@ public sealed partial class BloodCultSystem _action.RemoveAction(spell); } } + + private bool TrySpawnSpellInHand(EntityUid uid, EntProtoId proto) + { + if (!TryComp(uid, out var hands)) + return false; + + var spell = Spawn(proto, Transform(uid).Coordinates); + var activeHand = _hands.GetActiveHand((uid, hands)); + + if (_hands.TryPickupAnyHand(uid, spell)) + return true; + + else if (activeHand != null && _hands.TryForcePickup((uid, hands), spell, activeHand)) + return true; + + else + QueueDel(spell); + return false; + + } #endregion } diff --git a/Resources/Prototypes/_Wega/Roles/Antags/bloodcultist.yml b/Resources/Prototypes/_Wega/Roles/Antags/bloodcultist.yml index 094e462f35..79713cba6b 100644 --- a/Resources/Prototypes/_Wega/Roles/Antags/bloodcultist.yml +++ b/Resources/Prototypes/_Wega/Roles/Antags/bloodcultist.yml @@ -69,37 +69,3 @@ inhand: - WeaponHellDagger -- type: startingGear - id: BloodCultSpellStunGear - inhand: - - BloodCultSpellStun - -- type: startingGear - id: BloodCultSpellTeleportGear - inhand: - - BloodCultSpellTeleport - -- type: startingGear - id: BloodCultSpellShadowShacklesGear - inhand: - - BloodCultSpellShadowShackles - -- type: startingGear - id: BloodCultSpellTwistedConstructionGear - inhand: - - BloodCultSpellTwistedConstruction - -- type: startingGear - id: BloodCultSpellSummonEquipmentGear - inhand: - - BloodCultSpellSummonEquipment - -- type: startingGear - id: BloodCultSpellBloodRitesGear - inhand: - - BloodCultSpellBloodRites - -- type: startingGear - id: BloodCultSpellBloodBarrageGear - inhand: - - BloodCultSpellBloodBarrage