Skip to content

Commit

Permalink
walls: add ability to specify group wall_connected for blocks tha…
Browse files Browse the repository at this point in the history
…t the walls can connect to
  • Loading branch information
alek13 committed Nov 9, 2024
1 parent 0536755 commit 2aede56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions game_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ Doors API

The doors mod allows modders to register custom doors and trapdoors.

`doors.registered_doors[name] = Door definition`
* Table of registered doors, indexed by door name
`doors.registered_doors[name] = Door definition`
* Table of registered doors, indexed by door name

`doors.registered_trapdoors[name] = Trapdoor definition`
* Table of registered trap doors, indexed by trap door name
`doors.registered_trapdoors[name] = Trapdoor definition`
* Table of registered trap doors, indexed by trap door name

`doors.register_door(name, def)`

Expand Down Expand Up @@ -214,7 +214,7 @@ The doors mod allows modders to register custom doors and trapdoors.
* `pos` Position of the door
* `node` Node definition
* `clicker` Player definition for the player that clicked on the door

### Door definition

description = "Door description",
Expand All @@ -232,7 +232,7 @@ The doors mod allows modders to register custom doors and trapdoors.
gain_open = 0.3, -- optional, defaults to 0.3
gain_close = 0.3, -- optional, defaults to 0.3
protected = false, -- If true, only placer can open the door (locked for others)
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing),
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing),
-- optional function containing the on_rightclick callback, defaults to a doors.door_toggle-wrapper
use_texture_alpha = "clip",

Expand Down Expand Up @@ -341,6 +341,11 @@ walls.register(name, desc, texture, mat, sounds)
^ mat = "default:stone". Used to auto-generate crafting recipe.
^ sounds = sounds: see [#Default sounds]

All walls will be connected to any nodes with one of the following groups:
- `wall`
- `stone`
- `fence`
- `wall_connected`

Farming API
-----------
Expand Down Expand Up @@ -1039,7 +1044,7 @@ Trees
default.register_sapling_growth(
"default:sapling", -- Name of the sapling
{
can_grow = default.can_grow, -- Function called to determine whether the sapling can grow, should return a boolean
can_grow = default.can_grow, -- Function called to determine whether the sapling can grow, should return a boolean
on_grow_failed = default.on_grow_failed, -- Function called when the growth fails
grow = function(pos) -- Function called when the growth has success. This should replace the sapling with a tree.
}
Expand Down
2 changes: 1 addition & 1 deletion mods/walls/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wa
connect_back = {-1/4,-1/2,1/4,1/4,1/2 + fence_collision_extra,1/2},
connect_right = {1/4,-1/2,-1/4,1/2,1/2 + fence_collision_extra,1/4},
},
connects_to = { "group:wall", "group:stone", "group:fence" },
connects_to = { "group:wall", "group:stone", "group:fence", "group:wall_connected" },
paramtype = "light",
is_ground_content = false,
tiles = wall_texture_table,
Expand Down

0 comments on commit 2aede56

Please sign in to comment.