From beb8e50eb62a8ed7b434746255ccb7863c07b108 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 21 Feb 2017 17:32:48 +0100 Subject: [PATCH] Add API document for mcl_walls --- mods/ITEMS/mcl_walls/API.md | 31 +++++++++++++++++++++++++++++++ mods/ITEMS/mcl_walls/init.lua | 6 +++--- 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 mods/ITEMS/mcl_walls/API.md diff --git a/mods/ITEMS/mcl_walls/API.md b/mods/ITEMS/mcl_walls/API.md new file mode 100644 index 000000000..bbaba232a --- /dev/null +++ b/mods/ITEMS/mcl_walls/API.md @@ -0,0 +1,31 @@ +# API for MineClone 2 walls + +This API allows you to add more walls (like the cobblestone wall) to MineClone 2. + +## `mcl_walls.register_wall(nodename, description, tiles, invtex, groups, sounds)` + +Adds a new wall type. This is optimized for stone-based walls, but other materials are theoretically possible, too. + +The current implementation registers a couple of nodes for the different nodeboxes. +All walls connect to solid nodes and all other wall nodes. + +The crafting recipe is NOT registered, you have to add your own. + +### Parameters +* `nodename`: Full itemstring of the new wall node (base node only). ***Must not have an underscore!*** +* `description`: Item description of item (tooltip), visible to user +* `tiles`: Wall textures table, same syntax as for `minetest.register_node` +* `inventory_image`: Inventory image (optional, default is an ugly 3D image) +* `groups`: Base group memberships (optional, default is `{cracky=3}`) +* `sounds`: Sound table (optional, by default default uses stone sounds) + +The following groups will automatically be added to the nodes (where applicable), you do not need to add them +to the `groups` table: + +* `deco_block=1` +* `not_in_creative_inventory=1` (except for the base node which the player can take) +* `wall=1` + +### Example + + mcl_walls.register_wall("mymod:granitewall", "Granite Wall", {"mymod_granite.png"}, "mymod_granite_wall_inv.png") diff --git a/mods/ITEMS/mcl_walls/init.lua b/mods/ITEMS/mcl_walls/init.lua index fd579e9e6..6af1527fc 100644 --- a/mods/ITEMS/mcl_walls/init.lua +++ b/mods/ITEMS/mcl_walls/init.lua @@ -85,11 +85,11 @@ local full_blocks = { * nodename: Itemstring of base node to add. Must not contain an underscore * description: Item description (tooltip), visible to user * tiles: Wall textures table -* invtex: Inventory image (optional) +* inventory_image: Inventory image (optional) * groups: Base group memberships (optional, default is {cracky=3}) * sounds: Sound table (optional, default is stone) ]] -function mcl_walls.register_wall(nodename, description, tiles, invtex, groups, sounds) +function mcl_walls.register_wall(nodename, description, tiles, inventory_image, groups, sounds) local base_groups = groups if not base_groups then @@ -196,7 +196,7 @@ function mcl_walls.register_wall(nodename, description, tiles, invtex, groups, s is_ground_content = false, groups = main_node_groups, tiles = tiles, - inventory_image = invtex, + inventory_image = inventory_image, stack_max = 64, drawtype = "nodebox", node_box = {