add rudimentary crafter experience (#57)

* add rudimentary crafter experience

* remove useless print

* fix style
This commit is contained in:
pandaro 2017-04-17 11:52:34 +02:00 committed by cd2
parent 2aa5b584f4
commit aa2455c400
2 changed files with 12 additions and 0 deletions

View File

@ -4,6 +4,7 @@ minetest.register_node("default:workbench", {
description = "Workbench",
tiles = {"default_workbench_top.png", "default_wooden_planks.png"},
groups = {choppy = 3},
craft_xp = 10,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", default.craft_form)

View File

@ -172,6 +172,17 @@ function xp.explorer_xp()
end)
end
function xp.crafter_xp()
minetest.register_on_craft(function(itemstack, player)
local craft_xp = itemstack:get_definition().craft_xp
if craft_xp then
xp.add_xp(player, craft_xp)
end
end)
end
xp.crafter_xp()
xp.explorer_xp()
xp.load_xp()
xp.load_levels()