mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 10:31:06 +01:00
Villager breeding is now unburgered. Burger now needs right click to initiate follow.
This commit is contained in:
parent
4fd4425aae
commit
8e1f00d428
2 changed files with 45 additions and 17 deletions
|
@ -1930,8 +1930,6 @@ end)
|
||||||
|
|
||||||
--[=======[ MOB REGISTRATION AND SPAWNING ]=======]
|
--[=======[ MOB REGISTRATION AND SPAWNING ]=======]
|
||||||
|
|
||||||
local pick_up = { "mcl_farming:bread", "mcl_farming:carrot_item", "mcl_farming:beetroot_item" , "mcl_farming:potato_item" }
|
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:villager", {
|
mcl_mobs.register_mob("mobs_mc:villager", {
|
||||||
description = S("Villager"),
|
description = S("Villager"),
|
||||||
type = "npc",
|
type = "npc",
|
||||||
|
@ -1976,7 +1974,7 @@ mcl_mobs.register_mob("mobs_mc:villager", {
|
||||||
head_shake_start = 131, head_shake_end = 141, head_shake_loop = false,
|
head_shake_start = 131, head_shake_end = 141, head_shake_loop = false,
|
||||||
head_nod_start = 121, head_nod_end = 131, head_nod_loop = false,
|
head_nod_start = 121, head_nod_end = 131, head_nod_loop = false,
|
||||||
},
|
},
|
||||||
follow = pick_up,
|
follow = { "mcl_farming:bread", "mcl_farming:carrot_item", "mcl_farming:beetroot_item" , "mcl_farming:potato_item" },
|
||||||
nofollow = true,
|
nofollow = true,
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
|
@ -1986,7 +1984,7 @@ mcl_mobs.register_mob("mobs_mc:villager", {
|
||||||
_id = nil,
|
_id = nil,
|
||||||
_profession = "unemployed",
|
_profession = "unemployed",
|
||||||
look_at_player = true,
|
look_at_player = true,
|
||||||
pick_up = pick_up,
|
pick_up = { "mcl_farming:bread", "mcl_farming:carrot_item", "mcl_farming:beetroot_item" , "mcl_farming:potato_item" },
|
||||||
can_open_doors = true,
|
can_open_doors = true,
|
||||||
on_pick_up = function(self,itementity)
|
on_pick_up = function(self,itementity)
|
||||||
local clicker
|
local clicker
|
||||||
|
@ -2003,6 +2001,7 @@ mcl_mobs.register_mob("mobs_mc:villager", {
|
||||||
return it
|
return it
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
|
--minetest.log("In villager right click")
|
||||||
if self.child or self._profession == "unemployed" or self._profession == "nitwit" then
|
if self.child or self._profession == "unemployed" or self._profession == "nitwit" then
|
||||||
self.order = nil
|
self.order = nil
|
||||||
return
|
return
|
||||||
|
|
|
@ -22,6 +22,8 @@ local DEBUG = false
|
||||||
local enable_burger = minetest.settings:get_bool("mcl_enable_hamburger",true)
|
local enable_burger = minetest.settings:get_bool("mcl_enable_hamburger",true)
|
||||||
local use_alt = minetest.settings:get_bool("mcl_hamburger_alt_texture",false)
|
local use_alt = minetest.settings:get_bool("mcl_hamburger_alt_texture",false)
|
||||||
|
|
||||||
|
local HAMBURGER_NAME = "mcl_hamburger:hamburger"
|
||||||
|
|
||||||
mcl_hamburger = {}
|
mcl_hamburger = {}
|
||||||
|
|
||||||
if DEBUG then
|
if DEBUG then
|
||||||
|
@ -32,12 +34,12 @@ end
|
||||||
function mcl_hamburger.register_burger_craft(cooked_meat)
|
function mcl_hamburger.register_burger_craft(cooked_meat)
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "mcl_hamburger:hamburger",
|
recipe = HAMBURGER_NAME,
|
||||||
burntime = 2,
|
burntime = 2,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_hamburger:hamburger",
|
output = HAMBURGER_NAME,
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "mcl_farming:bread"},
|
{ "mcl_farming:bread"},
|
||||||
{ cooked_meat }, -- "mcl_mobitems:cooked_beef" for a reg hamburger. Grind up clowns for a Big Mac.
|
{ cooked_meat }, -- "mcl_mobitems:cooked_beef" for a reg hamburger. Grind up clowns for a Big Mac.
|
||||||
|
@ -45,7 +47,7 @@ function mcl_hamburger.register_burger_craft(cooked_meat)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "mcl_hamburger:hamburger",
|
output = HAMBURGER_NAME,
|
||||||
recipe = {
|
recipe = {
|
||||||
-- "mcl_mobitems:cooked_beef" for a reg hamburger. Grind up clowns for a Big Mac.
|
-- "mcl_mobitems:cooked_beef" for a reg hamburger. Grind up clowns for a Big Mac.
|
||||||
{ "mcl_farming:bread", cooked_meat, "mcl_farming:bread"},
|
{ "mcl_farming:bread", cooked_meat, "mcl_farming:bread"},
|
||||||
|
@ -72,23 +74,23 @@ if not enable_burger then
|
||||||
end
|
end
|
||||||
|
|
||||||
if use_alt == false then
|
if use_alt == false then
|
||||||
minetest.register_craftitem("mcl_hamburger:hamburger", hamburger_def)
|
minetest.register_craftitem(HAMBURGER_NAME, hamburger_def)
|
||||||
else
|
else
|
||||||
local hamburger_alt = table.copy(hamburger_def)
|
local hamburger_alt = table.copy(hamburger_def)
|
||||||
hamburger_alt.inventory_image = "mcl_hamburger_alt.png"
|
hamburger_alt.inventory_image = "mcl_hamburger_alt.png"
|
||||||
hamburger_alt.wield_image = "mcl_hamburger_alt.png"
|
hamburger_alt.wield_image = "mcl_hamburger_alt.png"
|
||||||
minetest.register_craftitem("mcl_hamburger:hamburger", hamburger_alt)
|
minetest.register_craftitem(HAMBURGER_NAME, hamburger_alt)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function register_achievements()
|
local function register_achievements()
|
||||||
|
|
||||||
awards.register_achievement("mcl_hamburger:hamburger", {
|
awards.register_achievement(HAMBURGER_NAME, {
|
||||||
title = S("Burger Time!"),
|
title = S("Burger Time!"),
|
||||||
description = S("Craft a Hamburger."),
|
description = S("Craft a Hamburger."),
|
||||||
icon = "mcl_hamburger_alt.png",
|
icon = "mcl_hamburger_alt.png",
|
||||||
trigger = {
|
trigger = {
|
||||||
type = "craft",
|
type = "craft",
|
||||||
item = "mcl_hamburger:hamburger",
|
item = HAMBURGER_NAME,
|
||||||
target = 1
|
target = 1
|
||||||
},
|
},
|
||||||
type = "Advancement",
|
type = "Advancement",
|
||||||
|
@ -101,19 +103,46 @@ local function register_doc_entry()
|
||||||
|
|
||||||
-- register Doc entry
|
-- register Doc entry
|
||||||
if minetest.get_modpath("doc") then
|
if minetest.get_modpath("doc") then
|
||||||
doc.add_entry_alias("craftitems", "mcl_hamburger:hamburger", "craftitems", "mcl_hamburger:hamburger")
|
doc.add_entry_alias("craftitems", HAMBURGER_NAME, "craftitems", HAMBURGER_NAME)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if enable_burger then
|
if enable_burger then
|
||||||
-- make the villagers follow the item
|
-- make the villagers follow the item
|
||||||
minetest.registered_entities["mobs_mc:villager"].nofollow = false
|
local villager = minetest.registered_entities["mobs_mc:villager"]
|
||||||
-- add it to the follow items.
|
|
||||||
table.insert(minetest.registered_entities["mobs_mc:villager"].follow,"mcl_hamburger:hamburger")
|
table.insert(villager.follow, HAMBURGER_NAME)
|
||||||
-- register the item and crafting recipe.
|
|
||||||
|
local original_rightclick = villager.on_rightclick
|
||||||
|
|
||||||
|
local new_on_rightclick = function(self, clicker)
|
||||||
|
--minetest.log("In wrapper function")
|
||||||
|
|
||||||
|
local item = clicker:get_wielded_item()
|
||||||
|
if item:get_name() == HAMBURGER_NAME then
|
||||||
|
if self.nofollow == true then
|
||||||
|
--minetest.log("Turn off nofollow")
|
||||||
|
self.nofollow = false
|
||||||
|
elseif self.nofollow == false then
|
||||||
|
--minetest.log("Turn on nofollow")
|
||||||
|
self.nofollow = true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
--minetest.log("Not holding burger")
|
||||||
|
if self.nofollow == false then
|
||||||
|
--minetest.log("Turn on nofollow")
|
||||||
|
self.nofollow = true
|
||||||
|
end
|
||||||
|
original_rightclick(self, clicker)
|
||||||
|
end
|
||||||
|
--minetest.log("Finishing wrapper")
|
||||||
|
end
|
||||||
|
|
||||||
|
villager.on_rightclick = new_on_rightclick
|
||||||
|
|
||||||
mcl_hamburger.register_burger_craft("mcl_mobitems:cooked_beef")
|
mcl_hamburger.register_burger_craft("mcl_mobitems:cooked_beef")
|
||||||
-- add in the super cool achievement(s)!
|
|
||||||
register_achievements()
|
register_achievements()
|
||||||
register_doc_entry()
|
register_doc_entry()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue