mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 20:03:45 +01:00
Fix #955
This commit is contained in:
parent
059629c51f
commit
823ff7e22e
@ -69,15 +69,17 @@ local receive_fields = function(pos, formname, fields, sender)
|
||||
end
|
||||
end
|
||||
|
||||
local function drop_xp(pos)
|
||||
if mcl_experience.throw_experience then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local dir = vector.divide(minetest.facedir_to_dir(minetest.get_node(pos).param2),-1.95)
|
||||
local xp = meta:get_int("xp")
|
||||
if xp > 0 then
|
||||
local function give_xp(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local dir = vector.divide(minetest.facedir_to_dir(minetest.get_node(pos).param2),-1.95)
|
||||
local xp = meta:get_int("xp")
|
||||
if xp > 0 then
|
||||
if player then
|
||||
mcl_experience.add_experience(player, xp)
|
||||
else
|
||||
mcl_experience.throw_experience(vector.add(pos, dir), xp)
|
||||
meta:set_int("xp", 0)
|
||||
end
|
||||
meta:set_int("xp", 0)
|
||||
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
|
||||
awards.unlock(player:get_player_name(), "mcl:cookFish")
|
||||
end
|
||||
drop_xp(pos)
|
||||
give_xp(pos, player)
|
||||
end
|
||||
end
|
||||
|
||||
@ -472,7 +474,7 @@ minetest.register_node("mcl_furnaces:furnace", {
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
mcl_particles.delete_node_particlespawners(pos)
|
||||
drop_xp(pos)
|
||||
give_xp(pos)
|
||||
end,
|
||||
|
||||
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.
|
||||
minetest.get_node_timer(pos):start(1.0)
|
||||
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:
|
||||
furnace_reset_delta_time(pos)
|
||||
-- start timer function, it will helpful if player clears dst slot
|
||||
minetest.get_node_timer(pos):start(1.0)
|
||||
|
||||
if listname == "dst" then
|
||||
drop_xp(pos)
|
||||
give_xp(pos, player)
|
||||
end
|
||||
end,
|
||||
|
||||
@ -544,7 +546,7 @@ minetest.register_node("mcl_furnaces:furnace_active", {
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
mcl_particles.delete_node_particlespawners(pos)
|
||||
drop_xp(pos)
|
||||
give_xp(pos)
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
|
Loading…
Reference in New Issue
Block a user