Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Telescopic Baton #76

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,59 @@
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;
using Content.Shared._CorvaxNext.Standing;

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
@@ -1 +1,2 @@
steal-target-groups-telescopic-baton = телескопическая дубинка
steal-target-groups-security-badge = жетоны службы безопасности
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
@@ -1,3 +1,10 @@
- type: stealTargetGroup
id: TelescopicBaton
name: steal-target-groups-telescopic-baton
sprite:
sprite: _CorvaxNext/Objects/Weapons/Melee/telescopic_baton.rsi
state: telescopic_baton_on

- type: stealTargetGroup
id: ClothingNeckSecBadge
name: steal-target-groups-security-badge
Expand Down
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.
Loading