Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet... * Added sprites for the gloves of the north star... * Replaced more placeholder sprites for northstar gloves... * Added gloves of the north star to uplink... * Added speech on hit, not yet configureable * Not functional yet, but a step in the right direction I hope... * IT WORKS!! * Licensing and cleanup * Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise * Reorganized some files, final build?? * Changed the adminlog type from Verb to new type ItemConfigure * More cleanup, fix sprite reference maybe * Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx * Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again! * Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them * Made it work with the latest changes on Master * Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click * Set value to 0 credits, that's all * Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts. * Update MeleeWeaponSystem.cs Iunno why this got changed in the first place, but I'm changin it back * emptycommit * emptycommit * The tiny fixening
This commit is contained in:
66
Content.Server/Speech/EntitySystems/MeleeSpeechSystem.cs
Normal file
66
Content.Server/Speech/EntitySystems/MeleeSpeechSystem.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Shared.Speech.Components;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using Content.Shared.Database;
|
||||
|
||||
|
||||
namespace Content.Server.Speech.EntitySystems;
|
||||
|
||||
public sealed class MeleeSpeechSystem : SharedMeleeSpeechSystem
|
||||
{
|
||||
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<MeleeSpeechComponent, MeleeSpeechBattlecryChangedMessage>(OnBattlecryChanged);
|
||||
}
|
||||
|
||||
|
||||
private void OnBattlecryChanged(EntityUid uid, MeleeSpeechComponent comp, MeleeSpeechBattlecryChangedMessage args)
|
||||
{
|
||||
|
||||
if (!TryComp<MeleeSpeechComponent>(uid, out var meleeSpeechUser))
|
||||
return;
|
||||
|
||||
TryChangeBattlecry(uid, args.Battlecry, meleeSpeechUser);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to change the battlecry of an entity.
|
||||
/// Returns true/false.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If provided with a player's EntityUid to the player parameter, adds the change to the admin logs.
|
||||
/// </remarks>
|
||||
public bool TryChangeBattlecry(EntityUid uid, string? battlecry, MeleeSpeechComponent? meleeSpeechComp = null)
|
||||
{
|
||||
|
||||
if (!Resolve(uid, ref meleeSpeechComp))
|
||||
return false;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(battlecry))
|
||||
{
|
||||
battlecry = battlecry.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
battlecry = null;
|
||||
}
|
||||
|
||||
if (meleeSpeechComp.Battlecry == battlecry)
|
||||
|
||||
return true;
|
||||
meleeSpeechComp.Battlecry = battlecry;
|
||||
Dirty(meleeSpeechComp);
|
||||
|
||||
_adminLogger.Add(LogType.ItemConfigure, LogImpact.Medium, $" {ToPrettyString(uid):entity}'s battlecry has been changed to {battlecry}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user