mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
Added visible items cooking on the fire
This commit is contained in:
parent
cef6c72a71
commit
0b7cec419a
@ -11,6 +11,12 @@ 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
|
||||||
function mcl_campfires.take_item(pos, node, player, itemstack)
|
function mcl_campfires.take_item(pos, node, player, itemstack)
|
||||||
|
local campfire_spots = {
|
||||||
|
{x = -0.25, y = -0.04, z = -0.25},
|
||||||
|
{x = 0.25, y = -0.04, z = -0.25},
|
||||||
|
{x = 0.25, y = -0.04, z = 0.25},
|
||||||
|
{x = -0.25, y = -0.04, z = 0.25},
|
||||||
|
}
|
||||||
local is_creative = minetest.is_creative_enabled(player:get_player_name())
|
local is_creative = minetest.is_creative_enabled(player:get_player_name())
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
local campfire_meta = minetest.get_meta(pos)
|
local campfire_meta = minetest.get_meta(pos)
|
||||||
@ -26,6 +32,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], player:get_wielded_item():get_name().."_entity") -- Spawn food item on the campfire
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -457,6 +457,28 @@ minetest.register_craft({
|
|||||||
cooktime = 10,
|
cooktime = 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_entity("mcl_fishing:fish_entity", {
|
||||||
|
initial_properties = {
|
||||||
|
physical = false,
|
||||||
|
visual = "wielditem",
|
||||||
|
wield_item = "mcl_fishing:fish_raw",
|
||||||
|
wield_image = "mcl_fishing_fish_raw.png",
|
||||||
|
visual_size = {x=0.25, y=0.25},
|
||||||
|
collisionbox = {0,0,0,0,0,0},
|
||||||
|
pointable = false,
|
||||||
|
},
|
||||||
|
on_activate = function(self, staticdata)
|
||||||
|
self.timer = 0
|
||||||
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
|
end,
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
self.timer = self.timer + dtime
|
||||||
|
if self.timer > 31 then
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Salmon
|
-- Salmon
|
||||||
minetest.register_craftitem("mcl_fishing:salmon_raw", {
|
minetest.register_craftitem("mcl_fishing:salmon_raw", {
|
||||||
description = S("Raw Salmon"),
|
description = S("Raw Salmon"),
|
||||||
@ -487,6 +509,28 @@ minetest.register_craft({
|
|||||||
cooktime = 10,
|
cooktime = 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_entity("mcl_fishing:salmon_entity", {
|
||||||
|
initial_properties = {
|
||||||
|
physical = false,
|
||||||
|
visual = "wielditem",
|
||||||
|
wield_item = "mcl_fishing:salmon_raw",
|
||||||
|
wield_image = "mcl_fishing_salmon_raw.png",
|
||||||
|
visual_size = {x=0.25, y=0.25},
|
||||||
|
collisionbox = {0,0,0,0,0,0},
|
||||||
|
pointable = false,
|
||||||
|
},
|
||||||
|
on_activate = function(self, staticdata)
|
||||||
|
self.timer = 0
|
||||||
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
|
end,
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
self.timer = self.timer + dtime
|
||||||
|
if self.timer > 31 then
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Clownfish
|
-- Clownfish
|
||||||
minetest.register_craftitem("mcl_fishing:clownfish_raw", {
|
minetest.register_craftitem("mcl_fishing:clownfish_raw", {
|
||||||
description = S("Clownfish"),
|
description = S("Clownfish"),
|
||||||
|
@ -37,6 +37,28 @@ minetest.register_craftitem("mcl_mobitems:cooked_mutton", {
|
|||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_entity("mcl_mobitems:mutton_entity", {
|
||||||
|
initial_properties = {
|
||||||
|
physical = false,
|
||||||
|
visual = "wielditem",
|
||||||
|
wield_item = "mcl_mobitems:mutton",
|
||||||
|
wield_image = "mcl_mobitems_mutton_raw.png",
|
||||||
|
visual_size = {x=0.25, y=0.25},
|
||||||
|
collisionbox = {0,0,0,0,0,0},
|
||||||
|
pointable = false,
|
||||||
|
},
|
||||||
|
on_activate = function(self, staticdata)
|
||||||
|
self.timer = 0
|
||||||
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
|
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", {
|
||||||
description = S("Raw Beef"),
|
description = S("Raw Beef"),
|
||||||
_doc_items_longdesc = S("Raw beef is the flesh from cows and can be eaten safely. Cooking it will greatly increase its nutritional value."),
|
_doc_items_longdesc = S("Raw beef is the flesh from cows and can be eaten safely. Cooking it will greatly increase its nutritional value."),
|
||||||
@ -61,6 +83,28 @@ minetest.register_craftitem("mcl_mobitems:cooked_beef", {
|
|||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_entity("mcl_mobitems:beef_entity", {
|
||||||
|
initial_properties = {
|
||||||
|
physical = false,
|
||||||
|
visual = "wielditem",
|
||||||
|
wield_item = "mcl_mobitems:beef",
|
||||||
|
wield_image = "mcl_mobitems_beef_raw.png",
|
||||||
|
visual_size = {x=0.25, y=0.25},
|
||||||
|
collisionbox = {0,0,0,0,0,0},
|
||||||
|
pointable = false,
|
||||||
|
},
|
||||||
|
on_activate = function(self, staticdata)
|
||||||
|
self.timer = 0
|
||||||
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
|
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", {
|
||||||
description = S("Raw Chicken"),
|
description = S("Raw Chicken"),
|
||||||
_tt_help = minetest.colorize(mcl_colors.YELLOW, S("30% chance of food poisoning")),
|
_tt_help = minetest.colorize(mcl_colors.YELLOW, S("30% chance of food poisoning")),
|
||||||
@ -86,6 +130,28 @@ minetest.register_craftitem("mcl_mobitems:cooked_chicken", {
|
|||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_entity("mcl_mobitems:chicken_entity", {
|
||||||
|
initial_properties = {
|
||||||
|
physical = false,
|
||||||
|
visual = "wielditem",
|
||||||
|
wield_item = "mcl_mobitems:chicken",
|
||||||
|
wield_image = "mcl_mobitems_chicken_raw.png",
|
||||||
|
visual_size = {x=0.25, y=0.25},
|
||||||
|
collisionbox = {0,0,0,0,0,0},
|
||||||
|
pointable = false,
|
||||||
|
},
|
||||||
|
on_activate = function(self, staticdata)
|
||||||
|
self.timer = 0
|
||||||
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
|
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", {
|
||||||
description = S("Raw Porkchop"),
|
description = S("Raw Porkchop"),
|
||||||
_doc_items_longdesc = S("A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value."),
|
_doc_items_longdesc = S("A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value."),
|
||||||
@ -110,6 +176,28 @@ minetest.register_craftitem("mcl_mobitems:cooked_porkchop", {
|
|||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_entity("mcl_mobitems:porkchop_entity", {
|
||||||
|
initial_properties = {
|
||||||
|
physical = false,
|
||||||
|
visual = "wielditem",
|
||||||
|
wield_item = "mcl_mobitems:porkchop",
|
||||||
|
wield_image = "mcl_mobitems_porkchop_raw.png",
|
||||||
|
visual_size = {x=0.25, y=0.25},
|
||||||
|
collisionbox = {0,0,0,0,0,0},
|
||||||
|
pointable = false,
|
||||||
|
},
|
||||||
|
on_activate = function(self, staticdata)
|
||||||
|
self.timer = 0
|
||||||
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
|
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", {
|
||||||
description = S("Raw Rabbit"),
|
description = S("Raw Rabbit"),
|
||||||
_doc_items_longdesc = S("Raw rabbit is a food item from a dead rabbit. It can be eaten safely. Cooking it will increase its nutritional value."),
|
_doc_items_longdesc = S("Raw rabbit is a food item from a dead rabbit. It can be eaten safely. Cooking it will increase its nutritional value."),
|
||||||
@ -134,6 +222,28 @@ minetest.register_craftitem("mcl_mobitems:cooked_rabbit", {
|
|||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_entity("mcl_mobitems:rabbit_entity", {
|
||||||
|
initial_properties = {
|
||||||
|
physical = false,
|
||||||
|
visual = "wielditem",
|
||||||
|
wield_item = "mcl_mobitems:rabbit",
|
||||||
|
wield_image = "mcl_mobitems_rabbit_raw.png",
|
||||||
|
visual_size = {x=0.25, y=0.25},
|
||||||
|
collisionbox = {0,0,0,0,0,0},
|
||||||
|
pointable = false,
|
||||||
|
},
|
||||||
|
on_activate = function(self, staticdata)
|
||||||
|
self.timer = 0
|
||||||
|
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
||||||
|
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
|
||||||
local function drink_milk(itemstack, player, pointed_thing)
|
local function drink_milk(itemstack, player, pointed_thing)
|
||||||
local bucket = minetest.do_item_eat(0, "mcl_buckets:bucket_empty", itemstack, player, pointed_thing)
|
local bucket = minetest.do_item_eat(0, "mcl_buckets:bucket_empty", itemstack, player, pointed_thing)
|
||||||
|
Loading…
Reference in New Issue
Block a user