Admin ghosts can now interact with stuff (#4178)

* Ghosts now have a bool for interacting with stuff

* Wrong ghost

* Simping for Swept

* Merge cleanup

* IT'S ODNE

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Swept
2021-08-22 20:14:52 -07:00
committed by GitHub
parent 007cd32667
commit 49b81b2587
9 changed files with 80 additions and 68 deletions

View File

@@ -15,17 +15,43 @@ namespace Content.Shared.Ghost
{
public override string Name => "Ghost";
[ViewVariables(VVAccess.ReadWrite)]
public bool CanGhostInteract
{
get => _canGhostInteract;
set
{
if (_canGhostInteract == value) return;
_canGhostInteract = value;
Dirty();
}
}
[DataField("canInteract")]
private bool _canGhostInteract;
/// <summary>
/// Changed by <see cref="SharedGhostSystem.SetCanReturnToBody"/>
/// </summary>
// TODO MIRROR change this to use friend classes when thats merged
[DataField("canReturnToBody")]
[ViewVariables(VVAccess.ReadWrite)]
public bool CanReturnToBody { get; set; }
public bool CanReturnToBody
{
get => _canReturnToBody;
set
{
if (_canReturnToBody == value) return;
_canReturnToBody = value;
Dirty();
}
}
[DataField("canReturnToBody")]
private bool _canReturnToBody;
public override ComponentState GetComponentState(ICommonSession player)
{
return new GhostComponentState(CanReturnToBody);
return new GhostComponentState(CanReturnToBody, CanGhostInteract);
}
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
@@ -38,13 +64,14 @@ namespace Content.Shared.Ghost
}
CanReturnToBody = state.CanReturnToBody;
CanGhostInteract = state.CanGhostInteract;
}
public bool CanInteract() => false;
public bool CanUse() => false;
public bool CanInteract() => CanGhostInteract;
public bool CanUse() => CanGhostInteract;
public bool CanThrow() => false;
public bool CanDrop() => false;
public bool CanPickup() => false;
public bool CanDrop() => CanGhostInteract;
public bool CanPickup() => CanGhostInteract;
public bool CanEmote() => false;
public bool CanAttack() => false;
}
@@ -53,19 +80,14 @@ namespace Content.Shared.Ghost
public class GhostComponentState : ComponentState
{
public bool CanReturnToBody { get; }
public HashSet<string>? LocationWarps { get; }
public Dictionary<EntityUid, string>? PlayerWarps { get; }
public bool CanGhostInteract { get; }
public GhostComponentState(
bool canReturnToBody,
HashSet<string>? locationWarps = null,
Dictionary<EntityUid, string>? playerWarps = null)
bool canGhostInteract)
{
CanReturnToBody = canReturnToBody;
LocationWarps = locationWarps;
PlayerWarps = playerWarps;
CanGhostInteract = canGhostInteract;
}
}
}