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

Перенос Следователя СБ #25

Closed
Closed
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
83 changes: 83 additions & 0 deletions Content.Server/ADT/SwitchableWeapon/SwitchableWeaponSystem.cs
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);
}
}
50 changes: 50 additions & 0 deletions Content.Shared/ADT/SwitchableWeapon/SwitchableWeaponComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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 Resources/Audio/ADT/close_telescopichka.ogg
Binary file not shown.
Binary file added Resources/Audio/ADT/open_telescopichka.ogg
Binary file not shown.
3 changes: 3 additions & 0 deletions Resources/Locale/ru-RU/ADT/Entities/Clothing/Belt/belt.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ent-ADTClothingBeltInvestigatorHolster = кобура следователя СБ
.desc = Кобура с табельным оружием следователя СБ - пистолетом с магазинами нелетальных и летальных патронов.
.suffix = { "" }
3 changes: 3 additions & 0 deletions Resources/Locale/ru-RU/ADT/Entities/Clothing/Head/hats.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ent-ADTClothingHeadHatsInvestigatorCap = фуражка следователя Службы Безопасности
.desc = Слава NanoTrasen!
.suffix = { "" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-ADTClothingNeckSecBadge = жетон Службы Безопасности
.desc = Позолоченный жетон с символикой Службы Безопасности и индивидуальным номером сотрудника. Предмет особой гордости среди офицеров.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ent-ADTClothingOuterCoatInvestigator = бушлат следователя Службы Безопасности
.desc = Один вид этого бушлата повышает вероятность чистосердечного признания подозреваемого на 50%.
.suffix = { "" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ent-ADTClothingUniformInvestigatorSuit = форма следователя Службы Безопасности
.desc = Одежда для того, кто намерен докопаться до сути всех тайн.
.suffix = { "" }
2 changes: 2 additions & 0 deletions Resources/Locale/ru-RU/ADT/Entities/Objects/Device/pda.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-ADTInvestigatorPDA = КПК следователя СБ
.desc = Пахнет как чернила и дело, закрытое предварительно из-за смерти подозреваемого от несчастного случая на рабочем месте.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-ADTInvestigatorIDCard = ID карта следователя СБ
.desc = { ent-IDCardStandard.desc }
11 changes: 11 additions & 0 deletions Resources/Locale/ru-RU/ADT/Entities/Weapons/security.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ent-ADTtelescopicBaton = Телескопическая дубинка
.desc = "Большая, опасная и выдвижная дубинка. Может храниться в карманах в сложенном состоянии."
.suffix = { "" }

ent-ADTtelescopicBatonBob = Телескопическая дубинка Боба
.desc = "Эксклюзивная телескопическая дубинка, полностью из золота."
.suffix = { "" }

ent-ADTtelescopicBatonKon = Телескопическая дубинка Йохана
.desc = "Непонятно, кровь это или цвет дубинки.."
.suffix = { "" }
1 change: 1 addition & 0 deletions Resources/Locale/ru-RU/ADT/Job/job-description.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
job-description-ADTInvestigator = Проводите допросы, опрашивайте потерпевших и свидетелей, помогайте детективу и смотрителю, ведите особо сложные уголовные дела.
1 change: 1 addition & 0 deletions Resources/Locale/ru-RU/ADT/Job/job-names.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
job-name-ADTInvestigator = Следователь СБ
11 changes: 11 additions & 0 deletions Resources/Prototypes/ADT/Catalog/Fills/Items/belt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#кобура следователя СБ

- type: entity
id: ADTClothingBeltInvestigatorHolster
parent: ClothingBeltHolster
suffix: Filled
components:
- type: StorageFill
contents:
- id: WeaponPistolMk58
- id: MagazinePistol
14 changes: 14 additions & 0 deletions Resources/Prototypes/ADT/Entities/Clothing/Head/hats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#Фуражка следователя
- type: entity
parent: ClothingHeadBase
id: ADTClothingHeadHatsInvestigatorCap
name: investigator cap
description: Glory to NanoTrasen!
components:
- type: Tag
tags: # ignore "WhitelistChameleon" tag
- WhitelistChameleon
- type: Sprite
sprite: ADT/Clothing/Head/Hats/investigator_cap.rsi
- type: Clothing
sprite: ADT/Clothing/Head/Hats/investigator_cap.rsi
8 changes: 8 additions & 0 deletions Resources/Prototypes/ADT/Entities/Clothing/Neck/specific.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- type: entity
parent: ClothingNeckBase
id: ADTClothingNeckSecBadge
name: sec badge
description: sec badge
components:
- type: Sprite
sprite: ADT/Clothing/Neck/secbadge.rsi
27 changes: 27 additions & 0 deletions Resources/Prototypes/ADT/Entities/Clothing/OuterClothing/coats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#бушлат следователя

- type: entity
parent: ClothingOuterStorageBase
id: ADTClothingOuterCoatInvestigator
name: investigator bushlat
description: This pea jacket increases the chance of a suspect's confession by half.
components:
- type: Storage
grid:
- 0,0,3,1
maxItemSize: Normal
- type: Sprite
sprite: ADT/Clothing/OuterClothing/Coats/investigator_coat.rsi
- type: Clothing
sprite: ADT/Clothing/OuterClothing/Coats/investigator_coat.rsi
- type: StorageFill
contents:
- id: CigarGoldCase
- id: Lighter
- type: Armor
modifiers:
coefficients:
Blunt: 0.8
Slash: 0.8
Piercing: 0.7
Heat: 0.8
12 changes: 12 additions & 0 deletions Resources/Prototypes/ADT/Entities/Clothing/Uniforms/Jumpsuit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Комбинезон следователя

- type: entity
parent: ClothingUniformBase
id: ADTClothingUniformInvestigatorSuit
name: investigator suit
description: The costume of the one who will get to the bottom of all the secrets.
components:
- type: Sprite
sprite: ADT/Clothing/Uniforms/Jumpsuit/investigator_suit.rsi
- type: Clothing
sprite: ADT/Clothing/Uniforms/Jumpsuit/investigator_suit.rsi
22 changes: 22 additions & 0 deletions Resources/Prototypes/ADT/Entities/Markers/Spawners/job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- type: entity
id: ADTSpawnPointJobBase
parent: MarkerBase
abstract: true
suffix: Job Spawn ADT
components:
- type: SpawnPoint
spawn_type: Job
- type: Sprite
sprite: ADT/Markers/job.rsi

- type: entity
id: ADTSpawnPointInvestigator
parent: ADTSpawnPointJobBase
name: Investigator
components:
- type: SpawnPoint
job_id: ADTInvestigator
- type: Sprite
layers:
- state: green
- state: investigator
15 changes: 15 additions & 0 deletions Resources/Prototypes/ADT/Entities/Objects/Device/pda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# КПК Следователя

- type: entity
parent: BasePDA
id: ADTInvestigatorPDA
name: investigator PDA
description: It smells like ink and the case is prematurely closed due to the death of a suspect at work.
components:
- type: Pda
id: ADTInvestigatorIDCard
state: pda-investigator
- type: PdaBorderColor
borderColor: "#774705"
- type: Icon
state: pda-investigator
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Айди карта следователя СБ

- type: entity
parent: IDCardStandard
id: ADTInvestigatorIDCard
name: investigator ID card
components:
- type: Sprite
sprite: ADT/Objects/Misc/id_cards.rsi
layers:
- state: default
- state: idinvestigator
- type: PresetIdCard
job: ADTInvestigator
Loading
Loading