add rudimentary crafter experience (#57)
* add rudimentary crafter experience * remove useless print * fix style
This commit is contained in:
parent
2aa5b584f4
commit
aa2455c400
@ -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)
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user