ninja hotfixes (#20032)

* check that slot is power cell slot

* add BatteryChangedEvent

* use BatteryChangedEvent when enabling gloves and replacing battery

* sort gloves dependencies

* increase stun duration and cooldown

* play sound when stunning people

* remove dirty for non networked field

* NinjaBatteryChangedEvent

* real

* fake

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-09-12 21:54:18 +01:00
committed by GitHub
parent ef869b1cff
commit b53e5d6661
6 changed files with 58 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
using Content.Server.Communications;
using Content.Server.DoAfter;
using Content.Server.Mind;
using Content.Server.Ninja.Systems;
using Content.Server.Ninja.Events;
using Content.Server.Power.Components;
using Content.Server.Roles;
using Content.Shared.Communications;
@@ -22,11 +22,10 @@ namespace Content.Server.Ninja.Systems;
public sealed class NinjaGlovesSystem : SharedNinjaGlovesSystem
{
[Dependency] private readonly EmagProviderSystem _emagProvider = default!;
[Dependency] private readonly SharedBatteryDrainerSystem _drainer = default!;
[Dependency] private readonly SharedStunProviderSystem _stunProvider = default!;
[Dependency] private readonly SpaceNinjaSystem _ninja = default!;
[Dependency] private readonly CommsHackerSystem _commsHacker = default!;
[Dependency] private readonly MindSystem _mind = default!;
[Dependency] private readonly SharedStunProviderSystem _stunProvider = default!;
[Dependency] private readonly SpaceNinjaSystem _ninja = default!;
public override void Initialize()
{
@@ -73,6 +72,10 @@ public sealed class NinjaGlovesSystem : SharedNinjaGlovesSystem
private void EnableGloves(EntityUid uid, NinjaGlovesComponent comp, EntityUid user, SpaceNinjaComponent ninja)
{
// can't use abilities if suit is not equipped, this is checked elsewhere but just making sure to satisfy nullability
if (ninja.Suit == null)
return;
comp.User = user;
Dirty(uid, comp);
_ninja.AssignGloves(user, uid, ninja);
@@ -82,8 +85,8 @@ public sealed class NinjaGlovesSystem : SharedNinjaGlovesSystem
_stunProvider.SetNoPowerPopup(user, "ninja-no-power", stun);
if (_ninja.GetNinjaBattery(user, out var battery, out var _))
{
_drainer.SetBattery(user, battery, drainer);
_stunProvider.SetBattery(user, battery, stun);
var ev = new NinjaBatteryChangedEvent(battery.Value, ninja.Suit.Value);
RaiseLocalEvent(user, ref ev);
}
var emag = EnsureComp<EmagProviderComponent>(user);