From 6ea2f2baf8b9d4ead54882bdfa6520d3c403ea58 Mon Sep 17 00:00:00 2001 From: PuroSlavKing <103608145+PuroSlavKing@users.noreply.github.com> Date: Sat, 3 Aug 2024 15:53:19 +0300 Subject: [PATCH] [Tweak] Better Telescopic Baton (#544) * [Tweak] Better Telescopic Baton * self defence loadout * SDD4Inspector --- .../Item/Telebaton/TelebatonComponent.cs | 8 -- .../_White/Item/Telebaton/TelebatonSystem.cs | 56 ------------- .../Telebaton/TelescopicBatonComponent.cs | 6 ++ .../Item/Telebaton/TelescopicBatonSystem.cs | 58 +++++++++++++ .../ru-RU/_white/loadouts/loadoutGroups.ftl | 1 + .../Locale/ru-RU/_white/object/telebaton.ftl | 2 +- .../Fills/Backpacks/StarterGear/backpack.yml | 23 +---- .../Fills/Backpacks/StarterGear/duffelbag.yml | 20 +---- .../Fills/Backpacks/StarterGear/satchel.yml | 22 +---- .../Miscellaneous/SelfDefenceDevices.yml | 21 +++++ .../Prototypes/Loadouts/loadout_groups.yml | 9 ++ .../Prototypes/Loadouts/role_loadouts.yml | 8 ++ .../{telebaton.yml => telescopic_baton.yml} | 83 ++++++++++--------- 13 files changed, 151 insertions(+), 166 deletions(-) delete mode 100644 Content.Shared/_White/Item/Telebaton/TelebatonComponent.cs delete mode 100644 Content.Shared/_White/Item/Telebaton/TelebatonSystem.cs create mode 100644 Content.Shared/_White/Item/Telebaton/TelescopicBatonComponent.cs create mode 100644 Content.Shared/_White/Item/Telebaton/TelescopicBatonSystem.cs create mode 100644 Resources/Prototypes/Loadouts/Miscellaneous/SelfDefenceDevices.yml rename Resources/Prototypes/_White/Entities/Objects/Weapons/{telebaton.yml => telescopic_baton.yml} (88%) diff --git a/Content.Shared/_White/Item/Telebaton/TelebatonComponent.cs b/Content.Shared/_White/Item/Telebaton/TelebatonComponent.cs deleted file mode 100644 index 75051e4cfe..0000000000 --- a/Content.Shared/_White/Item/Telebaton/TelebatonComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Content.Shared._White.Item.Telebaton; - -[RegisterComponent] -public sealed partial class TelebatonComponent : Component -{ - [DataField, ViewVariables(VVAccess.ReadWrite)] - public TimeSpan KnockdownTime = TimeSpan.FromSeconds(1.5f); -} diff --git a/Content.Shared/_White/Item/Telebaton/TelebatonSystem.cs b/Content.Shared/_White/Item/Telebaton/TelebatonSystem.cs deleted file mode 100644 index f5b88e2bca..0000000000 --- a/Content.Shared/_White/Item/Telebaton/TelebatonSystem.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Content.Shared.Damage.Events; -using Content.Shared.Examine; -using Content.Shared.Item; -using Content.Shared.Item.ItemToggle; -using Content.Shared.Item.ItemToggle.Components; -using Content.Shared.Stunnable; - -namespace Content.Shared._White.Item.Telebaton; - -public sealed class TelebatonSystem : EntitySystem -{ - [Dependency] private readonly SharedItemSystem _item = default!; - [Dependency] private readonly SharedStunSystem _stun = default!; - [Dependency] private readonly SharedItemToggleSystem _itemToggle = default!; - - public override void Initialize() - { - base.Initialize(); - - SubscribeLocalEvent(OnExamined); - SubscribeLocalEvent(OnStaminaHitAttempt); - SubscribeLocalEvent(ToggleDone); - SubscribeLocalEvent(OnHit); - } - - private void OnHit(Entity ent, ref StaminaMeleeHitEvent args) - { - var time = ent.Comp.KnockdownTime; - if (time <= TimeSpan.Zero) - return; - - foreach (var (uid, _) in args.HitList) - { - _stun.TryKnockdown(uid, time, true); - } - } - - private void OnStaminaHitAttempt(Entity entity, ref StaminaDamageOnHitAttemptEvent args) - { - if (!_itemToggle.IsActivated(entity.Owner)) - args.Cancelled = true; - } - - private void OnExamined(Entity entity, ref ExaminedEvent args) - { - var onMsg = _itemToggle.IsActivated(entity.Owner) - ? Loc.GetString("comp-telebaton-examined-on") - : Loc.GetString("comp-telebaton-examined-off"); - args.PushMarkup(onMsg); - } - - private void ToggleDone(Entity entity, ref ItemToggledEvent args) - { - _item.SetHeldPrefix(entity.Owner, args.Activated ? "on" : "off"); - } -} diff --git a/Content.Shared/_White/Item/Telebaton/TelescopicBatonComponent.cs b/Content.Shared/_White/Item/Telebaton/TelescopicBatonComponent.cs new file mode 100644 index 0000000000..d61250c726 --- /dev/null +++ b/Content.Shared/_White/Item/Telebaton/TelescopicBatonComponent.cs @@ -0,0 +1,6 @@ +namespace Content.Shared._White.Item.TelescopicBaton; + +[RegisterComponent] +public sealed partial class TelescopicBatonComponent : Component +{ +} diff --git a/Content.Shared/_White/Item/Telebaton/TelescopicBatonSystem.cs b/Content.Shared/_White/Item/Telebaton/TelescopicBatonSystem.cs new file mode 100644 index 0000000000..33e4e366af --- /dev/null +++ b/Content.Shared/_White/Item/Telebaton/TelescopicBatonSystem.cs @@ -0,0 +1,58 @@ +using Content.Shared.Damage.Events; +using Content.Shared.Examine; +using Content.Shared.Item; +using Content.Shared.Standing.Systems; +using Content.Shared.Standing; +using Content.Shared.Item.ItemToggle; +using Content.Shared.Item.ItemToggle.Components; +using Content.Shared.Stunnable; + +namespace Content.Shared._White.Item.TelescopicBaton; + +public sealed class TelescopicBatonSystem : EntitySystem +{ + [Dependency] private readonly SharedItemSystem _item = default!; + [Dependency] private readonly SharedStunSystem _stun = default!; + [Dependency] private readonly SharedItemToggleSystem _itemToggle = default!; + [Dependency] private readonly SharedStandingStateSystem _standing = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnExamined); + SubscribeLocalEvent(OnStaminaHitAttempt); + SubscribeLocalEvent(ToggleDone); + SubscribeLocalEvent(OnHit); + } + + private void OnHit(Entity ent, ref StaminaMeleeHitEvent args) + { + foreach (var (uid, _) in args.HitList) + { + if (HasComp(uid)) + { + _standing.TryLieDown(uid, null, SharedStandingStateSystem.DropHeldItemsBehavior.NoDrop); + } + } + } + + private void OnStaminaHitAttempt(Entity entity, ref StaminaDamageOnHitAttemptEvent args) + { + if (!_itemToggle.IsActivated(entity.Owner)) + args.Cancelled = true; + } + + private void OnExamined(Entity entity, ref ExaminedEvent args) + { + var onMsg = _itemToggle.IsActivated(entity.Owner) + ? Loc.GetString("comp-telebaton-examined-on") + : Loc.GetString("comp-telebaton-examined-off"); + args.PushMarkup(onMsg); + } + + private void ToggleDone(Entity entity, ref ItemToggledEvent args) + { + _item.SetHeldPrefix(entity.Owner, args.Activated ? "on" : "off"); + } +} diff --git a/Resources/Locale/ru-RU/_white/loadouts/loadoutGroups.ftl b/Resources/Locale/ru-RU/_white/loadouts/loadoutGroups.ftl index 021fcb33b5..bcc12c58ad 100644 --- a/Resources/Locale/ru-RU/_white/loadouts/loadoutGroups.ftl +++ b/Resources/Locale/ru-RU/_white/loadouts/loadoutGroups.ftl @@ -14,3 +14,4 @@ loadout-group-job-trinkets = Рабочий инвентарь loadout-group-inhand = В руках loadout-group-trinkets = Побрякушки loadout-group-instruments = Муз. инструменты +loadout-group-self-defence-devices = Средства самообороны diff --git a/Resources/Locale/ru-RU/_white/object/telebaton.ftl b/Resources/Locale/ru-RU/_white/object/telebaton.ftl index f753a2c6ba..31327974e4 100644 --- a/Resources/Locale/ru-RU/_white/object/telebaton.ftl +++ b/Resources/Locale/ru-RU/_white/object/telebaton.ftl @@ -1,4 +1,4 @@ -ent-Telebaton = телескопическая дубинка +ent-TelescopicBaton = телескопическая дубинка .desc = Компактное, но надежное оружие личной обороны. В сложенном состоянии может быть скрыто. comp-telebaton-examined-on = Дубинка в боевом положении. diff --git a/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/backpack.yml b/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/backpack.yml index 4fdd5f9fd0..c53fff8212 100644 --- a/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/backpack.yml +++ b/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/backpack.yml @@ -65,10 +65,8 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton #- name: StationCharter - #- name: TelescopicBaton + - type: entity noSpawn: true parent: ClothingBackpackEngineering @@ -77,9 +75,6 @@ - type: StorageFill contents: - id: BoxSurvivalEngineering - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -89,9 +84,6 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -101,9 +93,6 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -113,9 +102,6 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -125,9 +111,6 @@ - type: StorageFill contents: - id: BoxSurvivalMedical - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -137,9 +120,6 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -149,7 +129,6 @@ - type: StorageFill contents: - id: BoxSurvivalSecurity - - id: Flash - type: entity noSpawn: true diff --git a/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/duffelbag.yml b/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/duffelbag.yml index 0b7bd825a2..9bc07949b0 100644 --- a/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/duffelbag.yml +++ b/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/duffelbag.yml @@ -74,10 +74,8 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton #- name: StationCharter - #- name: TelescopicBaton + - type: entity noSpawn: true parent: ClothingBackpackDuffelEngineering @@ -86,9 +84,6 @@ - type: StorageFill contents: - id: BoxSurvivalEngineering - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -98,9 +93,6 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -110,9 +102,6 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -122,9 +111,6 @@ - type: StorageFill contents: - id: BoxSurvivalMedical - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -134,9 +120,6 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -146,7 +129,6 @@ - type: StorageFill contents: - id: BoxSurvivalSecurity - - id: Flash - type: entity noSpawn: true diff --git a/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/satchel.yml b/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/satchel.yml index ecc79c5060..82640bc76b 100644 --- a/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/satchel.yml +++ b/Resources/Prototypes/Catalog/Fills/Backpacks/StarterGear/satchel.yml @@ -102,10 +102,8 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton #- name: StationCharter - #- name: TelescopicBaton + - type: entity noSpawn: true parent: ClothingBackpackSatchelEngineering @@ -114,9 +112,6 @@ - type: StorageFill contents: - id: BoxSurvivalEngineering - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -126,9 +121,6 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -138,9 +130,6 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -150,9 +139,6 @@ - type: StorageFill contents: - id: BoxSurvivalMedical - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -162,9 +148,6 @@ - type: StorageFill contents: - id: BoxSurvival - - id: Flash - - id: Telebaton - #- id: TelescopicBaton - type: entity noSpawn: true @@ -174,7 +157,6 @@ - type: StorageFill contents: - id: BoxSurvivalSecurity - - id: Flash - type: entity parent: ClothingBackpackSatchelInspector @@ -185,8 +167,6 @@ - type: StorageFill contents: - id: BoxSurvivalSecurity - - id: Flash - - id: Telebaton - type: entity noSpawn: true diff --git a/Resources/Prototypes/Loadouts/Miscellaneous/SelfDefenceDevices.yml b/Resources/Prototypes/Loadouts/Miscellaneous/SelfDefenceDevices.yml new file mode 100644 index 0000000000..c9d32e6092 --- /dev/null +++ b/Resources/Prototypes/Loadouts/Miscellaneous/SelfDefenceDevices.yml @@ -0,0 +1,21 @@ +#/////// +# White Dream +#/////// + +- type: itemLoadout + id: TelescopicBaton + equipment: TelescopicBaton +- type: startingGear + id: TelescopicBaton + storage: + back: + - TelescopicBaton + +- type: itemLoadout + id: Flash + equipment: Flash +- type: startingGear + id: Flash + storage: + back: + - Flash diff --git a/Resources/Prototypes/Loadouts/loadout_groups.yml b/Resources/Prototypes/Loadouts/loadout_groups.yml index d07690cf36..775e3ee4db 100644 --- a/Resources/Prototypes/Loadouts/loadout_groups.yml +++ b/Resources/Prototypes/Loadouts/loadout_groups.yml @@ -21,6 +21,15 @@ - NTFlag # WD # Command +- type: loadoutGroup # WD + id: SelfDefenceDevices + name: loadout-group-self-defence-devices + minLimit: 1 + maxLimit: 2 + loadouts: + - TelescopicBaton + - Flash + - type: loadoutGroup id: CaptainHead name: loadout-group-head diff --git a/Resources/Prototypes/Loadouts/role_loadouts.yml b/Resources/Prototypes/Loadouts/role_loadouts.yml index 1ada15680c..769000b8bc 100644 --- a/Resources/Prototypes/Loadouts/role_loadouts.yml +++ b/Resources/Prototypes/Loadouts/role_loadouts.yml @@ -13,6 +13,7 @@ - CaptainGloves # WD - CaptainShoes - CaptainPDA # WD + - SelfDefenceDevices # WD - Trinkets - type: roleLoadout @@ -29,6 +30,7 @@ - HoPOuterClothing - HoPShoes - HoPPDA # WD + - SelfDefenceDevices # WD - Trinkets # Civilian @@ -206,6 +208,7 @@ - CommonGloves # WD - QuartermasterShoes - QuartermasterPDA # WD + - SelfDefenceDevices # WD - CommonCargoJobTrinkets - Trinkets @@ -253,6 +256,7 @@ - CommonGloves # WD - ChiefEngineerShoes - ChiefEngineerPDA # WD + - SelfDefenceDevices # WD - Trinkets - type: roleLoadout @@ -320,6 +324,7 @@ - ResearchDirectorShoes - CommonScienceGloves - ResearchDirectorPDA + - SelfDefenceDevices # WD - Trinkets - type: roleLoadout @@ -379,6 +384,7 @@ - CommonSecurityBackpack - CommonSecurityShoes - HeadofSecurityPDA + - SelfDefenceDevices # WD - CommonSecurityJobTrinkets # WD - Trinkets @@ -476,6 +482,7 @@ - CommonMedicalGloves - ChiefMedicalOfficerShoes - ChiefMedicalOfficerPDA + - SelfDefenceDevices # WD - Trinkets - type: roleLoadout @@ -567,6 +574,7 @@ - InspectorShoes - InspectorPDA - BriefcaseInhand + - SelfDefenceDevices # WD - InspectorJobTrinkets - Trinkets diff --git a/Resources/Prototypes/_White/Entities/Objects/Weapons/telebaton.yml b/Resources/Prototypes/_White/Entities/Objects/Weapons/telescopic_baton.yml similarity index 88% rename from Resources/Prototypes/_White/Entities/Objects/Weapons/telebaton.yml rename to Resources/Prototypes/_White/Entities/Objects/Weapons/telescopic_baton.yml index c6ac4558f4..0e6697d599 100644 --- a/Resources/Prototypes/_White/Entities/Objects/Weapons/telebaton.yml +++ b/Resources/Prototypes/_White/Entities/Objects/Weapons/telescopic_baton.yml @@ -1,9 +1,19 @@ - type: entity - id: Telebaton - name: telescopic baton parent: BaseItem + id: TelescopicBaton + name: telescopic baton description: A compact yet robust personal defense weapon. Can be concealed when folded. components: + - type: TelescopicBaton + - type: Sprite + sprite: White/Objects/Weapons/telebaton.rsi + layers: + - state: telebaton_off + map: [ "enum.ToggleVisuals.Layer" ] + - type: ItemToggleSize + activatedSize: Large + activatedShape: + - 0, 0, 3, 0 - type: ItemToggle soundActivate: path: /Audio/Weapons/telescopicon.ogg @@ -13,42 +23,6 @@ path: /Audio/Weapons/telescopicoff.ogg params: volume: -5 - - type: ItemToggleSize - activatedSize: Large - activatedShape: - - 0, 0, 3, 0 - - type: DisarmMalus - malus: 0.225 - - type: Sprite - sprite: White/Objects/Weapons/telebaton.rsi - layers: - - state: telebaton_off - map: [ "enum.ToggleVisuals.Layer" ] - - type: ItemToggleMeleeWeapon - activatedDamage: - types: - Blunt: 12 - deactivatedSecret: true - - type: MeleeWeapon - canHeavyAttack: false - equipCooldown: 1 - attackRate: 0.25 - wideAnimationRotation: -135 - damage: - types: - Blunt: 0 - bluntStaminaDamageFactor: 0.0 # so blunt doesn't deal stamina damage at all - - type: StaminaDamageOnHit - damage: 55 - sound: /Audio/White/Weapons/woodhit.ogg - - type: UseDelay - - type: Item - heldPrefix: off - sprite: White/Objects/Weapons/telebaton.rsi - size: Small - storedRotation: 44 - shape: - - 0, 0, 1, 0 - type: Appearance - type: GenericVisualizer visuals: @@ -56,6 +30,37 @@ enum.ToggleVisuals.Layer: True: {state: telebaton_on} False: {state: telebaton_off} + - type: DisarmMalus + malus: 0.225 + - type: MeleeWeapon + canHeavyAttack: false + equipCooldown: 1 + attackRate: 1.2 + wideAnimationRotation: -135 + damage: + types: + Blunt: 0 + bluntStaminaDamageFactor: 0.0 # so blunt doesn't deal stamina damage at all + - type: ItemToggleMeleeWeapon + activatedDamage: + types: + Blunt: 2 + deactivatedSecret: true + - type: StaminaDamageOnHit + damage: 16 + sound: /Audio/White/Weapons/woodhit.ogg + - type: UseDelay + delay: 0.4 + - type: Item + heldPrefix: off + sprite: White/Objects/Weapons/telebaton.rsi + size: Small + storedRotation: 44 + shape: + - 0, 0, 1, 0 + - type: Clothing + quickEquip: false + slots: + - Belt - type: StaticPrice price: 150 - - type: Telebaton