Skip to content

Commit

Permalink
[Feature] Telescopic Baton
Browse files Browse the repository at this point in the history
  • Loading branch information
PuroSlavKing committed Nov 23, 2024
1 parent 161c75f commit 2a440cc
Show file tree
Hide file tree
Showing 18 changed files with 210 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Shared._CorvaxNext.TelescopicBaton;

[RegisterComponent]
public sealed partial class TelescopicBatonComponent : Component
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using Content.Shared.Damage.Events;
using Content.Shared.Examine;
using Content.Shared.Item;
using Content.Shared.Standing;
using Content.Shared.Item.ItemToggle;
using Content.Shared.Item.ItemToggle.Components;
using Content.Shared.Stunnable;

namespace Content.Shared._CorvaxNext.TelescopicBaton;

public sealed class TelescopicBatonSystem : EntitySystem
{
[Dependency] private readonly SharedItemSystem _item = default!;
[Dependency] private readonly SharedStunSystem _stun = default!;
[Dependency] private readonly ItemToggleSystem _itemToggle = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;
// [Dependency] private readonly SharedLayingDownSystem _layingDown = 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 (TryComp<LayingDownComponent>(uid, out var layingDownComponent))
{
_layingDown.TryLieDown(uid, layingDownComponent, null, 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-telescopicbaton-examined-on")
: Loc.GetString("comp-telescopicbaton-examined-off");
args.PushMarkup(onMsg);
}

private void ToggleDone(Entity<TelescopicBatonComponent> entity, ref ItemToggledEvent args)
{
_item.SetHeldPrefix(entity.Owner, args.Activated ? "on" : "off");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loadout-group-self-defence-devices = Self defence devices
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
steal-target-groups-telescopic-baton = telescopic baton
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ent-TelescopicBaton = telescopic baton
.desc = A compact yet reliable personal defense weapon.
comp-telescopicbaton-examined-on = The baton is extended.
comp-telescopicbaton-examined-off = The baton is collapsed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loadout-group-self-defence-devices = Средства самообороны
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
steal-target-groups-telescopic-baton = телескопическая дубинка
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ent-TelescopicBaton = телескопическая дубинка
.desc = Компактное, но надежное оружие личной обороны.
comp-telescopicbaton-examined-on = Дубинка разложена.
comp-telescopicbaton-examined-off = Дубинка сложена.
7 changes: 7 additions & 0 deletions Resources/Prototypes/Loadouts/role_loadouts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- CaptainBackpack
- CaptainOuterClothing
- Survival
- SelfDefenceDevices # Corvax-Next-TelescopicBaton
- Trinkets
- GroupSpeciesBreathTool

Expand All @@ -24,6 +25,7 @@
- HoPOuterClothing
- Glasses
- Survival
- SelfDefenceDevices # Corvax-Next-TelescopicBaton
- Trinkets
- GroupSpeciesBreathTool

Expand Down Expand Up @@ -219,6 +221,7 @@
- QuartermasterShoes
- Glasses
- Survival
- SelfDefenceDevices # Corvax-Next-TelescopicBaton
- Trinkets
- GroupSpeciesBreathTool

Expand Down Expand Up @@ -263,6 +266,7 @@
- ChiefEngineerOuterClothing
- ChiefEngineerShoes
- SurvivalExtended
- SelfDefenceDevices # Corvax-Next-TelescopicBaton
- Trinkets
- GroupSpeciesBreathTool

Expand Down Expand Up @@ -320,6 +324,7 @@
- ResearchDirectorShoes
- Glasses
- Survival
- SelfDefenceDevices # Corvax-Next-TelescopicBaton
- Trinkets
- GroupSpeciesBreathTool

Expand Down Expand Up @@ -366,6 +371,7 @@
- HeadofSecurityOuterClothing
- SecurityShoes
- SurvivalSecurity
- SelfDefenceDevices # Corvax-Next-TelescopicBaton
- Trinkets
- SecurityStar
- GroupSpeciesBreathToolSecurity
Expand Down Expand Up @@ -443,6 +449,7 @@
- ChiefMedicalOfficerShoes
- Glasses
- SurvivalMedical
- SelfDefenceDevices # Corvax-Next-TelescopicBaton
- Trinkets
- GroupSpeciesBreathToolMedical

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
- type: entity
parent: BaseItem
id: TelescopicBaton
name: telescopic baton
description: A compact yet robust personal defense weapon.
components:
- type: TelescopicBaton
- type: Sprite
sprite: _CorvaxNext/Objects/Weapons/Melee/telescopic_baton.rsi
layers:
- state: telescopic_baton_off
map: [ "enum.ToggleVisuals.Layer" ]
- type: ItemToggleSize
activatedSize: Large
activatedShape:
- 0, 0, 3, 0
- type: ItemToggle
soundActivate:
path: /Audio/Weapons/telescopicon.ogg
params:
volume: -5
soundDeactivate:
path: /Audio/Weapons/telescopicoff.ogg
params:
volume: -5
- type: Appearance
- type: GenericVisualizer
visuals:
enum.ToggleVisuals.Toggled:
enum.ToggleVisuals.Layer:
True: {state: telescopic_baton_on}
False: {state: telescopic_baton_off}
- type: ToggleableLightVisuals
spriteLayer: blade
inhandVisuals:
left:
- state: on-inhand-left
right:
- state: on-inhand-right
- type: DisarmMalus
malus: 0.225
- type: MeleeWeapon
angle: 0
attackRate: 1.2
wideAnimationRotation: -135
damage:
types:
Blunt: 0
bluntStaminaDamageFactor: 0.0
- type: ItemToggleMeleeWeapon
activatedDamage:
types:
Blunt: 1.5
deactivatedSecret: true
- type: StaminaDamageOnHit
damage: 16
sound: /Audio/Weapons/boxingpunch1.ogg
- type: UseDelay
delay: 0.4
- type: Item
heldPrefix: on-
sprite: _CorvaxNext/Objects/Weapons/Melee/telescopic_baton.rsi
size: Small
storedRotation: 44
shape:
- 0, 0, 1, 0
- type: Clothing
quickEquip: false
slots:
- Belt
- type: StaticPrice
price: 350
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- type: loadout
id: TelescopicBaton
storage:
back:
- TelescopicBaton

- type: loadout
id: Flash
storage:
back:
- Flash
10 changes: 10 additions & 0 deletions Resources/Prototypes/_CorvaxNext/Loadouts/loadout_groups.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Command
- type: loadoutGroup
id: SelfDefenceDevices
name: loadout-group-self-defence-devices
minLimit: 1
maxLimit: 2
loadouts:
- TelescopicBaton
- Flash

# Security
- type: loadoutGroup
id: BrigmedicHead
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- type: stealTargetGroup
id: TelescopicBaton
name: steal-target-groups-telescopic-baton
sprite:
sprite: _CorvaxNext/Objects/Weapons/Melee/telescopic_baton.rsi
state: telescopic_baton_on
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/4397d63a55dac7d0536eb9bcc0a0f68634858c50 | Edited by PuroSlavKing (Github)",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "telescopic_baton_off"
},
{
"name": "telescopic_baton_on"
},
{
"name": "on-inhand-left",
"directions": 4
},
{
"name": "on-inhand-right",
"directions": 4
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2a440cc

Please sign in to comment.