From 5394ab7765221978f8af31a33d7cb5b4f6ff8b00 Mon Sep 17 00:00:00 2001 From: austin Date: Tue, 15 Apr 2025 15:55:02 -0400 Subject: [PATCH] furniture data scaffolding --- docs/src/progress/renderertodo.md | 1 + .../game/data/common/CommonEntityType.java | 14 +++++- .../game/data/grident/GridAlignedData.java | 47 +++++++++++++++++++ .../electrosphere/game/data/item/Item.java | 4 +- 4 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 src/main/java/electrosphere/game/data/grident/GridAlignedData.java diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index e268c23e..2881bcd1 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1486,6 +1486,7 @@ Cull unused assets Update default texture Sound effect on swinging fists/weapons Queue loading audio file on creating virtual spatial source +Scaffold grid alignment data for entities diff --git a/src/main/java/electrosphere/game/data/common/CommonEntityType.java b/src/main/java/electrosphere/game/data/common/CommonEntityType.java index 33670628..3b602ab2 100644 --- a/src/main/java/electrosphere/game/data/common/CommonEntityType.java +++ b/src/main/java/electrosphere/game/data/common/CommonEntityType.java @@ -23,6 +23,7 @@ import electrosphere.game.data.creature.type.rotator.RotatorSystem; import electrosphere.game.data.foliage.type.AmbientAudio; import electrosphere.game.data.foliage.type.GrowthModel; import electrosphere.game.data.graphics.GraphicsTemplate; +import electrosphere.game.data.grident.GridAlignedData; import electrosphere.game.data.particle.ParticleEmitter; /** @@ -150,6 +151,11 @@ public class CommonEntityType { */ InteractionData buttonInteraction; + /** + * Data for grid alignment + */ + GridAlignedData gridAlignedData; + /** * Gets the id for this creature type * @return The id @@ -390,7 +396,13 @@ public class CommonEntityType { this.buttonInteraction = interaction; } - + /** + * Gets the grid aligned data + * @return The grid aligned data + */ + public GridAlignedData getGridAlignedData() { + return gridAlignedData; + } } diff --git a/src/main/java/electrosphere/game/data/grident/GridAlignedData.java b/src/main/java/electrosphere/game/data/grident/GridAlignedData.java new file mode 100644 index 00000000..5b3ad8f0 --- /dev/null +++ b/src/main/java/electrosphere/game/data/grident/GridAlignedData.java @@ -0,0 +1,47 @@ +package electrosphere.game.data.grident; + +/** + * Data for aligning this entity with the block grid + */ +public class GridAlignedData { + + /** + * The width in blocks to occupy on the block grid + */ + int width; + + /** + * The length in blocks to occupy on the block grid + */ + int length; + + /** + * The height in blocks to occupy on the block grid + */ + int height; + + /** + * Gets the height in blocks to occupy on the block grid + * @return The height in blocks to occupy on the block grid + */ + public int getWidth() { + return width; + } + + /** + * Gets the length in blocks to occupy on the block grid + * @return The length in blocks to occupy on the block grid + */ + public int getLength() { + return length; + } + + /** + * Gets the width in blocks to occupy on the block grid + * @return The width in blocks to occupy on the block grid + */ + public int getHeight() { + return height; + } + +} diff --git a/src/main/java/electrosphere/game/data/item/Item.java b/src/main/java/electrosphere/game/data/item/Item.java index 0c549b22..0aed8a98 100644 --- a/src/main/java/electrosphere/game/data/item/Item.java +++ b/src/main/java/electrosphere/game/data/item/Item.java @@ -84,7 +84,7 @@ public class Item extends CommonEntityType { Item rVal = new Item(); - rVal.setId(objectData.getId()); + rVal.setId("spawn:" + objectData.getId()); if(description.getItemIcon() != null){ @@ -118,7 +118,7 @@ public class Item extends CommonEntityType { */ public static Item createBlockItem(BlockType blockType){ Item rVal = new Item(); - rVal.setId(blockType.getName()); + rVal.setId("block:" + blockType.getName()); if(blockType.getTexture() != null){