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/builtin.lua | |
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/builtin.lua')
-rw-r--r-- | data/builtin.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/data/builtin.lua b/data/builtin.lua index dc41caf69..c3e426db5 100644 --- a/data/builtin.lua +++ b/data/builtin.lua @@ -1,3 +1,10 @@ +-- +-- This file contains built-in stuff in Minetest implemented in Lua. +-- +-- It is always loaded and executed after registration of the C API, +-- before loading and running any mods. +-- + function basic_dump2(o) if type(o) == "number" then return tostring(o) @@ -297,6 +304,30 @@ end test_stackstring() -- +-- craftitem helpers +-- + +minetest.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 + +minetest.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 + +-- -- Callback registration -- |