diff --git a/mods/dangerous_business/blocks/chain.json b/mods/dangerous_business/blocks/chain.json new file mode 100644 index 0000000..c9959eb --- /dev/null +++ b/mods/dangerous_business/blocks/chain.json @@ -0,0 +1,10 @@ +{ + "format_version": 1, + "block": { + "id": "dangerous_business:chain", + "textures": { "chain": "dangerous_business:iron_chain" }, + "model": "dangerous_business:chain", + "render_layer": "cutout", + "shape": [[6.5, 0, 6.5, 9.5, 16, 9.5]] + } +} diff --git a/mods/dangerous_business/blocks/deepslate_tile_wall.json b/mods/dangerous_business/blocks/deepslate_tile_wall.json new file mode 100644 index 0000000..a2ef90c --- /dev/null +++ b/mods/dangerous_business/blocks/deepslate_tile_wall.json @@ -0,0 +1,61 @@ +{ + "format_version": 1, + "block": { + "id": "dangerous_business:deepslate_tile_wall", + "textures": { + "wall": "dangerous_business:deepslate_tiles" + }, + "item_model": "dangerous_business:wall_inventory", + "states": [ + { + "name": "north", + "bits": 1, + "default": 0 + }, + { + "name": "east", + "bits": 1, + "default": 0 + }, + { + "name": "south", + "bits": 1, + "default": 0 + }, + { + "name": "west", + "bits": 1, + "default": 0 + } + ], + "parts": [ + { + "model": "dangerous_business:template_wall_post" + }, + { + "when": "north=1", + "model": "dangerous_business:template_wall_side" + }, + { + "when": "east=1", + "model": "dangerous_business:template_wall_side", + "y": 90 + }, + { + "when": "south=1", + "model": "dangerous_business:template_wall_side", + "y": 180 + }, + { + "when": "west=1", + "model": "dangerous_business:template_wall_side", + "y": 270 + } + ], + "components": { + "dangerous_business:connects": { + "solid": true + } + } + } +} diff --git a/mods/dangerous_business/blocks/iron_bars.json b/mods/dangerous_business/blocks/iron_bars.json new file mode 100644 index 0000000..123f38d --- /dev/null +++ b/mods/dangerous_business/blocks/iron_bars.json @@ -0,0 +1,81 @@ +{ + "format_version": 1, + "block": { + "id": "dangerous_business:iron_bars", + "textures": { + "pane": "dangerous_business:iron_bars", + "edge": "dangerous_business:iron_bars" + }, + "render_layer": "cutout", + "states": [ + { + "name": "north", + "bits": 1, + "default": 0 + }, + { + "name": "east", + "bits": 1, + "default": 0 + }, + { + "name": "south", + "bits": 1, + "default": 0 + }, + { + "name": "west", + "bits": 1, + "default": 0 + } + ], + "parts": [ + { + "model": "dangerous_business:template_glass_pane_post" + }, + { + "when": "north=1", + "model": "dangerous_business:template_glass_pane_side" + }, + { + "when": "north=0", + "model": "dangerous_business:template_glass_pane_noside" + }, + { + "when": "east=1", + "model": "dangerous_business:template_glass_pane_side", + "y": 90 + }, + { + "when": "east=0", + "model": "dangerous_business:template_glass_pane_noside", + "y": 90 + }, + { + "when": "south=1", + "model": "dangerous_business:template_glass_pane_side", + "y": 180 + }, + { + "when": "south=0", + "model": "dangerous_business:template_glass_pane_noside", + "y": 180 + }, + { + "when": "west=1", + "model": "dangerous_business:template_glass_pane_side", + "y": 270 + }, + { + "when": "west=0", + "model": "dangerous_business:template_glass_pane_noside", + "y": 270 + } + ], + "components": { + "dangerous_business:connects": { + "solid": true + } + } + } +} diff --git a/mods/dangerous_business/blocks/iron_block.json b/mods/dangerous_business/blocks/iron_block.json new file mode 100644 index 0000000..f035c6e --- /dev/null +++ b/mods/dangerous_business/blocks/iron_block.json @@ -0,0 +1,7 @@ +{ + "format_version": 1, + "block": { + "id": "dangerous_business:iron_block", + "textures": "dangerous_business:iron_block" + } +} diff --git a/mods/dangerous_business/blocks/polished_andesite.json b/mods/dangerous_business/blocks/polished_andesite.json new file mode 100644 index 0000000..dd3d8c1 --- /dev/null +++ b/mods/dangerous_business/blocks/polished_andesite.json @@ -0,0 +1,7 @@ +{ + "format_version": 1, + "block": { + "id": "dangerous_business:polished_andesite", + "textures": "dangerous_business:polished_andesite" + } +} diff --git a/mods/dangerous_business/blocks/purpur_stairs.json b/mods/dangerous_business/blocks/purpur_stairs.json new file mode 100644 index 0000000..e9fe35f --- /dev/null +++ b/mods/dangerous_business/blocks/purpur_stairs.json @@ -0,0 +1,57 @@ +{ + "format_version": 1, + "block": { + "id": "dangerous_business:purpur_stairs", + "textures": "dangerous_business:purpur_block", + "model": "dangerous_business:stairs", + "item_model": "dangerous_business:stairs", + "states": [ + { + "name": "facing", + "bits": 2, + "default": 0 + }, + { + "name": "half", + "bits": 1, + "default": 0 + } + ], + "variants": { + "facing=0": { + "y": 270, + "uvlock": true + }, + "facing=2": { + "y": 90, + "uvlock": true + }, + "facing=3": { + "y": 180, + "uvlock": true + }, + "half=1": { + "x": 180, + "uvlock": true, + "shape": [ + [ + 0, + 8, + 0, + 16, + 16, + 16 + ], + [ + 8, + 0, + 0, + 16, + 8, + 16 + ] + ] + } + } + } +} diff --git a/mods/dangerous_business/blocks/smooth_sandstone_stairs.json b/mods/dangerous_business/blocks/smooth_sandstone_stairs.json new file mode 100644 index 0000000..538f588 --- /dev/null +++ b/mods/dangerous_business/blocks/smooth_sandstone_stairs.json @@ -0,0 +1,57 @@ +{ + "format_version": 1, + "block": { + "id": "dangerous_business:smooth_sandstone_stairs", + "textures": "dangerous_business:smooth_sandstone", + "model": "dangerous_business:stairs", + "item_model": "dangerous_business:stairs", + "states": [ + { + "name": "facing", + "bits": 2, + "default": 0 + }, + { + "name": "half", + "bits": 1, + "default": 0 + } + ], + "variants": { + "facing=0": { + "y": 270, + "uvlock": true + }, + "facing=2": { + "y": 90, + "uvlock": true + }, + "facing=3": { + "y": 180, + "uvlock": true + }, + "half=1": { + "x": 180, + "uvlock": true, + "shape": [ + [ + 0, + 8, + 0, + 16, + 16, + 16 + ], + [ + 8, + 0, + 0, + 16, + 8, + 16 + ] + ] + } + } + } +} diff --git a/mods/dangerous_business/blocks/spruce_fence.json b/mods/dangerous_business/blocks/spruce_fence.json new file mode 100644 index 0000000..bf28318 --- /dev/null +++ b/mods/dangerous_business/blocks/spruce_fence.json @@ -0,0 +1,163 @@ +{ + "format_version": 1, + "block": { + "id": "dangerous_business:spruce_fence", + "textures": { + "side": "dangerous_business:spruce_fence_side", + "top": "dangerous_business:spruce_fence_side" + }, + "item_model": "dangerous_business:fence_inventory", + "render_layer": "cutout", + "states": [ + { + "name": "north", + "bits": 1, + "default": 0 + }, + { + "name": "east", + "bits": 1, + "default": 0 + }, + { + "name": "south", + "bits": 1, + "default": 0 + }, + { + "name": "west", + "bits": 1, + "default": 0 + } + ], + "parts": [ + { + "model": "dangerous_business:fence_post", + "shape": [ + [ + 6, + 0, + 6, + 10, + 16, + 10 + ] + ], + "collision_shape": [ + [ + 6, + 0, + 6, + 10, + 24, + 10 + ] + ] + }, + { + "when": "north=1", + "model": "dangerous_business:fence_side", + "shape": [ + [ + 7, + 0, + 0, + 9, + 16, + 9 + ] + ], + "collision_shape": [ + [ + 7, + 0, + 0, + 9, + 24, + 9 + ] + ] + }, + { + "when": "east=1", + "model": "dangerous_business:fence_side", + "shape": [ + [ + 7, + 0, + 0, + 9, + 16, + 9 + ] + ], + "collision_shape": [ + [ + 7, + 0, + 0, + 9, + 24, + 9 + ] + ], + "y": 90 + }, + { + "when": "south=1", + "model": "dangerous_business:fence_side", + "shape": [ + [ + 7, + 0, + 0, + 9, + 16, + 9 + ] + ], + "collision_shape": [ + [ + 7, + 0, + 0, + 9, + 24, + 9 + ] + ], + "y": 180 + }, + { + "when": "west=1", + "model": "dangerous_business:fence_side", + "shape": [ + [ + 7, + 0, + 0, + 9, + 16, + 9 + ] + ], + "collision_shape": [ + [ + 7, + 0, + 0, + 9, + 24, + 9 + ] + ], + "y": 270 + } + ], + "components": { + "dangerous_business:connects": { + "solid": true + } + } + } +} diff --git a/mods/dangerous_business/models/chain.json b/mods/dangerous_business/models/chain.json new file mode 100644 index 0000000..d2acd76 --- /dev/null +++ b/mods/dangerous_business/models/chain.json @@ -0,0 +1,28 @@ +{ + "format_version": 1, + "model": { + "id": "dangerous_business:chain", + "elements": [ + { + "from": [6.5, 0, 8], + "to": [9.5, 16, 8], + "rotation": { "origin": [8, 8, 8], "axis": "y", "angle": 45 }, + "shade": false, + "faces": { + "north": { "texture": "#chain", "uv": [3, 0, 0, 16] }, + "south": { "texture": "#chain", "uv": [0, 0, 3, 16] } + } + }, + { + "from": [8, 0, 6.5], + "to": [8, 16, 9.5], + "rotation": { "origin": [8, 8, 8], "axis": "y", "angle": 45 }, + "shade": false, + "faces": { + "east": { "texture": "#chain", "uv": [3, 0, 6, 16] }, + "west": { "texture": "#chain", "uv": [6, 0, 3, 16] } + } + } + ] + } +} diff --git a/mods/dangerous_business/models/fence_inventory.json b/mods/dangerous_business/models/fence_inventory.json new file mode 100644 index 0000000..5127e06 --- /dev/null +++ b/mods/dangerous_business/models/fence_inventory.json @@ -0,0 +1,280 @@ +{ + "format_version": 1, + "model": { + "id": "dangerous_business:fence_inventory", + "elements": [ + { + "from": [ + 6, + 0, + 0 + ], + "to": [ + 10, + 16, + 4 + ], + "faces": { + "north": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "south": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "east": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "west": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "top": { + "texture": "#top", + "uv": [ + 6, + 6, + 10, + 10 + ] + }, + "bottom": { + "texture": "#top", + "uv": [ + 6, + 6, + 10, + 10 + ] + } + } + }, + { + "from": [ + 6, + 0, + 12 + ], + "to": [ + 10, + 16, + 16 + ], + "faces": { + "north": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "south": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "east": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "west": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "top": { + "texture": "#top", + "uv": [ + 6, + 6, + 10, + 10 + ] + }, + "bottom": { + "texture": "#top", + "uv": [ + 6, + 6, + 10, + 10 + ] + } + } + }, + { + "from": [ + 7, + 12, + 0 + ], + "to": [ + 9, + 15, + 16 + ], + "faces": { + "north": { + "texture": "#side", + "uv": [ + 7, + 1, + 9, + 4 + ] + }, + "south": { + "texture": "#side", + "uv": [ + 7, + 1, + 9, + 4 + ] + }, + "east": { + "texture": "#side", + "uv": [ + 0, + 1, + 16, + 4 + ] + }, + "west": { + "texture": "#side", + "uv": [ + 0, + 1, + 16, + 4 + ] + }, + "top": { + "texture": "#top", + "uv": [ + 7, + 0, + 9, + 16 + ] + }, + "bottom": { + "texture": "#top", + "uv": [ + 7, + 0, + 9, + 16 + ] + } + } + }, + { + "from": [ + 7, + 6, + 0 + ], + "to": [ + 9, + 9, + 16 + ], + "faces": { + "north": { + "texture": "#side", + "uv": [ + 7, + 7, + 9, + 10 + ] + }, + "south": { + "texture": "#side", + "uv": [ + 7, + 7, + 9, + 10 + ] + }, + "east": { + "texture": "#side", + "uv": [ + 0, + 7, + 16, + 10 + ] + }, + "west": { + "texture": "#side", + "uv": [ + 0, + 7, + 16, + 10 + ] + }, + "top": { + "texture": "#top", + "uv": [ + 7, + 0, + 9, + 16 + ] + }, + "bottom": { + "texture": "#top", + "uv": [ + 7, + 0, + 9, + 16 + ] + } + } + } + ] + } +} diff --git a/mods/dangerous_business/models/fence_post.json b/mods/dangerous_business/models/fence_post.json new file mode 100644 index 0000000..ae30c1c --- /dev/null +++ b/mods/dangerous_business/models/fence_post.json @@ -0,0 +1,78 @@ +{ + "format_version": 1, + "model": { + "id": "dangerous_business:fence_post", + "elements": [ + { + "from": [ + 6, + 0, + 6 + ], + "to": [ + 10, + 16, + 10 + ], + "faces": { + "north": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "east": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "south": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "west": { + "texture": "#side", + "uv": [ + 6, + 0, + 10, + 16 + ] + }, + "top": { + "texture": "#top", + "uv": [ + 6, + 6, + 10, + 10 + ], + "cullface": "top" + }, + "bottom": { + "texture": "#top", + "uv": [ + 6, + 6, + 10, + 10 + ], + "cullface": "bottom" + } + } + } + ] + } +} diff --git a/mods/dangerous_business/models/fence_side.json b/mods/dangerous_business/models/fence_side.json new file mode 100644 index 0000000..8653010 --- /dev/null +++ b/mods/dangerous_business/models/fence_side.json @@ -0,0 +1,128 @@ +{ + "format_version": 1, + "model": { + "id": "dangerous_business:fence_side", + "elements": [ + { + "from": [ + 7, + 12, + 0 + ], + "to": [ + 9, + 15, + 9 + ], + "faces": { + "north": { + "texture": "#side", + "uv": [ + 7, + 1, + 9, + 4 + ], + "cullface": "north" + }, + "east": { + "texture": "#side", + "uv": [ + 7, + 1, + 16, + 4 + ] + }, + "west": { + "texture": "#side", + "uv": [ + 0, + 1, + 9, + 4 + ] + }, + "top": { + "texture": "#top", + "uv": [ + 7, + 0, + 9, + 9 + ] + }, + "bottom": { + "texture": "#top", + "uv": [ + 7, + 0, + 9, + 9 + ] + } + } + }, + { + "from": [ + 7, + 6, + 0 + ], + "to": [ + 9, + 9, + 9 + ], + "faces": { + "north": { + "texture": "#side", + "uv": [ + 7, + 7, + 9, + 10 + ], + "cullface": "north" + }, + "east": { + "texture": "#side", + "uv": [ + 7, + 7, + 16, + 10 + ] + }, + "west": { + "texture": "#side", + "uv": [ + 0, + 7, + 9, + 10 + ] + }, + "top": { + "texture": "#top", + "uv": [ + 7, + 0, + 9, + 9 + ] + }, + "bottom": { + "texture": "#top", + "uv": [ + 7, + 0, + 9, + 9 + ] + } + } + } + ] + } +} diff --git a/mods/dangerous_business/models/templates/stairs.json b/mods/dangerous_business/models/templates/stairs.json new file mode 100644 index 0000000..e646d75 --- /dev/null +++ b/mods/dangerous_business/models/templates/stairs.json @@ -0,0 +1,78 @@ +{ + "format_version": 1, + "model": { + "id": "dangerous_business:stairs", + "elements": [ + { + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 8, + 16 + ], + "faces": { + "bottom": { + "texture": "#bottom", + "cullface": "bottom" + }, + "top": { + "texture": "#top" + }, + "north": { + "texture": "#side", + "cullface": "north" + }, + "south": { + "texture": "#side", + "cullface": "south" + }, + "west": { + "texture": "#side", + "cullface": "west" + }, + "east": { + "texture": "#side", + "cullface": "east" + } + } + }, + { + "from": [ + 8, + 8, + 0 + ], + "to": [ + 16, + 16, + 16 + ], + "faces": { + "top": { + "texture": "#top", + "cullface": "top" + }, + "north": { + "texture": "#side", + "cullface": "north" + }, + "south": { + "texture": "#side", + "cullface": "south" + }, + "west": { + "texture": "#side" + }, + "east": { + "texture": "#side", + "cullface": "east" + } + } + } + ] + } +} diff --git a/mods/dangerous_business/models/templates/template_glass_pane_noside.json b/mods/dangerous_business/models/templates/template_glass_pane_noside.json new file mode 100644 index 0000000..2f76fc9 --- /dev/null +++ b/mods/dangerous_business/models/templates/template_glass_pane_noside.json @@ -0,0 +1,25 @@ +{ + "format_version": 1, + "model": { + "id": "dangerous_business:template_glass_pane_noside", + "elements": [ + { + "from": [ + 7, + 0, + 7 + ], + "to": [ + 9, + 16, + 9 + ], + "faces": { + "north": { + "texture": "#pane" + } + } + } + ] + } +} diff --git a/mods/dangerous_business/models/templates/template_glass_pane_post.json b/mods/dangerous_business/models/templates/template_glass_pane_post.json new file mode 100644 index 0000000..3a7419b --- /dev/null +++ b/mods/dangerous_business/models/templates/template_glass_pane_post.json @@ -0,0 +1,30 @@ +{ + "format_version": 1, + "model": { + "id": "dangerous_business:template_glass_pane_post", + "elements": [ + { + "from": [ + 7, + 0, + 7 + ], + "to": [ + 9, + 16, + 9 + ], + "faces": { + "bottom": { + "texture": "#edge", + "cullface": "bottom" + }, + "top": { + "texture": "#edge", + "cullface": "top" + } + } + } + ] + } +} diff --git a/mods/dangerous_business/models/templates/template_glass_pane_side.json b/mods/dangerous_business/models/templates/template_glass_pane_side.json new file mode 100644 index 0000000..9f16552 --- /dev/null +++ b/mods/dangerous_business/models/templates/template_glass_pane_side.json @@ -0,0 +1,40 @@ +{ + "format_version": 1, + "model": { + "id": "dangerous_business:template_glass_pane_side", + "elements": [ + { + "from": [ + 7, + 0, + 0 + ], + "to": [ + 9, + 16, + 7 + ], + "faces": { + "bottom": { + "texture": "#edge", + "cullface": "bottom" + }, + "top": { + "texture": "#edge", + "cullface": "top" + }, + "north": { + "texture": "#edge", + "cullface": "north" + }, + "west": { + "texture": "#pane" + }, + "east": { + "texture": "#pane" + } + } + } + ] + } +} diff --git a/mods/dangerous_business/models/templates/template_wall_post.json b/mods/dangerous_business/models/templates/template_wall_post.json new file mode 100644 index 0000000..266758c --- /dev/null +++ b/mods/dangerous_business/models/templates/template_wall_post.json @@ -0,0 +1,42 @@ +{ + "format_version": 1, + "model": { + "id": "dangerous_business:template_wall_post", + "elements": [ + { + "from": [ + 4, + 0, + 4 + ], + "to": [ + 12, + 16, + 12 + ], + "faces": { + "bottom": { + "texture": "#wall", + "cullface": "bottom" + }, + "top": { + "texture": "#wall", + "cullface": "top" + }, + "north": { + "texture": "#wall" + }, + "south": { + "texture": "#wall" + }, + "west": { + "texture": "#wall" + }, + "east": { + "texture": "#wall" + } + } + } + ] + } +} diff --git a/mods/dangerous_business/models/templates/template_wall_side.json b/mods/dangerous_business/models/templates/template_wall_side.json new file mode 100644 index 0000000..8d313da --- /dev/null +++ b/mods/dangerous_business/models/templates/template_wall_side.json @@ -0,0 +1,39 @@ +{ + "format_version": 1, + "model": { + "id": "dangerous_business:template_wall_side", + "elements": [ + { + "from": [ + 5, + 0, + 0 + ], + "to": [ + 11, + 14, + 8 + ], + "faces": { + "bottom": { + "texture": "#wall", + "cullface": "bottom" + }, + "top": { + "texture": "#wall" + }, + "north": { + "texture": "#wall", + "cullface": "north" + }, + "west": { + "texture": "#wall" + }, + "east": { + "texture": "#wall" + } + } + } + ] + } +} diff --git a/mods/dangerous_business/models/templates/wall_inventory.json b/mods/dangerous_business/models/templates/wall_inventory.json new file mode 100644 index 0000000..8bd484b --- /dev/null +++ b/mods/dangerous_business/models/templates/wall_inventory.json @@ -0,0 +1,76 @@ +{ + "format_version": 1, + "model": { + "id": "dangerous_business:wall_inventory", + "elements": [ + { + "from": [ + 4, + 0, + 4 + ], + "to": [ + 12, + 16, + 12 + ], + "faces": { + "bottom": { + "texture": "#wall", + "cullface": "bottom" + }, + "top": { + "texture": "#wall", + "cullface": "top" + }, + "north": { + "texture": "#wall" + }, + "south": { + "texture": "#wall" + }, + "west": { + "texture": "#wall" + }, + "east": { + "texture": "#wall" + } + } + }, + { + "from": [ + 5, + 0, + 0 + ], + "to": [ + 11, + 13, + 16 + ], + "faces": { + "bottom": { + "texture": "#wall" + }, + "top": { + "texture": "#wall" + }, + "north": { + "texture": "#wall", + "cullface": "north" + }, + "south": { + "texture": "#wall", + "cullface": "south" + }, + "west": { + "texture": "#wall" + }, + "east": { + "texture": "#wall" + } + } + } + ] + } +} diff --git a/mods/dangerous_business/schematics/ship.cbsm b/mods/dangerous_business/schematics/ship.cbsm deleted file mode 100644 index 8bbfab9..0000000 Binary files a/mods/dangerous_business/schematics/ship.cbsm and /dev/null differ diff --git a/mods/dangerous_business/scripts/shared.ts b/mods/dangerous_business/scripts/shared.ts index 4ca626e..475921f 100644 --- a/mods/dangerous_business/scripts/shared.ts +++ b/mods/dangerous_business/scripts/shared.ts @@ -1,4 +1,4 @@ -import type { SharedContext } from "cubi/shared"; +import type { Face, SharedContext } from "cubi/shared"; export const FACILITY_DOOR = "dangerous_business:facility_door"; export const DOOR = "dangerous_business:door"; @@ -41,26 +41,35 @@ function register_pipe(ctx: SharedContext) { } // sets its north, east, south and west states (and top, with "up") to 1 where the same block is beside it, so it can -// hide its edges there, like floor grates joining into one floor +// hide its edges there, like floor grates joining into one floor. with "solid" it joins the full sides of other blocks +// beside it too, like iron bars, fences and walls set into a wall +interface ConnectsParams { + up?: boolean; + solid?: boolean; +} + function register_connects(ctx: SharedContext) { - const sides = (id: string | undefined, x: number, y: number, z: number, up: boolean) => { + const sides = (id: string | undefined, x: number, y: number, z: number, params: ConnectsParams) => { const same = (dx: number, dy: number, dz: number) => ctx.world.get_block(x + dx, y + dy, z + dz) === id ? 1 : 0; + // the side of the block there that faces this one + const joins = (dx: number, dz: number, face: Face) => + same(dx, 0, dz) || (params.solid && ctx.world.is_face_sturdy(x + dx, y, z + dz, face)) ? 1 : 0; const states: Record = { - north: same(0, 0, -1), - east: same(1, 0, 0), - south: same(0, 0, 1), - west: same(-1, 0, 0), + north: joins(0, -1, "south"), + east: joins(1, 0, "west"), + south: joins(0, 1, "north"), + west: joins(-1, 0, "east"), }; - if (up) states.top = same(0, 1, 0); + if (params.up) states.top = same(0, 1, 0); return states; }; - ctx.components.register_block<{ up?: boolean }>("dangerous_business:connects", { + ctx.components.register_block("dangerous_business:connects", { // the block being placed is the item's state_for_placement: (placement, params) => - sides(placement.item, placement.x, placement.y, placement.z, params.up ?? false), + sides(placement.item, placement.x, placement.y, placement.z, params), on_neighbor_change(block, params) { const id = ctx.world.get_block(block.x, block.y, block.z); - for (const [state, value] of Object.entries(sides(id, block.x, block.y, block.z, params.up ?? false))) { + for (const [state, value] of Object.entries(sides(id, block.x, block.y, block.z, params))) { ctx.world.set_state(block.x, block.y, block.z, state, value); } }, diff --git a/mods/dangerous_business/textures/deepslate_tiles.png b/mods/dangerous_business/textures/deepslate_tiles.png new file mode 100644 index 0000000..43fe0f3 Binary files /dev/null and b/mods/dangerous_business/textures/deepslate_tiles.png differ diff --git a/mods/dangerous_business/textures/iron_bars.png b/mods/dangerous_business/textures/iron_bars.png new file mode 100644 index 0000000..f62db96 Binary files /dev/null and b/mods/dangerous_business/textures/iron_bars.png differ diff --git a/mods/dangerous_business/textures/iron_block.png b/mods/dangerous_business/textures/iron_block.png new file mode 100644 index 0000000..335e8a3 Binary files /dev/null and b/mods/dangerous_business/textures/iron_block.png differ diff --git a/mods/dangerous_business/textures/iron_chain.png b/mods/dangerous_business/textures/iron_chain.png new file mode 100644 index 0000000..69e9c90 Binary files /dev/null and b/mods/dangerous_business/textures/iron_chain.png differ diff --git a/mods/dangerous_business/textures/polished_andesite.png b/mods/dangerous_business/textures/polished_andesite.png new file mode 100644 index 0000000..f9bb2fd Binary files /dev/null and b/mods/dangerous_business/textures/polished_andesite.png differ diff --git a/mods/dangerous_business/textures/purpur_block.png b/mods/dangerous_business/textures/purpur_block.png new file mode 100644 index 0000000..fddf197 Binary files /dev/null and b/mods/dangerous_business/textures/purpur_block.png differ diff --git a/mods/dangerous_business/textures/smooth_sandstone.png b/mods/dangerous_business/textures/smooth_sandstone.png new file mode 100644 index 0000000..70e2bd4 Binary files /dev/null and b/mods/dangerous_business/textures/smooth_sandstone.png differ diff --git a/mods/dangerous_business/textures/spruce_fence_side.png b/mods/dangerous_business/textures/spruce_fence_side.png new file mode 100644 index 0000000..c02e158 Binary files /dev/null and b/mods/dangerous_business/textures/spruce_fence_side.png differ diff --git a/tests/dangerous_business_test.ts b/tests/dangerous_business_test.ts index 8dd2966..564ab28 100644 --- a/tests/dangerous_business_test.ts +++ b/tests/dangerous_business_test.ts @@ -92,6 +92,19 @@ Deno.test("a connecting block joins the same block beside it, and parts when it' assertEquals(state(0, 100, 0, "east"), 0); }); +Deno.test("a connecting block that joins solid blocks joins the full side of another block too", async () => { + const { t, hold, state } = await setup(); + t.send(1, { type: "chat", text: "/give dangerous_business:iron_bars" }); + hold(4); + t.game.set_block(1, 100, 0, FLOOR); + t.send(1, { type: "use_block", x: 0, y: 99, z: 0, face: "top", hit: [0.5, 1, 0.5] }); + assertEquals(state(0, 100, 0, "east"), 1); + assertEquals(state(0, 100, 0, "west"), 0); + + t.game.set_block(1, 100, 0, "cubi:air"); + assertEquals(state(0, 100, 0, "east"), 0); +}); + Deno.test("a block with a random look picks the same one wherever it's placed again", async () => { const { t, hold, state } = await setup(); hold(2);