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
2023-05-23 11:12:30 -07:00
|
|
|
using Content.Server.Administration.Logs;
|
2023-08-26 15:26:28 -06:00
|
|
|
using Content.Shared.Actions;
|
2023-09-08 18:16:05 -07:00
|
|
|
using Content.Shared.Database;
|
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
2023-05-23 11:12:30 -07:00
|
|
|
using Content.Shared.Speech.Components;
|
2023-05-30 10:57:53 -07:00
|
|
|
using Content.Shared.Speech.EntitySystems;
|
2023-08-26 15:26:28 -06:00
|
|
|
using Robust.Server.GameObjects;
|
2023-10-29 04:21:02 +11:00
|
|
|
using Robust.Shared.Player;
|
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
2023-05-23 11:12:30 -07:00
|
|
|
|
|
|
|
|
namespace Content.Server.Speech.EntitySystems;
|
|
|
|
|
|
|
|
|
|
public sealed class MeleeSpeechSystem : SharedMeleeSpeechSystem
|
|
|
|
|
{
|
2023-08-26 15:26:28 -06:00
|
|
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
|
|
|
|
[Dependency] private readonly SharedActionsSystem _actionSystem = default!;
|
|
|
|
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
SubscribeLocalEvent<MeleeSpeechComponent, MeleeSpeechBattlecryChangedMessage>(OnBattlecryChanged);
|
|
|
|
|
SubscribeLocalEvent<MeleeSpeechComponent, MeleeSpeechConfigureActionEvent>(OnConfigureAction);
|
|
|
|
|
SubscribeLocalEvent<MeleeSpeechComponent, GetItemActionsEvent>(OnGetActions);
|
2023-09-08 18:16:05 -07:00
|
|
|
SubscribeLocalEvent<MeleeSpeechComponent, MapInitEvent>(OnComponentMapInit);
|
2023-08-26 15:26:28 -06:00
|
|
|
}
|
2023-09-08 18:16:05 -07:00
|
|
|
private void OnComponentMapInit(EntityUid uid, MeleeSpeechComponent component, MapInitEvent args)
|
2023-08-26 15:26:28 -06:00
|
|
|
{
|
2023-09-08 18:16:05 -07:00
|
|
|
_actionSystem.AddAction(uid, ref component.ConfigureActionEntity, component.ConfigureAction, uid);
|
2023-08-26 15:26:28 -06:00
|
|
|
}
|
|
|
|
|
private void OnGetActions(EntityUid uid, MeleeSpeechComponent component, GetItemActionsEvent args)
|
|
|
|
|
{
|
2023-09-08 18:16:05 -07:00
|
|
|
args.AddAction(ref component.ConfigureActionEntity, component.ConfigureAction);
|
2023-08-26 15:26:28 -06:00
|
|
|
}
|
|
|
|
|
private void OnBattlecryChanged(EntityUid uid, MeleeSpeechComponent comp, MeleeSpeechBattlecryChangedMessage args)
|
|
|
|
|
{
|
2023-05-30 10:57:53 -07:00
|
|
|
if (!TryComp<MeleeSpeechComponent>(uid, out var meleeSpeechUser))
|
2023-08-26 15:26:28 -06:00
|
|
|
return;
|
|
|
|
|
var battlecry = args.Battlecry;
|
2023-05-30 10:57:53 -07:00
|
|
|
if (battlecry.Length > comp.MaxBattlecryLength)
|
|
|
|
|
battlecry = battlecry[..comp.MaxBattlecryLength];
|
|
|
|
|
TryChangeBattlecry(uid, battlecry, meleeSpeechUser);
|
2023-08-26 15:26:28 -06:00
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Attempts to open the Battlecry UI.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void OnConfigureAction(EntityUid uid, MeleeSpeechComponent comp, MeleeSpeechConfigureActionEvent args)
|
|
|
|
|
{
|
|
|
|
|
TryOpenUi(args.Performer, uid, comp);
|
|
|
|
|
}
|
|
|
|
|
public void TryOpenUi(EntityUid user, EntityUid source, MeleeSpeechComponent? component = null)
|
|
|
|
|
{
|
|
|
|
|
if (!Resolve(source, ref component))
|
|
|
|
|
return;
|
|
|
|
|
if (!TryComp<ActorComponent>(user, out var actor))
|
|
|
|
|
return;
|
|
|
|
|
_uiSystem.TryToggleUi(source, MeleeSpeechUiKey.Key, actor.PlayerSession);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Attempts to change the battlecry of an entity.
|
|
|
|
|
/// Returns true/false.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Logs changes to an entity's battlecry
|
|
|
|
|
/// </remarks>
|
|
|
|
|
public bool TryChangeBattlecry(EntityUid uid, string? battlecry, MeleeSpeechComponent? meleeSpeechComp = null)
|
|
|
|
|
{
|
2023-05-30 10:57:53 -07:00
|
|
|
if (!Resolve(uid, ref meleeSpeechComp))
|
2023-08-26 15:26:28 -06:00
|
|
|
return false;
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(battlecry))
|
|
|
|
|
{
|
|
|
|
|
battlecry = battlecry.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
battlecry = null;
|
|
|
|
|
}
|
|
|
|
|
if (meleeSpeechComp.Battlecry == battlecry)
|
|
|
|
|
return true;
|
|
|
|
|
meleeSpeechComp.Battlecry = battlecry;
|
|
|
|
|
Dirty(uid, meleeSpeechComp);
|
|
|
|
|
_adminLogger.Add(LogType.ItemConfigure, LogImpact.Medium, $" {ToPrettyString(uid):entity}'s battlecry has been changed to {battlecry}");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
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
2023-05-23 11:12:30 -07:00
|
|
|
}
|