-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- ЭТО ШАБЛОН ВАШЕГО PULL REQUEST. Текст между стрелками - это комментарии - они не будут видны в PR. --> ## Описание PR <!-- Ниже опишите ваш Pull Request. Что он изменяет? На что еще это может повлиять? Постарайтесь описать все внесённые вами изменения! --> **Медиа** <!-- Если приемлемо, добавьте скриншоты для демонстрации вашего PR. Если ваш PR представляет собой визуальное изменение, добавьте скриншоты, иначе он может быть закрыт. --> **Проверки** <!-- Выполнение всех следующих действий, если это приемлемо для вида изменений сильно ускорит разбор вашего PR --> - [x] PR полностью завершён и мне не нужна помощь чтобы его закончить. - [x] Я внимательно просмотрел все свои изменения и багов в них не нашёл. - [x] Я запускал локальный сервер со своими изменениями и всё протестировал. - [x] Я добавил скриншот/видео демонстрации PR в игре, **или** этот PR этого не требует. **Изменения** no cl
- Loading branch information
1 parent
c81774d
commit bfe8bfe
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 added
BIN
+18 KB
Resources/Audio/ADT/Entities/Objects/Weapons/Melee/close_telescopichka.ogg
Binary file not shown.
Binary file added
BIN
+13.3 KB
Resources/Audio/ADT/Entities/Objects/Weapons/Melee/open_telescopichka.ogg
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
Resources/Locale/ru-RU/ADT/Entities/Objects/Weapons/Melee/melee.ftl
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/Entities/Objects/Weapons/Melee/open_telescopichka.ogg" | ||
closeSound: "/Audio/ADT/Entities/Objects/Weapons/Melee/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/Entities/Objects/Weapons/Melee/open_telescopichka.ogg" | ||
closeSound: "/Audio/ADT/Entities/Objects/Weapons/Melee/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/Entities/Objects/Weapons/Melee/open_telescopichka.ogg" | ||
closeSound: "/Audio/ADT/Entities/Objects/Weapons/Melee/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.