Cluwne smite (#13367)
This commit is contained in:
@@ -43,6 +43,7 @@ using Content.Shared.Popups;
|
||||
using Content.Shared.Tabletop.Components;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics;
|
||||
@@ -51,7 +52,9 @@ using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Audio;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
using Content.Shared.Cluwne;
|
||||
|
||||
namespace Content.Server.Administration.Systems;
|
||||
|
||||
@@ -557,25 +560,21 @@ public sealed partial class AdminVerbSystem
|
||||
};
|
||||
args.Verbs.Add(killSign);
|
||||
|
||||
// TODO: Port cluwne outfit.
|
||||
Verb clown = new()
|
||||
Verb cluwne = new()
|
||||
{
|
||||
Text = "Clown",
|
||||
Text = "Cluwne",
|
||||
Category = VerbCategory.Smite,
|
||||
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Objects/Fun/bikehorn.rsi"), "icon"),
|
||||
|
||||
Icon = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Clothing/Mask/cluwne.rsi"), "icon"),
|
||||
|
||||
Act = () =>
|
||||
{
|
||||
SetOutfitCommand.SetOutfit(args.Target, "ClownGear", EntityManager, (_, clothing) =>
|
||||
{
|
||||
if (HasComp<ClothingComponent>(clothing))
|
||||
EnsureComp<UnremoveableComponent>(clothing);
|
||||
EnsureComp<ClumsyComponent>(args.Target);
|
||||
});
|
||||
EnsureComp<CluwneComponent>(args.Target);
|
||||
},
|
||||
Impact = LogImpact.Extreme,
|
||||
Message = Loc.GetString("admin-smite-clown-description")
|
||||
Message = Loc.GetString("admin-smite-cluwne-description")
|
||||
};
|
||||
args.Verbs.Add(clown);
|
||||
args.Verbs.Add(cluwne);
|
||||
|
||||
Verb maiden = new()
|
||||
{
|
||||
|
||||
104
Content.Server/Cluwne/CluwneSystem.cs
Normal file
104
Content.Server/Cluwne/CluwneSystem.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using Content.Server.Administration.Commands;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Server.Chat;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Shared.Chat.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Server.Emoting.Systems;
|
||||
using Content.Server.Speech.EntitySystems;
|
||||
using Content.Shared.Cluwne;
|
||||
using Content.Shared.Interaction.Components;
|
||||
|
||||
namespace Content.Server.Cluwne;
|
||||
|
||||
public sealed class CluwneSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly SharedStunSystem _stunSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly ChatSystem _chat = default!;
|
||||
[Dependency] private readonly AutoEmoteSystem _autoEmote = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CluwneComponent, ComponentStartup>(OnComponentStartup);
|
||||
SubscribeLocalEvent<CluwneComponent, MobStateChangedEvent>(OnMobState);
|
||||
SubscribeLocalEvent<CluwneComponent, EmoteEvent>(OnEmote, before:
|
||||
new[] { typeof(VocalSystem), typeof(BodyEmotesSystem) });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On death removes active comps and gives genetic damage to prevent cloning, reduce this to allow cloning.
|
||||
/// </summary>
|
||||
private void OnMobState(EntityUid uid, CluwneComponent component, MobStateChangedEvent args)
|
||||
{
|
||||
if (args.NewMobState == MobState.Dead)
|
||||
{
|
||||
RemComp<CluwneComponent>(uid);
|
||||
RemComp<ClumsyComponent>(uid);
|
||||
RemComp<AutoEmoteComponent>(uid);
|
||||
var damageSpec = new DamageSpecifier(_prototypeManager.Index<DamageGroupPrototype>("Genetic"), 300);
|
||||
_damageableSystem.TryChangeDamage(uid, damageSpec);
|
||||
}
|
||||
}
|
||||
|
||||
public EmoteSoundsPrototype? EmoteSounds;
|
||||
|
||||
/// <summary>
|
||||
/// OnStartup gives the cluwne outfit, ensures clumsy, gives name prefix and makes sure emote sounds are laugh.
|
||||
/// </summary>
|
||||
private void OnComponentStartup(EntityUid uid, CluwneComponent component, ComponentStartup args)
|
||||
{
|
||||
if (component.EmoteSoundsId == null)
|
||||
return;
|
||||
_prototypeManager.TryIndex(component.EmoteSoundsId, out EmoteSounds);
|
||||
|
||||
var meta = MetaData(uid);
|
||||
var name = meta.EntityName;
|
||||
|
||||
EnsureComp<AutoEmoteComponent>(uid);
|
||||
_autoEmote.AddEmote(uid, "CluwneGiggle");
|
||||
EnsureComp<ClumsyComponent>(uid);
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("cluwne-transform", ("target", uid)), uid, PopupType.LargeCaution);
|
||||
_audio.PlayPvs(component.SpawnSound, uid);
|
||||
|
||||
meta.EntityName = Loc.GetString("cluwne-name-prefix", ("target", name));
|
||||
|
||||
SetOutfitCommand.SetOutfit(uid, "CluwneGear", EntityManager);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the timing on autoemote as well as falling over and honking.
|
||||
/// </summary>
|
||||
private void OnEmote(EntityUid uid, CluwneComponent component, ref EmoteEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
args.Handled = _chat.TryPlayEmoteSound(uid, EmoteSounds, args.Emote);
|
||||
|
||||
if (_robustRandom.Prob(component.GiggleRandomChance))
|
||||
{
|
||||
_audio.PlayPvs(component.SpawnSound, uid);
|
||||
_chat.TrySendInGameICMessage(uid, "honks", InGameICChatType.Emote, false, false);
|
||||
}
|
||||
|
||||
else if (_robustRandom.Prob(component.KnockChance))
|
||||
{
|
||||
_audio.PlayPvs(component.KnockSound, uid);
|
||||
_stunSystem.TryParalyze(uid, TimeSpan.FromSeconds(component.ParalyzeTime), true);
|
||||
_chat.TrySendInGameICMessage(uid, "spasms", InGameICChatType.Emote, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user