]> git.lizzy.rs Git - xdecor.git/commitdiff
More simplification
authorkilbith <jeanpatrick.guerrero@gmail.com>
Thu, 7 Jan 2016 21:33:54 +0000 (22:33 +0100)
committerkilbith <jeanpatrick.guerrero@gmail.com>
Thu, 7 Jan 2016 21:33:54 +0000 (22:33 +0100)
cooking.lua
crafts.lua
enchanting.lua
hive.lua
itemframe.lua
mailbox.lua
nodes.lua
worktable.lua

index 8070f6ce175bb9f97dbffbe4a9bc1817b4adb5d3..1fc6f3dc53902f83fe427d59d625fac01870d044 100644 (file)
@@ -11,7 +11,7 @@ local cauldron_cbox = {
        }
 }
 
-local function fill_water_bucket(pos, node, clicker, itemstack, _)
+local function fill_water_bucket(pos, node, clicker, itemstack)
        local wield_item = clicker:get_wielded_item():get_name()
        if wield_item == "bucket:bucket_empty" then
                minetest.set_node(pos, {name="xdecor:cauldron_empty", param2=node.param2})
@@ -74,7 +74,7 @@ xdecor.register("cauldron_soup", {
                "xdecor_cauldron_sides.png"
        },
        collision_box = cauldron_cbox,
-       on_rightclick = function(pos, node, clicker, itemstack, _)
+       on_rightclick = function(pos, node, clicker, itemstack)
                local inv = clicker:get_inventory()
                if clicker:get_wielded_item():get_name() == "xdecor:bowl" then
                        if inv:room_for_item("main", "xdecor:bowl_soup 1") then
@@ -93,7 +93,7 @@ xdecor.register("cauldron_soup", {
 minetest.register_abm({
        nodenames = {"xdecor:cauldron_idle"},
        interval = 15, chance = 1,
-       action = function(pos, node, _, _)
+       action = function(pos, node)
                local below_node = {x=pos.x, y=pos.y-1, z=pos.z}
                if minetest.get_node(below_node).name:find("fire") then
                        minetest.set_node(pos, {name="xdecor:cauldron_boiling_water", param2=node.param2})
@@ -104,7 +104,7 @@ minetest.register_abm({
 minetest.register_abm({
        nodenames = {"xdecor:cauldron_boiling_water"},
        interval = 3, chance = 1,
-       action = function(pos, node, _, _)
+       action = function(pos, node)
                local objs = minetest.get_objects_inside_radius(pos, 0.5)
                if not objs then return end
 
index 269ebadb92134302e98b068eef66d58454030807..c6dc0b19a6f128edc69824e43a9426712dc36b0c 100644 (file)
@@ -36,7 +36,7 @@ minetest.register_craftitem("xdecor:bowl_soup", {
        wield_image = "xdecor_bowl_soup.png",
        groups = {not_in_creative_inventory = 1},
        stack_max = 1,
-       on_use = function(itemstack, user, _)
+       on_use = function(itemstack, user)
                itemstack:replace("xdecor:bowl 1")
                if minetest.get_modpath("hunger") then
                        minetest.item_eat(20)
index 677a26acb3cf3b0bd6080d0bc4d2e96ae2d9e72c..75ae0ff6a20c201bcf3125db2fff90612c4e4674 100644 (file)
@@ -32,7 +32,7 @@ function enchanting.formspec(pos, tooltype)
        meta:set_string("formspec", formspec)
 end
 
-function enchanting.on_put(pos, listname, _, stack, _)
+function enchanting.on_put(pos, listname, _, stack)
        if listname == "tool" then
                local stn = stack:get_name()
                if stn:find("pick") or stn:find("axe") or stn:find("shovel") then
@@ -47,7 +47,7 @@ function enchanting.on_put(pos, listname, _, stack, _)
        end
 end
 
-function enchanting.fields(pos, _, fields, _)
+function enchanting.fields(pos, _, fields)
        if fields.quit then return end
        local inv = minetest.get_meta(pos):get_inventory()
        local toolstack = inv:get_stack("tool", 1)
@@ -68,7 +68,7 @@ function enchanting.fields(pos, _, fields, _)
        end
 end
 
-function enchanting.dig(pos, _)
+function enchanting.dig(pos)
        local inv = minetest.get_meta(pos):get_inventory()
        return inv:is_empty("tool") and inv:is_empty("mese")
 end
@@ -82,7 +82,7 @@ local function allowed(tool)
        return false
 end
 
-function enchanting.put(_, listname, _, stack, _)
+function enchanting.put(_, listname, _, stack)
        local toolstack = stack:get_name()
        local toolname = toolstack:match("[%w_]+:([%w_]+)")
 
@@ -95,7 +95,7 @@ function enchanting.put(_, listname, _, stack, _)
        return 0
 end
 
-function enchanting.on_take(pos, listname, _, _, _)
+function enchanting.on_take(pos, listname)
        if listname == "tool" then
                enchanting.formspec(pos, nil)
        end
index 911fb04f6bca2f8ebebf62d3953f3f6c42831e65..518c6fe344672854880842f3e20f52ef514b4781 100644 (file)
--- a/hive.lua
+++ b/hive.lua
@@ -27,7 +27,7 @@ xdecor.register("hive", {
        },
        groups = {choppy=3, oddly_breakable_by_hand=2, flammable=1},
        on_construct = hive.construct,
-       can_dig = function(pos, _)
+       can_dig = function(pos)
                return minetest.get_meta(pos):get_inventory():is_empty("honey")
        end,
        on_punch = function(_, _, puncher)
@@ -39,7 +39,7 @@ xdecor.register("hive", {
 minetest.register_abm({
        nodenames = {"xdecor:hive"},
        interval = 30, chance = 10,
-       action = function(pos, _, _, _)
+       action = function(pos)
                local inv = minetest.get_meta(pos):get_inventory()
                local honeystack = inv:get_stack("honey", 1)
                local honey = honeystack:get_count()
index 615e24be6edb9d7f903bd28ceff042c0bc2323f7..7c9138212149694720182a7a403ce13da5f13a55 100644 (file)
@@ -144,7 +144,7 @@ xdecor.register("frame", {
 minetest.register_abm({
        nodenames = {"xdecor:frame"},
        interval = 15, chance = 1,
-       action = function(pos, node, _, _)
+       action = function(pos, node)
                local num = #minetest.get_objects_inside_radius(pos, 0.5)
                if num > 0 then return end
                update_item(pos, node)
index b8b18bb7dc929157cac30fac887607f730c1e9c4..28c459558c73950af3cc8fa75ac9f9c438418c4c 100644 (file)
@@ -10,7 +10,7 @@ xdecor.register("mailbox", {
        },
        groups = {cracky=3, oddly_breakable_by_hand=1},
        on_rotate = screwdriver.rotate_simple,
-       after_place_node = function(pos, placer, _)
+       after_place_node = function(pos, placer)
                local meta = minetest.get_meta(pos)
                local player_name = placer:get_player_name()
 
@@ -21,7 +21,7 @@ xdecor.register("mailbox", {
                inv:set_size("mailbox", 6*4)
                inv:set_size("drop", 1)
        end,
-       on_rightclick = function(pos, _, clicker, _)
+       on_rightclick = function(pos, _, clicker)
                local meta = minetest.get_meta(pos)
                local player = clicker:get_player_name()
                local owner = meta:get_string("owner")
index eee2887c3e61b62a58b354bbb0b0954b965a4e1c..c34ece38aaeedc6a8c91e08f3b35beb068732604 100644 (file)
--- a/nodes.lua
+++ b/nodes.lua
@@ -134,7 +134,7 @@ for _, c in pairs({"red"}) do  -- Add more curtains colors simply here.
                paramtype2 = "wallmounted",
                groups = {dig_immediate=3, flammable=3},
                selection_box = {type="wallmounted"},
-               on_rightclick = function(pos, node, _, _)
+               on_rightclick = function(pos, node)
                        minetest.set_node(pos, {name="xdecor:curtain_open_"..c, param2=node.param2})
                end
        })
@@ -147,7 +147,7 @@ for _, c in pairs({"red"}) do  -- Add more curtains colors simply here.
                groups = {dig_immediate=3, flammable=3, not_in_creative_inventory=1},
                selection_box = {type="wallmounted"},
                drop = "xdecor:curtain_"..c,
-               on_rightclick = function(pos, node, _, _)
+               on_rightclick = function(pos, node)
                        minetest.set_node(pos, {name="xdecor:curtain_"..c, param2=node.param2})
                end
        })
@@ -272,7 +272,7 @@ minetest.register_tool("xdecor:hammer", {
        description = "Hammer",
        inventory_image = "xdecor_hammer.png",
        wield_image = "xdecor_hammer.png",
-       on_use = function(...) do return end end
+       on_use = function() do return end end
 })
 
 xdecor.register("ivy", {
@@ -453,14 +453,13 @@ xdecor.register("stonepath", {
        selection_box = xdecor.nodebox.slab_y(0.05)
 })
 
-local stonish = {"desertstone_tile", "stone_tile", "stone_rune", "coalstone_tile",
-               "hard_clay"}
+local stonish = {"desertstone_tile", "stone_tile", "stone_rune",
+               "coalstone_tile", "hard_clay"}
 
 for _, t in pairs(stonish) do
        xdecor.register(t, {
                drawtype = "normal",
-               description = string.sub(t:gsub("^%l", string.upper), 1, -6)
-                               .." "..t:sub(-4):gsub("^%l", string.upper),
+               description = string.gsub(" "..t, "%W%l", string.upper):sub(2):gsub("_", " "),
                tiles = {"xdecor_"..t..".png"},
                groups = {cracky=1},
                sounds = default.node_sound_stone_defaults()
index 080c42c38587725239c7aef8245d3a2ed3ae9374..d2e649a93f3f38fc6e3b470374f53a8f7d9dd42c 100644 (file)
@@ -207,7 +207,7 @@ function worktable.construct(pos)
        worktable.main(meta)
 end
 
-function worktable.fields(pos, _, fields, _)
+function worktable.fields(pos, _, fields)
        if fields.quit then return end
        local meta = minetest.get_meta(pos)
        local inv = meta:get_inventory()
@@ -260,7 +260,7 @@ function worktable.fields(pos, _, fields, _)
        end
 end
 
-function worktable.dig(pos, _)
+function worktable.dig(pos)
        local inv = minetest.get_meta(pos):get_inventory()
        return inv:is_empty("input") and inv:is_empty("hammer") and
                inv:is_empty("tool") and inv:is_empty("storage")
@@ -277,7 +277,7 @@ function worktable.contains(table, element)
        return false
 end
 
-function worktable.put(_, listname, _, stack, _)
+function worktable.put(_, listname, _, stack)
        local stackname = stack:get_name()
        local mod, node = stackname:match("([%w_]+):([%w_]+)")
 
@@ -306,7 +306,7 @@ function worktable.take(pos, listname, _, stack, player)
        return stack:get_count()
 end
 
-function worktable.move(pos, from_list, from_index, to_list, to_index, count, _)
+function worktable.move(pos, from_list, from_index, to_list, to_index, count)
        local meta = minetest.get_meta(pos)
        local inv = meta:get_inventory()
 
@@ -340,14 +340,14 @@ function worktable.get_output(inv, stack)
        inv:set_list("forms", output)
 end
 
-function worktable.on_put(pos, listname, _, stack, _)
+function worktable.on_put(pos, listname, _, stack)
        if listname == "input" then
                local inv = minetest.get_meta(pos):get_inventory()
                worktable.get_output(inv, stack)
        end
 end
 
-function worktable.on_take(pos, listname, index, stack, _)
+function worktable.on_take(pos, listname, index, stack)
        local inv = minetest.get_meta(pos):get_inventory()
        local inputstack = inv:get_stack("input", 1)
 
@@ -429,13 +429,12 @@ end
 minetest.register_abm({
        nodenames = {"xdecor:worktable"},
        interval = 3, chance = 1,
-       action = function(pos, _, _, _)
+       action = function(pos)
                local inv = minetest.get_meta(pos):get_inventory()
                local tool = inv:get_stack("tool", 1)
                local hammer = inv:get_stack("hammer", 1)
-               local wear = tool:get_wear()
 
-               if tool:is_empty() or hammer:is_empty() or wear == 0 then
+               if tool:is_empty() or hammer:is_empty() or tool:get_wear() == 0 then
                        return
                end