diff --git a/Content.Server/Construction/ConstructionSystem.Interactions.cs b/Content.Server/Construction/ConstructionSystem.Interactions.cs index 78369f99b0..d90a5ca262 100644 --- a/Content.Server/Construction/ConstructionSystem.Interactions.cs +++ b/Content.Server/Construction/ConstructionSystem.Interactions.cs @@ -3,11 +3,13 @@ using Content.Server.Administration.Logs; using Content.Server.Construction.Components; using Content.Server.Temperature.Components; using Content.Server.Temperature.Systems; +using Content.Shared._White.Cult.Components; using Content.Shared.Construction; using Content.Shared.Construction.Components; using Content.Shared.Construction.EntitySystems; using Content.Shared.Construction.Steps; using Content.Shared.DoAfter; +using Content.Shared.Ghost; using Content.Shared.Interaction; using Content.Shared.Prying.Systems; using Content.Shared.Radio.EntitySystems; @@ -206,6 +208,10 @@ namespace Content.Server.Construction // Let HandleInteraction actually handle the event for this step. // We can only perform the rest of our logic if it returns true. var handle = HandleInteraction(uid, ev, step, validation, out user, construction); + + if (step.CultistOnly && !(HasComp(user) || HasComp(user))) // WD + return HandleResult.False; + if (handle is not HandleResult.True) return handle; diff --git a/Content.Shared/Construction/Steps/ConstructionGraphStep.cs b/Content.Shared/Construction/Steps/ConstructionGraphStep.cs index 82248fa105..f2b6a6767d 100644 --- a/Content.Shared/Construction/Steps/ConstructionGraphStep.cs +++ b/Content.Shared/Construction/Steps/ConstructionGraphStep.cs @@ -10,6 +10,9 @@ namespace Content.Shared.Construction.Steps [DataField("doAfter")] public float DoAfter { get; private set; } + [DataField] + public bool CultistOnly { get; private set; } // WD + public IReadOnlyList Completed => _completed; public abstract void DoExamine(ExaminedEvent examinedEvent); diff --git a/Content.Shared/Weapons/Melee/Events/AttemptMeleeEvent.cs b/Content.Shared/Weapons/Melee/Events/AttemptMeleeEvent.cs index 2800e3b34d..6285eaa3c9 100644 --- a/Content.Shared/Weapons/Melee/Events/AttemptMeleeEvent.cs +++ b/Content.Shared/Weapons/Melee/Events/AttemptMeleeEvent.cs @@ -4,4 +4,4 @@ namespace Content.Shared.Weapons.Melee.Events; /// Raised directed on a weapon when attempt a melee attack. /// [ByRefEvent] -public record struct AttemptMeleeEvent(bool Cancelled, string? Message); +public record struct AttemptMeleeEvent(bool Cancelled, string? Message, EntityUid? User = null); // WD EDIT diff --git a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs index 1a5e35b320..46ebda6a3d 100644 --- a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs +++ b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs @@ -400,7 +400,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem Dirty(weaponUid, weapon); // Do this AFTER attack so it doesn't spam every tick - var ev = new AttemptMeleeEvent(); + var ev = new AttemptMeleeEvent {User = user}; // WD EDIT RaiseLocalEvent(weaponUid, ref ev); if (ev.Cancelled) diff --git a/Content.Shared/_White/Cult/Components/CultItemComponent.cs b/Content.Shared/_White/Cult/Components/CultItemComponent.cs index 24f72cf6a7..a063901594 100644 --- a/Content.Shared/_White/Cult/Components/CultItemComponent.cs +++ b/Content.Shared/_White/Cult/Components/CultItemComponent.cs @@ -3,4 +3,6 @@ namespace Content.Shared._White.Cult.Components; [RegisterComponent] public sealed partial class CultItemComponent : Component { + [DataField] + public bool CanPickUp = true; } diff --git a/Content.Shared/_White/Cult/Systems/CultItemSystem.cs b/Content.Shared/_White/Cult/Systems/CultItemSystem.cs index c2f44f3713..a50c6651b5 100644 --- a/Content.Shared/_White/Cult/Systems/CultItemSystem.cs +++ b/Content.Shared/_White/Cult/Systems/CultItemSystem.cs @@ -2,6 +2,8 @@ using Content.Shared.Ghost; using Content.Shared.Item; using Content.Shared.Popups; using Content.Shared._White.Cult.Components; +using Content.Shared.Inventory.Events; +using Content.Shared.Weapons.Melee.Events; namespace Content.Shared._White.Cult.Systems; @@ -15,15 +17,40 @@ public sealed class CultItemSystem : EntitySystem base.Initialize(); SubscribeLocalEvent(OnHandPickUp); + SubscribeLocalEvent(OnEquipAttempt); + SubscribeLocalEvent(OnMeleeAttempt); + } + + private void OnEquipAttempt(EntityUid uid, CultItemComponent component, BeingEquippedAttemptEvent args) + { + if (CanUse(args.Equipee)) + return; + + args.Cancel(); + _popupSystem.PopupClient(Loc.GetString("cult-item-component-equip-fail"), uid, args.Equipee); + } + + private void OnMeleeAttempt(Entity ent, ref AttemptMeleeEvent args) + { + if (CanUse(args.User)) + return; + + args.Cancelled = true; + args.Message = Loc.GetString("cult-item-component-attack-fail"); } private void OnHandPickUp(EntityUid uid, CultItemComponent component, GettingPickedUpAttemptEvent args) { - if (HasComp(args.User) || HasComp(args.User)) + if (component.CanPickUp || CanUse(args.User)) return; args.Cancel(); _transform.AttachToGridOrMap(uid); - _popupSystem.PopupClient(Loc.GetString("cult-item-component-not-cultist", ("name", Name(uid))), uid, args.User); + _popupSystem.PopupClient(Loc.GetString("cult-item-component-pickup-fail", ("name", Name(uid))), uid, args.User); + } + + private bool CanUse(EntityUid? uid) + { + return HasComp(uid) || HasComp(uid); } } diff --git a/Resources/Locale/ru-RU/cult/cult-item.ftl b/Resources/Locale/ru-RU/cult/cult-item.ftl index f24f5e8dbd..21ee937641 100644 --- a/Resources/Locale/ru-RU/cult/cult-item.ftl +++ b/Resources/Locale/ru-RU/cult/cult-item.ftl @@ -1 +1,3 @@ -cult-item-component-not-cultist = Вы не можете подобрать {$name} +cult-item-component-pickup-fail = Вы не можете подобрать {$name} +cult-item-component-attack-fail = Оружие не позволяет вам атаковать +cult-item-component-equip-fail = Вы не можете это надеть diff --git a/Resources/Prototypes/Damage/modifier_sets.yml b/Resources/Prototypes/Damage/modifier_sets.yml index 911621056c..d0eaa82155 100644 --- a/Resources/Prototypes/Damage/modifier_sets.yml +++ b/Resources/Prototypes/Damage/modifier_sets.yml @@ -66,7 +66,7 @@ Piercing: 0.7 Shock: 2 Heat: 3 - + # Like metallic, but without flat reduction so it can be damaged with fists. - type: damageModifierSet id: FlimsyMetallic @@ -338,3 +338,14 @@ Blunt: 1.15 Slash: 1.15 Piercing: 1.15 + +- type: damageModifierSet + id: CultRobe + coefficients: + Blunt: 1.45 + Slash: 1.45 + Piercing: 1.45 + Shock: 1.45 + Cold: 1.45 + Heat: 1.45 + Laser: 1.45 diff --git a/Resources/Prototypes/_White/Construction/Cult/graphs.yml b/Resources/Prototypes/_White/Construction/Cult/graphs.yml index ada3b6fb45..73a6574d4e 100644 --- a/Resources/Prototypes/_White/Construction/Cult/graphs.yml +++ b/Resources/Prototypes/_White/Construction/Cult/graphs.yml @@ -25,6 +25,7 @@ - !type:EntityAnchored steps: - tool: Dagger + cultistOnly: true - to: wall completed: - !type:SnapToGrid @@ -45,6 +46,7 @@ amount: 1 steps: - tool: Dagger + cultistOnly: true - type: constructionGraph id: AirlockGlassCult diff --git a/Resources/Prototypes/_White/Entities/Cult/Items/forge_craft.yml b/Resources/Prototypes/_White/Entities/Cult/Items/forge_craft.yml index f699037893..da5ae47d31 100644 --- a/Resources/Prototypes/_White/Entities/Cult/Items/forge_craft.yml +++ b/Resources/Prototypes/_White/Entities/Cult/Items/forge_craft.yml @@ -33,6 +33,7 @@ - Energy - type: ReturnItemOnThrow - type: CultItem + canPickUp: false - type: ChangeThrowForce throwForce: 6.5