From a05cbd29ef6be5ab49d2ec149c84817ab456088e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 22 Feb 2017 04:09:21 +0100 Subject: [PATCH] Remove unused parameters from fences API --- mods/ITEMS/mcl_fences/API.md | 10 +++------- mods/ITEMS/mcl_fences/init.lua | 34 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/mods/ITEMS/mcl_fences/API.md b/mods/ITEMS/mcl_fences/API.md index 8867e4c3..f6ce4148 100644 --- a/mods/ITEMS/mcl_fences/API.md +++ b/mods/ITEMS/mcl_fences/API.md @@ -2,14 +2,13 @@ This API allows you to add fences and fence gates. The recommended function is `mcl_fences.register_fence_and_fence_gate`. -## ` mcl_fences.register_fence = function(id, fence_name, texture, fence_image, groups, connects_to, sounds)` +## ` mcl_fences.register_fence = function(id, fence_name, texture, groups, connects_to, sounds)` Adds a fence without crafting recipe. A single node is created. ### Parameter * `id`: A part of the itemstring of the node to create. The node name will be “`:`” * `fence_name`: User-visible name (`description`) * `texture`: Texture to apply on the fence (all sides) -* `fence_image`: Inventory image * `groups`: Table of groups to which the fence belongs to * `connects_to`: Table of nodes (itemstrings) to which the fence will connect to. Use `group:` for all members of the group `` * `sounds`: Node sound table for the fence @@ -19,14 +18,13 @@ The full itemstring of the new fence node. Notes: Fences will always have the group `fence=1`. They will always connect to solid nodes (group `solid=1`). -## `mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, gate_image, groups, connects_to, sounds, sound_open, sound_close)` +## `mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups, connects_to, sounds, sound_open, sound_close)` Adds a fence gate without crafting recipe. This will create 2 nodes. ### Parameters * `id`: A part of the itemstring of the nodes to create. The node names will be “`:_gate`” and “`:_gate_open`” * `fence_gate_name`: User-visible name (`description`) * `texture`: Texture to apply on the fence gate (all sides) -* `gate_image`: Inventory image * `groups`: Table of groups to which the fence gate belongs to * `connects_to`: Table of nodes (itemstrings) to which the fence will connect to. Use `group:` for all members of the group `` * `sounds`: Node sound table for the fence gate @@ -41,7 +39,7 @@ This function returns 2 values, in the following order: 1. Itemstring of the closed fence gate 2. Itemstring of the open fence gate -## `mcl_fences.register_fence_and_fence_gate = function(id, fence_name, fence_gate_name, texture, fence_image, gate_image, groups, connects_to, sounds, sound_open, sound_close)` +## `mcl_fences.register_fence_and_fence_gate = function(id, fence_name, fence_gate_name, texture, groups, connects_to, sounds, sound_open, sound_close)` Registers a fence and fence gate. This is basically a combination of the two functions above. This is the recommended way to add a fence / fence gate pair. This will register 3 nodes in total without crafting recipes. @@ -49,8 +47,6 @@ This will register 3 nodes in total without crafting recipes. * `fence_name`: User-visible name (`description`) of the fence * `fence_gate_name`: User-visible name (`description`) of the fence gate * `texture`: Texture to apply on the fence and fence gate (all sides) -* `fence_image`: Inventory image of the fence -* `gate_image`: Inventory image of the fence gate * `groups`: Table of groups to which the fence and fence gate belong to * `connects_to`: Table of nodes (itemstrings) to which the fence and fence gate will connect to. Use `group:` for all members of the group `` * `sounds`: Node sound table for the fence and the fence gate diff --git a/mods/ITEMS/mcl_fences/init.lua b/mods/ITEMS/mcl_fences/init.lua index 2ed07e69..7b02370e 100644 --- a/mods/ITEMS/mcl_fences/init.lua +++ b/mods/ITEMS/mcl_fences/init.lua @@ -20,7 +20,7 @@ local cz2 = {-2/16, -1/2+6/16, 2/16, 2/16, 1, 1/2} --unten(quer) z mcl_fences = {} -mcl_fences.register_fence = function(id, fence_name, texture, fence_image, groups, connects_to, sounds) +mcl_fences.register_fence = function(id, fence_name, texture, groups, connects_to, sounds) if groups == nil then groups = {} end groups.fence = 1 groups.deco_block = 1 @@ -64,7 +64,7 @@ mcl_fences.register_fence = function(id, fence_name, texture, fence_image, group return fence_id end -mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, gate_image, groups, connects_to, sounds, sound_open, sound_close, sound_gain) +mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups, connects_to, sounds, sound_open, sound_close, sound_gain) local meta2 local state2 = 0 @@ -211,9 +211,9 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, gate_ima return gate_id, open_gate_id end -mcl_fences.register_fence_and_fence_gate = function(id, fence_name, fence_gate_name, texture, fence_image, gate_image, groups, connects_to, sounds, sound_open, sound_close) - local fence_id = mcl_fences.register_fence(id, fence_name, texture, fence_image, groups, connects_to, sounds) - local gate_id, open_gate_id = mcl_fences.register_fence_gate(id, fence_gate_name, texture, gate_image, groups, connects_to, sounds, sound_open, sound_close) +mcl_fences.register_fence_and_fence_gate = function(id, fence_name, fence_gate_name, texture, groups, connects_to, sounds, sound_open, sound_close) + local fence_id = mcl_fences.register_fence(id, fence_name, texture, groups, connects_to, sounds) + local gate_id, open_gate_id = mcl_fences.register_fence_gate(id, fence_gate_name, texture, groups, connects_to, sounds, sound_open, sound_close) return fence_id, gate_id, open_gate_id end @@ -222,12 +222,12 @@ local wood_connect = {"group:fence_wood"} local wood_sounds = mcl_sounds.node_sound_wood_defaults() local woods = { - {"", "Oak Fence", "Oak Fence Gate", "default_wood.png", "default_fence.png", "mcl_fences_fence_gate.png", "mcl_core:wood"}, - {"spruce", "Spruce Fence", "Spruce Fence Gate", "default_sprucewood.png", "default_fence.png", "mcl_fences_fence_gate.png", "mcl_core:sprucewood"}, - {"birch", "Birch Fence", "Birch Fence Gate", "default_planks_birch.png", "default_fence.png", "mcl_fences_fence_gate.png", "mcl_core:birchwood"}, - {"jungle", "Jungle Fence", "Jungle Fence Gate", "default_junglewood.png", "default_fence.png", "mcl_fences_fence_gate.png", "mcl_core:junglewood"}, - {"dark_oak", "Dark Oak Fence", "Dark Oak Fence Gate", "default_planks_big_oak.png", "default_fence.png", "mcl_fences_fence_gate.png", "mcl_core:darkwood"}, - {"acacia", "Acacia Fence", "Acacia Fence Gate", "default_acaciawood.png", "default_fence.png", "mcl_fences_fence_gate.png", "mcl_core:acaciawood"}, + {"", "Oak Fence", "Oak Fence Gate", "default_wood.png", "mcl_core:wood"}, + {"spruce", "Spruce Fence", "Spruce Fence Gate", "default_sprucewood.png", "mcl_core:sprucewood"}, + {"birch", "Birch Fence", "Birch Fence Gate", "default_planks_birch.png", "mcl_core:birchwood"}, + {"jungle", "Jungle Fence", "Jungle Fence Gate", "default_junglewood.png", "mcl_core:junglewood"}, + {"dark_oak", "Dark Oak Fence", "Dark Oak Fence Gate", "default_planks_big_oak.png", "mcl_core:darkwood"}, + {"acacia", "Acacia Fence", "Acacia Fence Gate", "default_acaciawood.png", "mcl_core:acaciawood"}, } for w=1, #woods do @@ -240,27 +240,27 @@ for w=1, #woods do id = wood[1].."_fence" id_gate = wood[1].."_fence_gate" end - mcl_fences.register_fence_and_fence_gate(id, wood[2], wood[3], wood[4], wood[5], wood[6], wood_groups, wood_connect, wood_sounds) + mcl_fences.register_fence_and_fence_gate(id, wood[2], wood[3], wood[4], wood_groups, wood_connect, wood_sounds) minetest.register_craft({ output = 'mcl_fences:'..id..' 3', recipe = { - {wood[7], 'mcl_core:stick', wood[7]}, - {wood[7], 'mcl_core:stick', wood[7]}, + {wood[5], 'mcl_core:stick', wood[5]}, + {wood[5], 'mcl_core:stick', wood[5]}, } }) minetest.register_craft({ output = 'mcl_fences:'..id_gate, recipe = { - {'mcl_core:stick', wood[7], 'mcl_core:stick'}, - {'mcl_core:stick', wood[7], 'mcl_core:stick'}, + {'mcl_core:stick', wood[5], 'mcl_core:stick'}, + {'mcl_core:stick', wood[5], 'mcl_core:stick'}, } }) end -- Nether Brick Fence (without fence gate!) -mcl_fences.register_fence("nether_brick_fence", "Nether Brick Fence", "mcl_nether_nether_brick.png", "default_fence.png", {cracky=2, deco_block=1, fence_nether_brick=1}, {"group:fence_nether_brick"}, mcl_sounds.node_sound_stone_defaults()) +mcl_fences.register_fence("nether_brick_fence", "Nether Brick Fence", "mcl_nether_nether_brick.png", {cracky=2, deco_block=1, fence_nether_brick=1}, {"group:fence_nether_brick"}, mcl_sounds.node_sound_stone_defaults()) minetest.register_craft({ output = 'mcl_fences:nether_brick_fence 6',