Partial hand ECS (#5634)

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>
Co-authored-by: Paul <ritter.paul1@googlemail.com>
This commit is contained in:
Leon Friedrich
2022-01-05 17:53:08 +13:00
committed by GitHub
parent 03ad20758e
commit adbc4ee5b0
34 changed files with 781 additions and 963 deletions

View File

@@ -0,0 +1,23 @@
using Content.Shared.Hands;
using Robust.Shared.GameObjects;
namespace Content.Server.Weapon.Ranged
{
public sealed class RangedWeaponSysten : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ServerRangedWeaponComponent, HandSelectedEvent>(OnHandSelected);
}
private void OnHandSelected(EntityUid uid, ServerRangedWeaponComponent component, HandSelectedEvent args)
{
// Instead of dirtying on hand-select this component should probably by dirtied whenever it needs to be.
// I take no responsibility for this code. It was like this when I got here.
component.Dirty();
}
}
}

View File

@@ -28,7 +28,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.Weapon.Ranged
{
[RegisterComponent]
public sealed class ServerRangedWeaponComponent : SharedRangedWeaponComponent, IHandSelected
public sealed class ServerRangedWeaponComponent : SharedRangedWeaponComponent
{
[Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
@@ -195,11 +195,5 @@ namespace Content.Server.Weapon.Ranged
}
FireHandler?.Invoke(user, targetPos);
}
// Probably a better way to do this.
void IHandSelected.HandSelected(HandSelectedEventArgs eventArgs)
{
Dirty();
}
}
}