diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-11-30 23:52:02 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-11-30 23:52:02 +0200 |
commit | 918c507a66aa5c05422d78a9ea30a455ddd3e124 (patch) | |
tree | e33440096e85bdace34bfefe61e41c1fc9a4fba0 /data/mods | |
parent | 1b61ca412bc2ceba4a4b7a711a1decea59751657 (diff) | |
download | minetest-918c507a66aa5c05422d78a9ea30a455ddd3e124.tar.gz minetest-918c507a66aa5c05422d78a9ea30a455ddd3e124.tar.bz2 minetest-918c507a66aa5c05422d78a9ea30a455ddd3e124.zip |
Move craftitem_place_item as minetest.craftitem_place_item in builtin.lua
Diffstat (limited to 'data/mods')
-rw-r--r-- | data/mods/bucket/init.lua | 11 | ||||
-rw-r--r-- | data/mods/default/init.lua | 50 |
2 files changed, 18 insertions, 43 deletions
diff --git a/data/mods/bucket/init.lua b/data/mods/bucket/init.lua index aaed49ab1..013ff2408 100644 --- a/data/mods/bucket/init.lua +++ b/data/mods/bucket/init.lua @@ -1,8 +1,3 @@ -local craftitem_place_item = function(item, player, pos) - minetest.env:add_item(pos, 'CraftItem "' .. item .. '" 1') - return true -end - minetest.register_craft({ output = 'CraftItem "bucket" 1', recipe = { @@ -15,7 +10,7 @@ minetest.register_craftitem("bucket", { image = "bucket.png", stack_max = 1, liquids_pointable = true, - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, on_use = function(item, player, pointed_thing) if pointed_thing.type == "node" then n = minetest.env:get_node(pointed_thing.under) @@ -37,7 +32,7 @@ minetest.register_craftitem("bucket_water", { image = "bucket_water.png", stack_max = 1, liquids_pointable = true, - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, on_use = function(item, player, pointed_thing) if pointed_thing.type == "node" then n = minetest.env:get_node(pointed_thing.under) @@ -59,7 +54,7 @@ minetest.register_craftitem("bucket_lava", { image = "bucket_lava.png", stack_max = 1, liquids_pointable = true, - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, on_use = function(item, player, pointed_thing) if pointed_thing.type == "node" then n = minetest.env:get_node(pointed_thing.under) diff --git a/data/mods/default/init.lua b/data/mods/default/init.lua index f04f381c4..858e002c7 100644 --- a/data/mods/default/init.lua +++ b/data/mods/default/init.lua @@ -1132,68 +1132,48 @@ minetest.register_node("apple", { -- Crafting items -- -local craftitem_place_item = function(item, placer, pos) - --print("craftitem_place_item") - --print("item: " .. dump(item)) - --print("placer: " .. dump(placer)) - --print("pos: " .. dump(pos)) - minetest.env:add_item(pos, 'CraftItem "' .. item .. '" 1') - return true -end - -local craftitem_eat = function(hp_change) - return function(item, user, pointed_thing) -- closure - --print("craftitem_eat(" .. hp_change .. ")") - --print("item: " .. dump(item)) - --print("user: " .. dump(user)) - --print("pointed_thing: " .. dump(pointed_thing)) - user:set_hp(user:get_hp() + hp_change) - return true - end -end - minetest.register_craftitem("Stick", { image = "stick.png", --furnace_burntime = ..., - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, }) minetest.register_craftitem("paper", { image = "paper.png", - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, }) minetest.register_craftitem("book", { image = "book.png", - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, }) minetest.register_craftitem("lump_of_coal", { image = "lump_of_coal.png", furnace_burntime = 40; - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, }) minetest.register_craftitem("lump_of_iron", { image = "lump_of_iron.png", cookresult_item = 'CraftItem "steel_ingot" 1', - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, }) minetest.register_craftitem("lump_of_clay", { image = "lump_of_clay.png", cookresult_item = 'CraftItem "clay_brick" 1', - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, }) minetest.register_craftitem("steel_ingot", { image = "steel_ingot.png", - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, }) minetest.register_craftitem("clay_brick", { image = "clay_brick.png", - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, }) minetest.register_craftitem("rat", { @@ -1208,13 +1188,13 @@ minetest.register_craftitem("rat", { minetest.register_craftitem("cooked_rat", { image = "cooked_rat.png", cookresult_item = 'CraftItem "scorched_stuff" 1', - on_place_on_ground = craftitem_place_item, - on_use = craftitem_eat(6), + on_place_on_ground = minetest.craftitem_place_item, + on_use = minetest.craftitem_eat(6), }) minetest.register_craftitem("scorched_stuff", { image = "scorched_stuff.png", - on_place_on_ground = craftitem_place_item, + on_place_on_ground = minetest.craftitem_place_item, }) minetest.register_craftitem("firefly", { @@ -1227,14 +1207,14 @@ minetest.register_craftitem("firefly", { minetest.register_craftitem("apple", { image = "apple.png", - on_place_on_ground = craftitem_place_item, - on_use = craftitem_eat(4), + on_place_on_ground = minetest.craftitem_place_item, + on_use = minetest.craftitem_eat(4), }) minetest.register_craftitem("apple_iron", { image = "apple_iron.png", - on_place_on_ground = craftitem_place_item, - on_use = craftitem_eat(8), + on_place_on_ground = minetest.craftitem_place_item, + on_use = minetest.craftitem_eat(8), }) print(dump(minetest.registered_craftitems)) |