mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-23 02:51:06 +01:00
modified: mods/ITEMS/mcl_campfires/api.lua
modified: mods/ITEMS/mcl_fishing/init.lua modified: mods/ITEMS/mcl_mobitems/init.lua
This commit is contained in:
parent
13d4841097
commit
177196a8d2
3 changed files with 9 additions and 51 deletions
|
@ -2,11 +2,17 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
mcl_campfires = {}
|
mcl_campfires = {}
|
||||||
|
|
||||||
local drop_items = mcl_util.drop_items_from_meta_container("main")
|
local drop_items = mcl_util.drop_items_from_meta_container("main")
|
||||||
|
local food_entity = {nil, nil, nil, nil}
|
||||||
|
|
||||||
local function on_blast(pos)
|
local function on_blast(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
drop_items(pos, node)
|
drop_items(pos, node)
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
|
for i = 1, 4 do
|
||||||
|
if food_entity[i] then
|
||||||
|
food_entity[i]:remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- on_rightclick function to take items that are cookable in a campfire, and put them in the campfire inventory
|
-- on_rightclick function to take items that are cookable in a campfire, and put them in the campfire inventory
|
||||||
|
@ -32,7 +38,7 @@ function mcl_campfires.take_item(pos, node, player, itemstack)
|
||||||
if not is_creative then itemstack:take_item(1) end -- Take the item if in creative
|
if not is_creative then itemstack:take_item(1) end -- Take the item if in creative
|
||||||
campfire_inv:set_stack("main", space, stack) -- Set the inventory itemstack at the empty spot
|
campfire_inv:set_stack("main", space, stack) -- Set the inventory itemstack at the empty spot
|
||||||
campfire_meta:set_int("cooktime_"..tostring(space), 30) -- Set the cook time meta
|
campfire_meta:set_int("cooktime_"..tostring(space), 30) -- Set the cook time meta
|
||||||
minetest.add_entity(pos + campfire_spots[space], stack:get_name().."_entity") -- Spawn food item on the campfire
|
food_entity[space] = minetest.add_entity(pos + campfire_spots[space], stack:get_name().."_entity") -- Spawn food item on the campfire
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -58,6 +64,7 @@ function mcl_campfires.cook_item(pos, elapsed)
|
||||||
elseif time_r <= 0 then
|
elseif time_r <= 0 then
|
||||||
local cooked = minetest.get_craft_result({method = "cooking", width = 1, items = {item}})
|
local cooked = minetest.get_craft_result({method = "cooking", width = 1, items = {item}})
|
||||||
if cooked then
|
if cooked then
|
||||||
|
food_entity[i]:remove() -- Remove visual food entity
|
||||||
minetest.add_item(pos, cooked.item) -- Drop Cooked Item
|
minetest.add_item(pos, cooked.item) -- Drop Cooked Item
|
||||||
inv:set_stack("main", i, "") -- Clear Inventory
|
inv:set_stack("main", i, "") -- Clear Inventory
|
||||||
continue = continue + 1 -- Indicate that the slot is clear.
|
continue = continue + 1 -- Indicate that the slot is clear.
|
||||||
|
@ -169,7 +176,7 @@ function mcl_campfires.register_campfire(name, def)
|
||||||
_mcl_hardness = 2,
|
_mcl_hardness = 2,
|
||||||
damage_per_second = def.damage,
|
damage_per_second = def.damage,
|
||||||
on_blast = on_blast,
|
on_blast = on_blast,
|
||||||
after_dig_node = drop_items,
|
after_dig_node = on_blast,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -468,15 +468,8 @@ minetest.register_entity("mcl_fishing:fish_raw_entity", {
|
||||||
pointable = false,
|
pointable = false,
|
||||||
},
|
},
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
self.timer = 0
|
|
||||||
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
end,
|
end,
|
||||||
on_step = function(self, dtime)
|
|
||||||
self.timer = self.timer + dtime
|
|
||||||
if self.timer > 31 then
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Salmon
|
-- Salmon
|
||||||
|
@ -520,15 +513,8 @@ minetest.register_entity("mcl_fishing:salmon_raw_entity", {
|
||||||
pointable = false,
|
pointable = false,
|
||||||
},
|
},
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
self.timer = 0
|
|
||||||
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
end,
|
end,
|
||||||
on_step = function(self, dtime)
|
|
||||||
self.timer = self.timer + dtime
|
|
||||||
if self.timer > 31 then
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Clownfish
|
-- Clownfish
|
||||||
|
|
|
@ -48,15 +48,8 @@ minetest.register_entity("mcl_mobitems:mutton_entity", {
|
||||||
pointable = false,
|
pointable = false,
|
||||||
},
|
},
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
self.timer = 0
|
|
||||||
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
end,
|
end,
|
||||||
on_step = function(self, dtime)
|
|
||||||
self.timer = self.timer + dtime
|
|
||||||
if self.timer > 31 then
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:beef", {
|
minetest.register_craftitem("mcl_mobitems:beef", {
|
||||||
|
@ -94,15 +87,8 @@ minetest.register_entity("mcl_mobitems:beef_entity", {
|
||||||
pointable = false,
|
pointable = false,
|
||||||
},
|
},
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
self.timer = 0
|
|
||||||
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
end,
|
end,
|
||||||
on_step = function(self, dtime)
|
|
||||||
self.timer = self.timer + dtime
|
|
||||||
if self.timer > 31 then
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:chicken", {
|
minetest.register_craftitem("mcl_mobitems:chicken", {
|
||||||
|
@ -141,15 +127,8 @@ minetest.register_entity("mcl_mobitems:chicken_entity", {
|
||||||
pointable = false,
|
pointable = false,
|
||||||
},
|
},
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
self.timer = 0
|
|
||||||
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
end,
|
end,
|
||||||
on_step = function(self, dtime)
|
|
||||||
self.timer = self.timer + dtime
|
|
||||||
if self.timer > 31 then
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:porkchop", {
|
minetest.register_craftitem("mcl_mobitems:porkchop", {
|
||||||
|
@ -187,15 +166,8 @@ minetest.register_entity("mcl_mobitems:porkchop_entity", {
|
||||||
pointable = false,
|
pointable = false,
|
||||||
},
|
},
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
self.timer = 0
|
|
||||||
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
end,
|
end,
|
||||||
on_step = function(self, dtime)
|
|
||||||
self.timer = self.timer + dtime
|
|
||||||
if self.timer > 31 then
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_mobitems:rabbit", {
|
minetest.register_craftitem("mcl_mobitems:rabbit", {
|
||||||
|
@ -233,15 +205,8 @@ minetest.register_entity("mcl_mobitems:rabbit_entity", {
|
||||||
pointable = false,
|
pointable = false,
|
||||||
},
|
},
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
self.timer = 0
|
|
||||||
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
end,
|
end,
|
||||||
on_step = function(self, dtime)
|
|
||||||
self.timer = self.timer + dtime
|
|
||||||
if self.timer > 31 then
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Reset food poisoning and status effects
|
-- Reset food poisoning and status effects
|
||||||
|
|
Loading…
Reference in a new issue