Files
tbd-station-14/Content.Shared/Hands/Components/HandVirtualItemComponent.cs
mirrorcult 62f6c8dd8e Wieldable/two-handed weapons (#4554)
* wielding kinda works

* rough out all the edges, wielding works nicely

* popups + loc

* increase damage & extra damage against whitelist

* small fixes

* forgot to actually do that

* reviews

* reviews + thing

* use resistances and not extradamageagainstwhitelist

* slashy

* make increasedamageonwield and melee hit events work with modifiersets

* Silly individual
2021-09-17 07:16:11 -07:00

54 lines
1.5 KiB
C#

using System;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
namespace Content.Shared.Hands.Components
{
[RegisterComponent]
[NetworkedComponent]
public sealed class HandVirtualItemComponent : Component
{
private EntityUid _blockingEntity;
public override string Name => "HandVirtualItem";
/// <summary>
/// The entity blocking this hand.
/// </summary>
public EntityUid BlockingEntity
{
get => _blockingEntity;
set
{
_blockingEntity = value;
Dirty();
}
}
public override ComponentState GetComponentState(ICommonSession player)
{
return new VirtualItemComponentState(BlockingEntity);
}
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
if (curState is not VirtualItemComponentState pullState)
return;
_blockingEntity = pullState.BlockingEntity;
}
[Serializable, NetSerializable]
public sealed class VirtualItemComponentState : ComponentState
{
public readonly EntityUid BlockingEntity;
public VirtualItemComponentState(EntityUid blockingEntity)
{
BlockingEntity = blockingEntity;
}
}
}
}