Add backgammon and board game crate (#5884)
* [ADD] backgammon, made pieces generic * [ADD] board game crate * [REMOVE] minor whitespace * Fix BOM * [CHANGE] feedback changes, condensed backgammon setup * [CHANGE] swapped backgammon y positions to correct ones Co-authored-by: fishfish458 <fishfish458> Co-authored-by: Visne <39844191+Visne@users.noreply.github.com>
71
Content.Server/Tabletop/TabletopBackgammonSetup.cs
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
|
namespace Content.Server.Tabletop
|
||||||
|
{
|
||||||
|
[UsedImplicitly]
|
||||||
|
public class TabletopBackgammonSetup : TabletopSetup
|
||||||
|
{
|
||||||
|
[DataField("boardPrototype")]
|
||||||
|
public string BackgammonBoardPrototype { get; } = "BackgammonBoardTabletop";
|
||||||
|
|
||||||
|
[DataField("whitePiecePrototype")]
|
||||||
|
public string WhitePiecePrototype { get; } = "WhiteTabletopPiece";
|
||||||
|
|
||||||
|
[DataField("blackPiecePrototype")]
|
||||||
|
public string BlackPiecePrototype { get; } = "BlackTabletopPiece";
|
||||||
|
public override void SetupTabletop(TabletopSession session, IEntityManager entityManager)
|
||||||
|
{
|
||||||
|
var board = entityManager.SpawnEntity(BackgammonBoardPrototype, session.Position);
|
||||||
|
|
||||||
|
const float borderLengthX = 7.35f; //BORDER
|
||||||
|
const float borderLengthY = 5.60f; //BORDER
|
||||||
|
|
||||||
|
const float boardDistanceX = 1.25f;
|
||||||
|
const float pieceDistanceY = 0.80f;
|
||||||
|
|
||||||
|
float getXPosition(float distanceFromSide, bool isLeftSide)
|
||||||
|
{
|
||||||
|
var pos = borderLengthX - (distanceFromSide * boardDistanceX);
|
||||||
|
return isLeftSide ? -pos : pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
float getYPosition(float positionNumber, bool isTop)
|
||||||
|
{
|
||||||
|
var pos = borderLengthY - (pieceDistanceY * positionNumber);
|
||||||
|
return isTop ? pos : -pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addPieces(
|
||||||
|
float distanceFromSide,
|
||||||
|
int numberOfPieces,
|
||||||
|
bool isBlackPiece,
|
||||||
|
bool isTop,
|
||||||
|
bool isLeftSide)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < numberOfPieces; i++)
|
||||||
|
{
|
||||||
|
session.Entities.Add(entityManager.SpawnEntity(isBlackPiece ? BlackPiecePrototype : WhitePiecePrototype, session.Position.Offset(getXPosition(distanceFromSide, isLeftSide), getYPosition(i, isTop))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Top left
|
||||||
|
addPieces(0, 5, true, true, true);
|
||||||
|
// top middle left
|
||||||
|
addPieces(4, 3, false, true, true);
|
||||||
|
// top middle right
|
||||||
|
addPieces(5, 5, false, true, false);
|
||||||
|
// top far right
|
||||||
|
addPieces(0, 2, true, true, false);
|
||||||
|
// bottom left
|
||||||
|
addPieces(0, 5, false, false, true);
|
||||||
|
// bottom middle left
|
||||||
|
addPieces(4, 3, true, false, true);
|
||||||
|
// bottom middle right
|
||||||
|
addPieces(5, 5, true, false, false);
|
||||||
|
// bottom far right
|
||||||
|
addPieces(0, 2, false, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,16 +11,16 @@ namespace Content.Server.Tabletop
|
|||||||
public string ParchisBoardPrototype { get; } = "ParchisBoardTabletop";
|
public string ParchisBoardPrototype { get; } = "ParchisBoardTabletop";
|
||||||
|
|
||||||
[DataField("redPiecePrototype")]
|
[DataField("redPiecePrototype")]
|
||||||
public string RedPiecePrototype { get; } = "RedParchisPiece";
|
public string RedPiecePrototype { get; } = "RedTabletopPiece";
|
||||||
|
|
||||||
[DataField("greenPiecePrototype")]
|
[DataField("greenPiecePrototype")]
|
||||||
public string GreenPiecePrototype { get; } = "GreenParchisPiece";
|
public string GreenPiecePrototype { get; } = "GreenTabletopPiece";
|
||||||
|
|
||||||
[DataField("yellowPiecePrototype")]
|
[DataField("yellowPiecePrototype")]
|
||||||
public string YellowPiecePrototype { get; } = "YellowParchisPiece";
|
public string YellowPiecePrototype { get; } = "YellowTabletopPiece";
|
||||||
|
|
||||||
[DataField("bluePiecePrototype")]
|
[DataField("bluePiecePrototype")]
|
||||||
public string BluePiecePrototype { get; } = "BlueParchisPiece";
|
public string BluePiecePrototype { get; } = "BlueTabletopPiece";
|
||||||
|
|
||||||
public override void SetupTabletop(TabletopSession session, IEntityManager entityManager)
|
public override void SetupTabletop(TabletopSession session, IEntityManager entityManager)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,3 +8,6 @@ tabletop-chess-flip = Flip
|
|||||||
|
|
||||||
## Parchís
|
## Parchís
|
||||||
tabletop-parchis-board-name = Parchís
|
tabletop-parchis-board-name = Parchís
|
||||||
|
|
||||||
|
## Backgammon
|
||||||
|
tabletop-backgammon-board-name = Backgammon
|
||||||
|
|||||||
@@ -33,3 +33,15 @@
|
|||||||
cost: 5000
|
cost: 5000
|
||||||
category: Fun
|
category: Fun
|
||||||
group: market
|
group: market
|
||||||
|
|
||||||
|
- type: cargoProduct
|
||||||
|
name: "board game crate"
|
||||||
|
id: FunBoardGames
|
||||||
|
description: "Game nights have been proven to either decrease boredom or increase murderous rage depending on the game"
|
||||||
|
icon:
|
||||||
|
sprite: Objects/Fun/dice.rsi
|
||||||
|
state: d66
|
||||||
|
product: CrateFunBoardGames
|
||||||
|
cost: 1500
|
||||||
|
category: Fun
|
||||||
|
group: market
|
||||||
|
|||||||
@@ -68,3 +68,19 @@
|
|||||||
amount: 1
|
amount: 1
|
||||||
- id: CrayonWhite
|
- id: CrayonWhite
|
||||||
amount: 1
|
amount: 1
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: CrateFunBoardGames
|
||||||
|
name: board game crate
|
||||||
|
parent: CrateGenericSteel
|
||||||
|
components:
|
||||||
|
- type: StorageFill
|
||||||
|
contents:
|
||||||
|
- id: ChessBoard
|
||||||
|
amount: 1
|
||||||
|
- id: BackgammonBoard
|
||||||
|
amount: 1
|
||||||
|
- id: ParchisBoard
|
||||||
|
amount: 1
|
||||||
|
- id: d6Dice
|
||||||
|
amount: 4
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
- type: entity
|
||||||
|
parent: BaseItem
|
||||||
|
id: BackgammonBoard
|
||||||
|
name: backgammon board
|
||||||
|
description: Old fashioned game of dice and pieces.
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Objects/Fun/Tabletop/backgammon.rsi
|
||||||
|
state: board
|
||||||
|
- type: TabletopGame
|
||||||
|
boardName: tabletop-backgammon-board-name
|
||||||
|
size: 550, 410
|
||||||
|
setup:
|
||||||
|
!type:TabletopBackgammonSetup
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: BackgammonBoardTabletop
|
||||||
|
name: backgammon
|
||||||
|
abstract: true
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Objects/Fun/Tabletop/backgammon_tabletop.rsi
|
||||||
|
state: backgammonBoard
|
||||||
|
noRot: false
|
||||||
|
drawdepth: FloorTiles
|
||||||
@@ -26,49 +26,3 @@
|
|||||||
noRot: false
|
noRot: false
|
||||||
drawdepth: FloorTiles
|
drawdepth: FloorTiles
|
||||||
|
|
||||||
# Parchís pieces
|
|
||||||
- type: entity
|
|
||||||
id: BaseParchisPiece
|
|
||||||
parent: BaseItem
|
|
||||||
abstract: true
|
|
||||||
components:
|
|
||||||
- type: TabletopDraggable
|
|
||||||
- type: Sprite
|
|
||||||
netsync: false
|
|
||||||
noRot: true
|
|
||||||
sprite: Objects/Fun/Tabletop/parchis_pieces.rsi
|
|
||||||
- type: Appearance
|
|
||||||
visuals:
|
|
||||||
- type: TabletopItemVisualizer
|
|
||||||
|
|
||||||
- type: entity
|
|
||||||
id: RedParchisPiece
|
|
||||||
name: red piece
|
|
||||||
parent: BaseParchisPiece
|
|
||||||
components:
|
|
||||||
- type: Sprite
|
|
||||||
state: red
|
|
||||||
|
|
||||||
- type: entity
|
|
||||||
id: GreenParchisPiece
|
|
||||||
name: green piece
|
|
||||||
parent: BaseParchisPiece
|
|
||||||
components:
|
|
||||||
- type: Sprite
|
|
||||||
state: green
|
|
||||||
|
|
||||||
- type: entity
|
|
||||||
id: YellowParchisPiece
|
|
||||||
name: yellow piece
|
|
||||||
parent: BaseParchisPiece
|
|
||||||
components:
|
|
||||||
- type: Sprite
|
|
||||||
state: yellow
|
|
||||||
|
|
||||||
- type: entity
|
|
||||||
id: BlueParchisPiece
|
|
||||||
name: blue piece
|
|
||||||
parent: BaseParchisPiece
|
|
||||||
components:
|
|
||||||
- type: Sprite
|
|
||||||
state: blue
|
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
- type: entity
|
||||||
|
id: BaseTabletopPiece
|
||||||
|
parent: BaseItem
|
||||||
|
abstract: true
|
||||||
|
components:
|
||||||
|
- type: TabletopDraggable
|
||||||
|
- type: Sprite
|
||||||
|
netsync: false
|
||||||
|
noRot: true
|
||||||
|
sprite: Objects/Fun/Tabletop/generic_pieces.rsi
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: TabletopItemVisualizer
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: RedTabletopPiece
|
||||||
|
name: red piece
|
||||||
|
parent: BaseTabletopPiece
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
state: red
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: GreenTabletopPiece
|
||||||
|
name: green piece
|
||||||
|
parent: BaseTabletopPiece
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
state: green
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: YellowTabletopPiece
|
||||||
|
name: yellow piece
|
||||||
|
parent: BaseTabletopPiece
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
state: yellow
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: BlueTabletopPiece
|
||||||
|
name: blue piece
|
||||||
|
parent: BaseTabletopPiece
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
state: blue
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: WhiteTabletopPiece
|
||||||
|
name: white piece
|
||||||
|
parent: BaseTabletopPiece
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
state: white
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: BlackTabletopPiece
|
||||||
|
name: black piece
|
||||||
|
parent: BaseTabletopPiece
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
state: black
|
||||||
@@ -292,6 +292,7 @@
|
|||||||
- FunPlushies
|
- FunPlushies
|
||||||
- FunArtSupplies
|
- FunArtSupplies
|
||||||
- FunInstruments
|
- FunInstruments
|
||||||
|
- FunBoardGames
|
||||||
- MaterialSteel
|
- MaterialSteel
|
||||||
- MaterialGlass
|
- MaterialGlass
|
||||||
- MaterialPlastic
|
- MaterialPlastic
|
||||||
|
|||||||
BIN
Resources/Textures/Objects/Fun/Tabletop/backgammon.rsi/board.png
Normal file
|
After Width: | Height: | Size: 671 B |
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"license": "CC-BY-SA-3.0",
|
||||||
|
"copyright": "Fishfish458",
|
||||||
|
"size": {
|
||||||
|
"x": 23,
|
||||||
|
"y": 16
|
||||||
|
},
|
||||||
|
"states": [
|
||||||
|
{
|
||||||
|
"name": "board"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 9.7 KiB |
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"license": "CC-BY-SA-3.0",
|
||||||
|
"copyright": "Fishfish458",
|
||||||
|
"size": {
|
||||||
|
"x": 550,
|
||||||
|
"y": 410
|
||||||
|
},
|
||||||
|
"states": [
|
||||||
|
{
|
||||||
|
"name": "backgammonBoard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 602 B |
|
Before Width: | Height: | Size: 215 B After Width: | Height: | Size: 215 B |
|
Before Width: | Height: | Size: 215 B After Width: | Height: | Size: 215 B |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"license": "CC-BY-SA-3.0",
|
"license": "CC-BY-SA-3.0",
|
||||||
"copyright": "Zumorica",
|
"copyright": "Zumorica, Fishfish458",
|
||||||
"size": {
|
"size": {
|
||||||
"x": 24,
|
"x": 24,
|
||||||
"y": 24
|
"y": 24
|
||||||
@@ -18,6 +18,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "blue"
|
"name": "blue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "white"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "black"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 215 B After Width: | Height: | Size: 215 B |
|
After Width: | Height: | Size: 615 B |
|
Before Width: | Height: | Size: 215 B After Width: | Height: | Size: 215 B |