Files
OldThink/Content.Shared/Tabletop/SharedTabletopSystem.cs

122 lines
5.2 KiB
C#
Raw Normal View History

using Content.Shared.ActionBlocker;
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
2022-04-28 19:57:51 +12:00
using Content.Shared.Tabletop.Components;
using Content.Shared.Tabletop.Events;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
using Robust.Shared.Network;
using Robust.Shared.Players;
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
using Robust.Shared.Serialization;
2022-04-28 19:57:51 +12:00
using System.Diagnostics.CodeAnalysis;
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
namespace Content.Shared.Tabletop
{
public abstract class SharedTabletopSystem : EntitySystem
{
[Dependency] protected readonly ActionBlockerSystem ActionBlockerSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedTransformSystem _transforms = default!;
[Dependency] private readonly IMapManager _mapMan = default!;
public override void Initialize()
{
SubscribeLocalEvent<TabletopDraggableComponent, ComponentGetState>(GetDraggableState);
SubscribeAllEvent<TabletopDraggingPlayerChangedEvent>(OnDraggingPlayerChanged);
SubscribeAllEvent<TabletopMoveEvent>(OnTabletopMove);
}
/// <summary>
/// Move an entity which is dragged by the user, but check if they are allowed to do so and to these coordinates
/// </summary>
protected virtual void OnTabletopMove(TabletopMoveEvent msg, EntitySessionEventArgs args)
{
if (args.SenderSession is not { AttachedEntity: { } playerEntity } playerSession)
return;
if (!CanSeeTable(playerEntity, msg.TableUid) || !CanDrag(playerEntity, msg.MovedEntityUid, out _))
return;
// Move the entity and dirty it (we use the map ID from the entity so noone can try to be funny and move the item to another map)
var transform = EntityManager.GetComponent<TransformComponent>(msg.MovedEntityUid);
_transforms.SetParent(msg.MovedEntityUid, transform, _mapMan.GetMapEntityId(transform.MapID));
_transforms.SetLocalPositionNoLerp(transform, msg.Coordinates.Position);
}
private void GetDraggableState(EntityUid uid, TabletopDraggableComponent component, ref ComponentGetState args)
{
args.State = new TabletopDraggableComponentState(component.DraggingPlayer);
}
private void OnDraggingPlayerChanged(TabletopDraggingPlayerChangedEvent msg, EntitySessionEventArgs args)
{
var dragged = msg.DraggedEntityUid;
if (!TryComp(dragged, out TabletopDraggableComponent? draggableComponent))
return;
draggableComponent.DraggingPlayer = msg.IsDragging ? args.SenderSession.UserId : null;
Dirty(draggableComponent);
if (!TryComp(dragged, out AppearanceComponent? appearance))
return;
if (draggableComponent.DraggingPlayer != null)
{
_appearance.SetData(dragged, TabletopItemVisuals.Scale, new Vector2(1.25f, 1.25f), appearance);
_appearance.SetData(dragged, TabletopItemVisuals.DrawDepth, (int) DrawDepth.DrawDepth.Items + 1, appearance);
}
else
{
_appearance.SetData(dragged, TabletopItemVisuals.Scale, Vector2.One, appearance);
_appearance.SetData(dragged, TabletopItemVisuals.DrawDepth, (int) DrawDepth.DrawDepth.Items, appearance);
}
}
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
[Serializable, NetSerializable]
public sealed class TabletopDraggableComponentState : ComponentState
{
public NetUserId? DraggingPlayer;
public TabletopDraggableComponentState(NetUserId? draggingPlayer)
{
DraggingPlayer = draggingPlayer;
}
}
#region Utility
/// <summary>
/// Whether the table exists, and the player can interact with it.
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
/// </summary>
/// <param name="playerEntity">The player entity to check.</param>
/// <param name="table">The table entity to check.</param>
2021-11-09 12:38:05 +01:00
protected bool CanSeeTable(EntityUid playerEntity, EntityUid? table)
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
{
2022-04-28 19:57:51 +12:00
// Table may have been deleted, hence TryComp
if (!TryComp(table, out MetaDataComponent? meta)
|| meta.EntityLifeStage >= EntityLifeStage.Terminating
|| (meta.Flags & MetaDataFlags.InContainer) == MetaDataFlags.InContainer)
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
{
return false;
}
return _interactionSystem.InRangeUnobstructed(playerEntity, table.Value) && ActionBlockerSystem.CanInteract(playerEntity, table);
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
}
2022-04-28 19:57:51 +12:00
protected bool CanDrag(EntityUid playerEntity, EntityUid target, [NotNullWhen(true)] out TabletopDraggableComponent? draggable)
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
{
2022-04-28 19:57:51 +12:00
if (!TryComp(target, out draggable))
return false;
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
2022-04-28 19:57:51 +12:00
// CanSeeTable checks interaction action blockers. So no need to check them here.
// If this ever changes, so that ghosts can spectate games, then the check needs to be moved here.
2022-04-28 19:57:51 +12:00
return TryComp(playerEntity, out SharedHandsComponent? hands) && hands.Hands.Count > 0;
Add chess (and mostly just tabletop backend stuff) (#4429) * Add draggable tabletop component * Use EntityCoordinates instead * Don't send coordinates every frame * Add chessboard + verb WIP * Add documentation, verb networking works now * Work so far Need PVS refactor before being able to continue Current code is broken * viewsubscriber magic * yes * Fix map creation * Add chess pieces, attempt prediction * Add chess sprites and yml * Clamping + other stuff * fix * stuff * StopDragging() StartDragging() * add piece grabbing * Refactor dragging player to seperate event * 🤣 Who did this 🤣💯👌 * 📮 sussy 📮 * Update chessboard sprite, scale piece while dragging * yes * ye * y * Close tabletop window when player dies * Make interaction check more sane * Fix funny behaviour when stunned * Add icon * Fix rsi * Make time passed check more accurate Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Use EyeManager.PixelsPerMeter Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Add missing import * Move viewport properties to XAML * Make shared system and component abstract * Use built in EntityManager * Use RaiseNetworkEvent instead of SendSystemNetworkMessage * Cache ViewSubscriberSystem * Move unnecessary code to prototype * Delete map on component shutdown instead of round restart * Make documentation match rest of codebase * Use ComponentManager instead of TryGetComponent * Use TryGetComponent instead of GetComponent * Add nullspace check to ClampPositionToViewport() * Set world pos instead of local pos * Improve server side verification * Use visualizer * Add netsync: false to sprites using visualizer * Close window when chessboard is picked up * Update to master * Fix bug when opening window while another is opened * Use ComponentManager * Use TryGetValue Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-09-13 11:58:44 +02:00
}
#endregion
}
}