-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea86b19
commit 945c850
Showing
27 changed files
with
377 additions
and
0 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
Content.Server/ADT/SwitchableWeapon/SwitchableWeapon/SwitchableWeaponSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using Content.Shared.Damage.Components; | ||
using Content.Shared.Damage.Events; | ||
using Content.Shared.Examine; | ||
using Content.Shared.Interaction.Events; | ||
using Content.Shared.Item; | ||
using Content.Shared.ADT.SwitchableWeapon; | ||
using Content.Shared.Toggleable; | ||
using Content.Shared.Weapons.Melee.Events; | ||
using Robust.Shared.Audio.Systems; | ||
|
||
namespace Content.Server.ADT.SwitchableWeapon; | ||
|
||
public sealed class SwitchableWeaponSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedItemSystem _item = default!; | ||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!; | ||
[Dependency] private readonly SharedAudioSystem _audio = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<SwitchableWeaponComponent, UseInHandEvent>(Toggle); | ||
SubscribeLocalEvent<SwitchableWeaponComponent, ExaminedEvent>(OnExamined); | ||
SubscribeLocalEvent<SwitchableWeaponComponent, StaminaDamageOnHitAttemptEvent>(OnStaminaHitAttempt); | ||
SubscribeLocalEvent<SwitchableWeaponComponent, GetMeleeDamageEvent>(OnGetMeleeDamage); | ||
SubscribeLocalEvent<SwitchableWeaponComponent, ComponentAdd>(OnComponentAdded); | ||
} | ||
|
||
private void OnComponentAdded(EntityUid uid, SwitchableWeaponComponent component, ComponentAdd args) | ||
{ | ||
UpdateState(uid, component); | ||
} | ||
|
||
//Non-stamina damage | ||
private void OnGetMeleeDamage(EntityUid uid, SwitchableWeaponComponent component, ref GetMeleeDamageEvent args) | ||
{ | ||
args.Damage = component.IsOpen ? component.DamageOpen : component.DamageFolded; | ||
} | ||
|
||
private void OnStaminaHitAttempt(EntityUid uid, SwitchableWeaponComponent component, ref StaminaDamageOnHitAttemptEvent args) | ||
{ | ||
if (!component.IsOpen) | ||
return; | ||
|
||
//args.HitSoundOverride = component.BonkSound; | ||
} | ||
|
||
private void OnExamined(EntityUid uid, SwitchableWeaponComponent comp, ExaminedEvent args) | ||
{ | ||
var msg = comp.IsOpen | ||
? Loc.GetString("comp-switchable-examined-on") | ||
: Loc.GetString("comp-switchable-examined-off"); | ||
args.PushMarkup(msg); | ||
} | ||
|
||
private void UpdateState(EntityUid uid, SwitchableWeaponComponent comp) | ||
{ | ||
if (TryComp<ItemComponent>(comp.Owner, out var item)) | ||
{ | ||
_item.SetSize(item.Owner, comp.IsOpen ? comp.SizeOpened : comp.SizeClosed, item); | ||
_item.SetHeldPrefix(comp.Owner, comp.IsOpen ? "on" : "off", false, item); | ||
} | ||
|
||
if (TryComp<AppearanceComponent>(comp.Owner, out var appearance)) | ||
_appearance.SetData(comp.Owner, ToggleVisuals.Toggled, comp.IsOpen, appearance); | ||
|
||
// Change stamina damage according to state | ||
if (TryComp<StaminaDamageOnHitComponent>(uid, out var stamComp)) | ||
{ | ||
stamComp.Damage = comp.IsOpen ? comp.StaminaDamageOpen : comp.StaminaDamageFolded; | ||
} | ||
} | ||
|
||
private void Toggle(EntityUid uid, SwitchableWeaponComponent comp, UseInHandEvent args) | ||
{ | ||
comp.IsOpen = !comp.IsOpen; | ||
UpdateState(uid, comp); | ||
|
||
var soundToPlay = comp.IsOpen ? comp.OpenSound : comp.CloseSound; | ||
_audio.PlayPvs(soundToPlay, args.User); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
Content.Shared/ADT/SwitchableWeapon/SwitchableWeaponComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
using Content.Shared.Damage; | ||
using Content.Shared.Item; | ||
using Robust.Shared.Audio; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Shared.ADT.SwitchableWeapon; | ||
|
||
[RegisterComponent] | ||
public sealed partial class SwitchableWeaponComponent : Component | ||
{ | ||
[ViewVariables(VVAccess.ReadWrite)][DataField("damageFolded")] | ||
public DamageSpecifier DamageFolded = new(){ | ||
DamageDict = new() | ||
{ | ||
{ "Blunt", 0.0f }, | ||
} | ||
}; | ||
|
||
[ViewVariables(VVAccess.ReadWrite)][DataField("damageOpen")] | ||
public DamageSpecifier DamageOpen = new(){ | ||
DamageDict = new() | ||
{ | ||
{ "Blunt", 4.0f }, | ||
} | ||
}; | ||
|
||
[ViewVariables(VVAccess.ReadWrite)][DataField("staminaDamageFolded")] | ||
public float StaminaDamageFolded = 0; | ||
|
||
[ViewVariables(VVAccess.ReadWrite)][DataField("staminaDamageOpen")] | ||
public float StaminaDamageOpen = 28; | ||
|
||
[ViewVariables(VVAccess.ReadWrite)][DataField("isOpen")] | ||
public bool IsOpen = false; | ||
|
||
[ViewVariables(VVAccess.ReadWrite)][DataField("openSound")] | ||
public SoundSpecifier? OpenSound; | ||
|
||
[ViewVariables(VVAccess.ReadWrite)][DataField("closeSound")] | ||
public SoundSpecifier? CloseSound; | ||
|
||
[ViewVariables(VVAccess.ReadWrite)][DataField("bonkSound")] | ||
public SoundSpecifier? BonkSound; | ||
|
||
[ViewVariables(VVAccess.ReadWrite)][DataField("sizeOpened")] | ||
public ProtoId<ItemSizePrototype> SizeOpened = "Normal"; | ||
|
||
[ViewVariables(VVAccess.ReadWrite)][DataField("sizeClosed")] | ||
public ProtoId<ItemSizePrototype> SizeClosed = "Normal"; | ||
} |
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
Resources/Locale/ru-RU/ADT/Entities/Objects/Weapons/Melee/BlueShield.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ent-ADTtelescopicBaton = Телескопическая дубинка | ||
.desc = "Большая, опасная и выдвижная дубинка. Может храниться в карманах в сложенном состоянии." | ||
.suffix = { "" } | ||
ent-ADTtelescopicBatonBob = Телескопическая дубинка Боба | ||
.desc = "Эксклюзивная телескопическая дубинка, полностью из золота." | ||
.suffix = { "" } | ||
ent-ADTtelescopicBatonKon = Телескопическая дубинка Йохана | ||
.desc = "Непонятно, кровь это или цвет дубинки.." | ||
.suffix = { "" } |
135 changes: 135 additions & 0 deletions
135
Resources/Prototypes/ADT/Entities/Objects/Weapons/Melee/telescopic_baton.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
- type: entity | ||
name: TelescopicBaton | ||
parent: BaseItem | ||
id: ADTtelescopicBaton | ||
description: Big, dangerous telescopic baton. Can be stored in pockets when turned off. | ||
components: | ||
- type: Sprite | ||
sprite: ADT/Objects/Weapons/Melee/telescopic_baton.rsi | ||
layers: | ||
- state: telescope_off | ||
map: [ "enum.ToggleVisuals.Layer" ] | ||
- type: SwitchableWeapon | ||
openSound: "/Audio/ADT/open_telescopichka.ogg" | ||
closeSound: "/Audio/ADT/close_telescopichka.ogg" | ||
#bonkSound: "/Audio/ADT/bonk_dubinka.ogg" | ||
damageOpen: | ||
types: | ||
Blunt: 2.4 | ||
damageFolded: | ||
types: | ||
Blunt: 0 | ||
staminaDamageFolded: 0 | ||
staminaDamageOpen: 35 | ||
sizeOpened: Normal | ||
sizeClosed: Small | ||
- type: StaminaDamageOnHit | ||
damage: 0 | ||
- type: MeleeWeapon | ||
damage: | ||
types: | ||
Blunt: 2.4 | ||
- type: Item | ||
size: Small | ||
sprite: ADT/Objects/Weapons/Melee/telescopic_baton.rsi | ||
- type: UseDelay | ||
delay: 1.0 | ||
- type: DisarmMalus | ||
malus: 0 | ||
- type: Appearance | ||
- type: GenericVisualizer | ||
visuals: | ||
enum.ToggleVisuals.Toggled: | ||
enum.ToggleVisuals.Layer: | ||
True: {state: telescope_on} | ||
False: {state: telescope_off} | ||
|
||
- type: entity | ||
name: TelescopicBatonBob | ||
parent: ADTtelescopicBaton | ||
id: ADTtelescopicBatonBob | ||
description: Big, dangerous telescopic baton. Can be stored in pockets when turned off. | ||
components: | ||
- type: Sprite | ||
sprite: ADT/Objects/Weapons/Melee/telescopic_baton_bob.rsi | ||
layers: | ||
- state: telescope_off | ||
map: [ "enum.ToggleVisuals.Layer" ] | ||
- type: SwitchableWeapon | ||
openSound: "/Audio/ADT/open_telescopichka.ogg" | ||
closeSound: "/Audio/ADT/close_telescopichka.ogg" | ||
#bonkSound: "/Audio/ADT/bonk_dubinka.ogg" | ||
damageOpen: | ||
types: | ||
Blunt: 2.4 | ||
damageFolded: | ||
types: | ||
Blunt: 0 | ||
staminaDamageFolded: 0 | ||
staminaDamageOpen: 35 | ||
- type: StaminaDamageOnHit | ||
damage: 0 | ||
- type: MeleeWeapon | ||
damage: | ||
types: | ||
Blunt: 2.4 | ||
- type: Item | ||
size: Small | ||
sprite: ADT/Objects/Weapons/Melee/telescopic_baton_bob.rsi | ||
- type: UseDelay | ||
delay: 1.0 | ||
- type: DisarmMalus | ||
malus: 0 | ||
- type: Appearance | ||
- type: GenericVisualizer | ||
visuals: | ||
enum.ToggleVisuals.Toggled: | ||
enum.ToggleVisuals.Layer: | ||
True: {state: telescope_on} | ||
False: {state: telescope_off} | ||
|
||
|
||
|
||
- type: entity | ||
name: TelescopicBatonKon | ||
parent: ADTtelescopicBaton | ||
id: ADTtelescopicBatonKon | ||
description: Big, dangerous telescopic baton. Can be stored in pockets when turned off. | ||
components: | ||
- type: Sprite | ||
sprite: ADT/Objects/Weapons/Melee/telescopic_baton_kon.rsi | ||
layers: | ||
- state: telescope_off | ||
map: [ "enum.ToggleVisuals.Layer" ] | ||
- type: SwitchableWeapon | ||
openSound: "/Audio/ADT/open_telescopichka.ogg" | ||
closeSound: "/Audio/ADT/close_telescopichka.ogg" | ||
#bonkSound: "/Audio/ADT/bonk_dubinka.ogg" | ||
damageOpen: | ||
types: | ||
Blunt: 2.4 | ||
damageFolded: | ||
types: | ||
Blunt: 0 | ||
staminaDamageFolded: 0 | ||
staminaDamageOpen: 35 | ||
- type: StaminaDamageOnHit | ||
damage: 0 | ||
- type: MeleeWeapon | ||
damage: | ||
types: | ||
Blunt: 2.4 | ||
- type: Item | ||
size: Small | ||
sprite: ADT/Objects/Weapons/Melee/telescopic_baton_kon.rsi | ||
- type: UseDelay | ||
delay: 1.0 | ||
- type: DisarmMalus | ||
malus: 0 | ||
- type: Appearance | ||
- type: GenericVisualizer | ||
visuals: | ||
enum.ToggleVisuals.Toggled: | ||
enum.ToggleVisuals.Layer: | ||
True: {state: telescope_on} | ||
False: {state: telescope_off} |
33 changes: 33 additions & 0 deletions
33
Resources/Textures/ADT/Objects/Weapons/Melee/telescopic_baton.rsi/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"version": 1, | ||
"license": "CC-BY-3.0", | ||
"copyright": "Sprited by mixnikita", | ||
"size": { | ||
"x": 32, | ||
"y": 32 | ||
}, | ||
"states": [ | ||
{ | ||
"name": "telescope_on" | ||
}, | ||
{ | ||
"name": "telescope_off" | ||
}, | ||
{ | ||
"name": "off-inhand-left", | ||
"directions": 4 | ||
}, | ||
{ | ||
"name": "off-inhand-right", | ||
"directions": 4 | ||
}, | ||
{ | ||
"name": "on-inhand-left", | ||
"directions": 4 | ||
}, | ||
{ | ||
"name": "on-inhand-right", | ||
"directions": 4 | ||
} | ||
] | ||
} |
Binary file added
BIN
+218 Bytes
...ces/Textures/ADT/Objects/Weapons/Melee/telescopic_baton.rsi/off-inhand-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+213 Bytes
...es/Textures/ADT/Objects/Weapons/Melee/telescopic_baton.rsi/off-inhand-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+371 Bytes
...rces/Textures/ADT/Objects/Weapons/Melee/telescopic_baton.rsi/on-inhand-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+374 Bytes
...ces/Textures/ADT/Objects/Weapons/Melee/telescopic_baton.rsi/on-inhand-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+374 Bytes
...urces/Textures/ADT/Objects/Weapons/Melee/telescopic_baton.rsi/telescope_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+615 Bytes
Resources/Textures/ADT/Objects/Weapons/Melee/telescopic_baton.rsi/telescope_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions
33
Resources/Textures/ADT/Objects/Weapons/Melee/telescopic_baton_bob.rsi/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"version": 1, | ||
"license": "CC-BY-3.0", | ||
"copyright": "Sprited by mixnikita", | ||
"size": { | ||
"x": 32, | ||
"y": 32 | ||
}, | ||
"states": [ | ||
{ | ||
"name": "telescope_on" | ||
}, | ||
{ | ||
"name": "telescope_off" | ||
}, | ||
{ | ||
"name": "off-inhand-left", | ||
"directions": 4 | ||
}, | ||
{ | ||
"name": "off-inhand-right", | ||
"directions": 4 | ||
}, | ||
{ | ||
"name": "on-inhand-left", | ||
"directions": 4 | ||
}, | ||
{ | ||
"name": "on-inhand-right", | ||
"directions": 4 | ||
} | ||
] | ||
} |
Binary file added
BIN
+171 Bytes
...Textures/ADT/Objects/Weapons/Melee/telescopic_baton_bob.rsi/off-inhand-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+173 Bytes
...extures/ADT/Objects/Weapons/Melee/telescopic_baton_bob.rsi/off-inhand-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+837 Bytes
.../Textures/ADT/Objects/Weapons/Melee/telescopic_baton_bob.rsi/on-inhand-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+939 Bytes
...Textures/ADT/Objects/Weapons/Melee/telescopic_baton_bob.rsi/on-inhand-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+236 Bytes
...s/Textures/ADT/Objects/Weapons/Melee/telescopic_baton_bob.rsi/telescope_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+289 Bytes
...es/Textures/ADT/Objects/Weapons/Melee/telescopic_baton_bob.rsi/telescope_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions
33
Resources/Textures/ADT/Objects/Weapons/Melee/telescopic_baton_kon.rsi/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"version": 1, | ||
"license": "CC-BY-3.0", | ||
"copyright": "Sprited by mixnikita", | ||
"size": { | ||
"x": 32, | ||
"y": 32 | ||
}, | ||
"states": [ | ||
{ | ||
"name": "telescope_on" | ||
}, | ||
{ | ||
"name": "telescope_off" | ||
}, | ||
{ | ||
"name": "off-inhand-left", | ||
"directions": 4 | ||
}, | ||
{ | ||
"name": "off-inhand-right", | ||
"directions": 4 | ||
}, | ||
{ | ||
"name": "on-inhand-left", | ||
"directions": 4 | ||
}, | ||
{ | ||
"name": "on-inhand-right", | ||
"directions": 4 | ||
} | ||
] | ||
} |
Binary file added
BIN
+170 Bytes
...Textures/ADT/Objects/Weapons/Melee/telescopic_baton_kon.rsi/off-inhand-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+172 Bytes
...extures/ADT/Objects/Weapons/Melee/telescopic_baton_kon.rsi/off-inhand-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+830 Bytes
.../Textures/ADT/Objects/Weapons/Melee/telescopic_baton_kon.rsi/on-inhand-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+934 Bytes
...Textures/ADT/Objects/Weapons/Melee/telescopic_baton_kon.rsi/on-inhand-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+222 Bytes
...s/Textures/ADT/Objects/Weapons/Melee/telescopic_baton_kon.rsi/telescope_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+252 Bytes
...es/Textures/ADT/Objects/Weapons/Melee/telescopic_baton_kon.rsi/telescope_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.