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>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Tabletop.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Event to tell other clients that we are dragging this item. Necessery to handle multiple users
|
||||
/// trying to move a single item at the same time.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public class TabletopDraggingPlayerChangedEvent : EntityEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The UID of the entity being dragged.
|
||||
/// </summary>
|
||||
public EntityUid DraggedEntityUid;
|
||||
|
||||
/// <summary>
|
||||
/// The NetUserID of the player that is now dragging the item.
|
||||
/// </summary>
|
||||
public NetUserId? DraggingPlayer;
|
||||
|
||||
public TabletopDraggingPlayerChangedEvent(EntityUid draggedEntityUid, NetUserId? draggingPlayer)
|
||||
{
|
||||
DraggedEntityUid = draggedEntityUid;
|
||||
DraggingPlayer = draggingPlayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
38
Content.Shared/Tabletop/Events/TabletopMoveEvent.cs
Normal file
38
Content.Shared/Tabletop/Events/TabletopMoveEvent.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using Content.Shared.Tabletop.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Tabletop.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// An event that is sent to the server every so often by the client to tell where an entity with a
|
||||
/// <see cref="SharedTabletopDraggableComponent"/> has been moved.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public class TabletopMoveEvent : EntityEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The UID of the entity being moved.
|
||||
/// </summary>
|
||||
public EntityUid MovedEntityUid { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The new coordinates of the entity being moved.
|
||||
/// </summary>
|
||||
public MapCoordinates Coordinates { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The UID of the table the entity is being moved on.
|
||||
/// </summary>
|
||||
public EntityUid TableUid { get; }
|
||||
|
||||
public TabletopMoveEvent(EntityUid movedEntityUid, MapCoordinates coordinates, EntityUid tableUid)
|
||||
{
|
||||
MovedEntityUid = movedEntityUid;
|
||||
Coordinates = coordinates;
|
||||
TableUid = tableUid;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
Content.Shared/Tabletop/Events/TabletopPlayEvent.cs
Normal file
27
Content.Shared/Tabletop/Events/TabletopPlayEvent.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Tabletop.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// An event sent by the server to the client to tell the client to open a tabletop game window.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public class TabletopPlayEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid TableUid;
|
||||
public EntityUid CameraUid;
|
||||
public string Title;
|
||||
public Vector2i Size;
|
||||
|
||||
public TabletopPlayEvent(EntityUid tableUid, EntityUid cameraUid, string title, Vector2i size)
|
||||
{
|
||||
TableUid = tableUid;
|
||||
CameraUid = cameraUid;
|
||||
Title = title;
|
||||
Size = size;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Content.Shared/Tabletop/Events/TabletopStopPlayingEvent.cs
Normal file
23
Content.Shared/Tabletop/Events/TabletopStopPlayingEvent.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Tabletop.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// An event ot tell the server that we have stopped playing this tabletop game.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public class TabletopStopPlayingEvent : EntityEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The entity UID of the table associated with this tabletop game.
|
||||
/// </summary>
|
||||
public EntityUid TableUid;
|
||||
|
||||
public TabletopStopPlayingEvent(EntityUid tableUid)
|
||||
{
|
||||
TableUid = tableUid;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user