AutoCompState + ItemToggle fixes (#23422)
* AutoCompState + ItemToggle fixes Fix a lot of the comp states that are never actually networked and also cleaned up ItemToggle events a bunch. ItemToggle will still need some future work for lights and sounds. * Also catch these
This commit is contained in:
@@ -6,6 +6,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Item.ItemToggle.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
@@ -23,7 +24,7 @@ namespace Content.Shared.Weapons.Reflect;
|
||||
/// <summary>
|
||||
/// This handles reflecting projectiles and hitscan shots.
|
||||
/// </summary>
|
||||
public abstract class SharedReflectSystem : EntitySystem
|
||||
public sealed class ReflectSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly INetManager _netManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
@@ -41,13 +42,14 @@ public abstract class SharedReflectSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<ReflectComponent, ProjectileReflectAttemptEvent>(OnReflectCollide);
|
||||
SubscribeLocalEvent<ReflectComponent, HitScanReflectAttemptEvent>(OnReflectHitscan);
|
||||
SubscribeLocalEvent<ReflectUserComponent, ProjectileReflectAttemptEvent>(OnReflectUserCollide);
|
||||
SubscribeLocalEvent<ReflectUserComponent, HitScanReflectAttemptEvent>(OnReflectUserHitscan);
|
||||
|
||||
SubscribeLocalEvent<ReflectComponent, GotEquippedEvent>(OnReflectEquipped);
|
||||
SubscribeLocalEvent<ReflectComponent, GotUnequippedEvent>(OnReflectUnequipped);
|
||||
SubscribeLocalEvent<ReflectComponent, GotEquippedHandEvent>(OnReflectHandEquipped);
|
||||
SubscribeLocalEvent<ReflectComponent, GotUnequippedHandEvent>(OnReflectHandUnequipped);
|
||||
SubscribeLocalEvent<ReflectComponent, ItemToggledEvent>(OnToggleReflect);
|
||||
|
||||
SubscribeLocalEvent<ReflectUserComponent, ProjectileReflectAttemptEvent>(OnReflectUserCollide);
|
||||
SubscribeLocalEvent<ReflectUserComponent, HitScanReflectAttemptEvent>(OnReflectUserHitscan);
|
||||
}
|
||||
|
||||
private void OnReflectUserHitscan(EntityUid uid, ReflectUserComponent component, ref HitScanReflectAttemptEvent args)
|
||||
@@ -209,6 +211,12 @@ public abstract class SharedReflectSystem : EntitySystem
|
||||
RefreshReflectUser(args.User);
|
||||
}
|
||||
|
||||
private void OnToggleReflect(EntityUid uid, ReflectComponent comp, ref ItemToggledEvent args)
|
||||
{
|
||||
comp.Enabled = args.Activated;
|
||||
Dirty(uid, comp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes whether someone has reflection potential so we can raise directed events on them.
|
||||
/// </summary>
|
||||
Reference in New Issue
Block a user