1
0
Fork 0
This commit is contained in:
Lizzy Fleckenstein 2021-01-05 20:36:50 +01:00
parent 059629c51f
commit 823ff7e22e
1 changed files with 14 additions and 12 deletions

View File

@ -69,15 +69,17 @@ local receive_fields = function(pos, formname, fields, sender)
end end
end end
local function drop_xp(pos) local function give_xp(pos, player)
if mcl_experience.throw_experience then
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local dir = vector.divide(minetest.facedir_to_dir(minetest.get_node(pos).param2),-1.95) local dir = vector.divide(minetest.facedir_to_dir(minetest.get_node(pos).param2),-1.95)
local xp = meta:get_int("xp") local xp = meta:get_int("xp")
if xp > 0 then if xp > 0 then
if player then
mcl_experience.add_experience(player, xp)
else
mcl_experience.throw_experience(vector.add(pos, dir), xp) mcl_experience.throw_experience(vector.add(pos, dir), xp)
meta:set_int("xp", 0)
end end
meta:set_int("xp", 0)
end end
end end
@ -155,7 +157,7 @@ local function on_metadata_inventory_take(pos, listname, index, stack, player)
elseif stack:get_name() == "mcl_fishing:fish_cooked" then elseif stack:get_name() == "mcl_fishing:fish_cooked" then
awards.unlock(player:get_player_name(), "mcl:cookFish") awards.unlock(player:get_player_name(), "mcl:cookFish")
end end
drop_xp(pos) give_xp(pos, player)
end end
end end
@ -472,7 +474,7 @@ minetest.register_node("mcl_furnaces:furnace", {
end, end,
on_destruct = function(pos) on_destruct = function(pos)
mcl_particles.delete_node_particlespawners(pos) mcl_particles.delete_node_particlespawners(pos)
drop_xp(pos) give_xp(pos)
end, end,
on_metadata_inventory_move = function(pos) on_metadata_inventory_move = function(pos)
@ -486,14 +488,14 @@ minetest.register_node("mcl_furnaces:furnace", {
-- start timer function, it will sort out whether furnace can burn or not. -- start timer function, it will sort out whether furnace can burn or not.
minetest.get_node_timer(pos):start(1.0) minetest.get_node_timer(pos):start(1.0)
end, end,
on_metadata_inventory_take = function(pos, listname) on_metadata_inventory_take = function(pos, listname, index, stack, player)
-- Reset accumulated game time when player works with furnace: -- Reset accumulated game time when player works with furnace:
furnace_reset_delta_time(pos) furnace_reset_delta_time(pos)
-- start timer function, it will helpful if player clears dst slot -- start timer function, it will helpful if player clears dst slot
minetest.get_node_timer(pos):start(1.0) minetest.get_node_timer(pos):start(1.0)
if listname == "dst" then if listname == "dst" then
drop_xp(pos) give_xp(pos, player)
end end
end, end,
@ -544,7 +546,7 @@ minetest.register_node("mcl_furnaces:furnace_active", {
end, end,
on_destruct = function(pos) on_destruct = function(pos)
mcl_particles.delete_node_particlespawners(pos) mcl_particles.delete_node_particlespawners(pos)
drop_xp(pos) give_xp(pos)
end, end,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,