Refactor drag and drop to use a shared interface (#2012)

* WIP in progress hours

* Cleanup

* Fix bugle

* Fix nullable error

* Merge fixes

* Merge fixes

* Merge fixes
This commit is contained in:
DrSmugleaf
2020-10-14 15:24:07 +02:00
committed by GitHub
parent f715eed63c
commit cdedaeb12e
37 changed files with 527 additions and 377 deletions

View File

@@ -9,11 +9,27 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
[ComponentReference(typeof(SharedPlaceableSurfaceComponent))]
public class PlaceableSurfaceComponent : SharedPlaceableSurfaceComponent, IInteractUsing
{
private bool _isPlaceable;
[ViewVariables(VVAccess.ReadWrite)]
public bool IsPlaceable { get => _isPlaceable; set => _isPlaceable = value; }
public override bool IsPlaceable
{
get => _isPlaceable;
set
{
if (_isPlaceable == value)
{
return;
}
_isPlaceable = value;
Dirty();
}
}
[ViewVariables]
int IInteractUsing.Priority => 1;
@@ -25,6 +41,10 @@ namespace Content.Server.GameObjects.Components
serializer.DataField(ref _isPlaceable, "IsPlaceable", true);
}
public override ComponentState GetComponentState()
{
return new PlaceableSurfaceComponentState(_isPlaceable);
}
public async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs)
{