[Tweak] Better Telescopic Baton (#544)

* [Tweak] Better Telescopic Baton

* self defence loadout

* SDD4Inspector
This commit is contained in:
PuroSlavKing
2024-08-03 15:53:19 +03:00
committed by GitHub
parent dad51d36a0
commit 6ea2f2baf8
13 changed files with 151 additions and 166 deletions

View File

@@ -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);
}

View File

@@ -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<TelebatonComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<TelebatonComponent, StaminaDamageOnHitAttemptEvent>(OnStaminaHitAttempt);
SubscribeLocalEvent<TelebatonComponent, ItemToggledEvent>(ToggleDone);
SubscribeLocalEvent<TelebatonComponent, StaminaMeleeHitEvent>(OnHit);
}
private void OnHit(Entity<TelebatonComponent> 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<TelebatonComponent> entity, ref StaminaDamageOnHitAttemptEvent args)
{
if (!_itemToggle.IsActivated(entity.Owner))
args.Cancelled = true;
}
private void OnExamined(Entity<TelebatonComponent> 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<TelebatonComponent> entity, ref ItemToggledEvent args)
{
_item.SetHeldPrefix(entity.Owner, args.Activated ? "on" : "off");
}
}

View File

@@ -0,0 +1,6 @@
namespace Content.Shared._White.Item.TelescopicBaton;
[RegisterComponent]
public sealed partial class TelescopicBatonComponent : Component
{
}

View File

@@ -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<TelescopicBatonComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<TelescopicBatonComponent, StaminaDamageOnHitAttemptEvent>(OnStaminaHitAttempt);
SubscribeLocalEvent<TelescopicBatonComponent, ItemToggledEvent>(ToggleDone);
SubscribeLocalEvent<TelescopicBatonComponent, StaminaMeleeHitEvent>(OnHit);
}
private void OnHit(Entity<TelescopicBatonComponent> ent, ref StaminaMeleeHitEvent args)
{
foreach (var (uid, _) in args.HitList)
{
if (HasComp<StandingStateComponent>(uid))
{
_standing.TryLieDown(uid, null, SharedStandingStateSystem.DropHeldItemsBehavior.NoDrop);
}
}
}
private void OnStaminaHitAttempt(Entity<TelescopicBatonComponent> entity, ref StaminaDamageOnHitAttemptEvent args)
{
if (!_itemToggle.IsActivated(entity.Owner))
args.Cancelled = true;
}
private void OnExamined(Entity<TelescopicBatonComponent> 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<TelescopicBatonComponent> entity, ref ItemToggledEvent args)
{
_item.SetHeldPrefix(entity.Owner, args.Activated ? "on" : "off");
}
}

View File

@@ -14,3 +14,4 @@ loadout-group-job-trinkets = Рабочий инвентарь
loadout-group-inhand = В руках
loadout-group-trinkets = Побрякушки
loadout-group-instruments = Муз. инструменты
loadout-group-self-defence-devices = Средства самообороны

View File

@@ -1,4 +1,4 @@
ent-Telebaton = телескопическая дубинка
ent-TelescopicBaton = телескопическая дубинка
.desc = Компактное, но надежное оружие личной обороны. В сложенном состоянии может быть скрыто.
comp-telebaton-examined-on = Дубинка в боевом положении.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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