funny sword (#15)
(cherry picked from commit 231aaa1b33b7e4edf00506c6ebdbd389257cf1ca)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server._White._Engi.PacifiedOnChaplainAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds verb for chaplain to pacify entity.
|
||||
/// WD Engi Exclusive.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class PacifiedOnChaplainActionComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public SoundSpecifier ActionSound = new SoundPathSpecifier("/Audio/Effects/holy.ogg");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Server.Popups;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Server.Bible.Components;
|
||||
using Content.Shared.Timing;
|
||||
using Content.Shared.CombatMode.Pacification;
|
||||
|
||||
namespace Content.Server._White._Engi.PacifiedOnChaplainAction
|
||||
{
|
||||
/// <summary>
|
||||
/// WD Engi Exclusive.
|
||||
/// </summary>
|
||||
public sealed class PacifiedOnChaplainAction : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly UseDelaySystem _delay = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<PacifiedOnChaplainActionComponent, AfterInteractEvent>(OnAfterInteract);
|
||||
SubscribeLocalEvent<PacifiedOnChaplainActionComponent, GetVerbsEvent<AlternativeVerb>>(AddPacifiedOnChaplainVerb);
|
||||
}
|
||||
|
||||
private void Action(PacifiedOnChaplainActionComponent component, EntityUid target, EntityUid user)
|
||||
{
|
||||
var popup = "";
|
||||
|
||||
if (HasComp<PacifiedComponent>(target))
|
||||
{
|
||||
popup = "unpacified-by-chaplain";
|
||||
RemComp<PacifiedComponent>(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
popup = "pacified-by-chaplain";
|
||||
EnsureComp<PacifiedComponent>(target);
|
||||
}
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString(popup, ("target", target)), user, user);
|
||||
|
||||
_audio.PlayPvs(component.ActionSound, user);
|
||||
|
||||
}
|
||||
|
||||
private void OnAfterInteract(EntityUid uid, PacifiedOnChaplainActionComponent component, AfterInteractEvent args)
|
||||
{
|
||||
if (!args.CanReach)
|
||||
return;
|
||||
|
||||
if (!TryComp(uid, out UseDelayComponent? useDelay) || _delay.IsDelayed((uid, useDelay)))
|
||||
return;
|
||||
|
||||
if (args.Target == null)
|
||||
return;
|
||||
|
||||
if (!HasComp<BibleUserComponent>(args.User))
|
||||
return;
|
||||
|
||||
Action(component, (EntityUid) args.Target, args.User);
|
||||
|
||||
_delay.TryResetDelay((uid, useDelay));
|
||||
|
||||
return;
|
||||
}
|
||||
private void AddPacifiedOnChaplainVerb(EntityUid uid, PacifiedOnChaplainActionComponent component, GetVerbsEvent<AlternativeVerb> args)
|
||||
{
|
||||
if (!args.CanInteract || !args.CanAccess)
|
||||
return;
|
||||
|
||||
if (!HasComp<BibleUserComponent>(args.User))
|
||||
return;
|
||||
|
||||
if (!_blocker.CanInteract(args.User, uid))
|
||||
return;
|
||||
|
||||
var verbName = "";
|
||||
|
||||
if (HasComp<PacifiedComponent>(args.Target))
|
||||
verbName = Loc.GetString("unpacify-by-chaplain");
|
||||
else
|
||||
verbName = Loc.GetString("pacify-by-chaplain");
|
||||
|
||||
AlternativeVerb verb = new()
|
||||
{
|
||||
Act = () =>
|
||||
{
|
||||
if (!TryComp(uid, out UseDelayComponent? useDelay) || _delay.IsDelayed((uid, useDelay)))
|
||||
return;
|
||||
|
||||
Action(component, args.Target, args.User);
|
||||
|
||||
_delay.TryResetDelay((uid, useDelay));
|
||||
},
|
||||
Text = verbName,
|
||||
Priority = 2
|
||||
};
|
||||
args.Verbs.Add(verb);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
pacified-by-chaplain = {$target} пасифицирован.
|
||||
unpacified-by-chaplain = {$target} освобождён.
|
||||
|
||||
pacify-by-chaplain = Пасифицировать
|
||||
unpacify-by-chaplain = Освободить
|
||||
3
Resources/Locale/ru-RU/_Engi/possesed-blade.ftl
Normal file
3
Resources/Locale/ru-RU/_Engi/possesed-blade.ftl
Normal file
@@ -0,0 +1,3 @@
|
||||
ghost-role-information-possessed-blade-name = Одержимый Клинок
|
||||
ghost-role-information-possessed-blade-description = Вы - Одержимый Клинок. Подчиняйтесь своему владельцу.
|
||||
ghost-role-information-possessed-blade-rules = Вы не имеете право атаковать своего владельца. Право собственности может быть передано только вашим владельцем.
|
||||
@@ -264,10 +264,11 @@
|
||||
- type: Sharp
|
||||
|
||||
# Может пиздеть
|
||||
# WD Engi Exclusive - и может давать пизды
|
||||
- type: entity
|
||||
parent: HolyKatana
|
||||
id: PossessedBlade
|
||||
name: одержимый клинок
|
||||
name: Одержимый Клинок
|
||||
description: Когда на станции царит хаос, приятно иметь рядом друга.
|
||||
components:
|
||||
- type: Sprite
|
||||
@@ -281,9 +282,11 @@
|
||||
- suitStorage
|
||||
- type: GhostRole
|
||||
allowSpeech: true
|
||||
name: Одержимый Клинок
|
||||
description: Вы - одержимый клинок. Подчиняйтесь своему владельцу.
|
||||
rules: ghost-role-component-default-rules
|
||||
# WD Engi Exclusive edit start
|
||||
name: ghost-role-information-possessed-blade-name
|
||||
description: ghost-role-information-possessed-blade-description
|
||||
rules: ghost-role-information-possessed-blade-rules
|
||||
# WD Engi Exclusive edit end
|
||||
- type: GhostTakeoverAvailable
|
||||
- type: Examiner
|
||||
- type: Item
|
||||
@@ -292,6 +295,16 @@
|
||||
shape:
|
||||
- 0, 0, 1, 3
|
||||
sprite: White/Objects/Weapons/Chaplain/possessed.rsi
|
||||
# WD Engi Exclusive start
|
||||
- type: DamageOtherOnHit
|
||||
damage:
|
||||
types:
|
||||
Slash: 13
|
||||
- type: CombatMode
|
||||
- type: UseDelay
|
||||
delay: 2.0
|
||||
- type: PacifiedOnChaplainAction
|
||||
# WD Engi Exclusive end
|
||||
|
||||
# Приклеен к руке, быстро и громко бьет
|
||||
- type: entity
|
||||
|
||||
Reference in New Issue
Block a user