villager stuff
This commit is contained in:
parent
e60600add6
commit
69c52742db
@ -42,7 +42,7 @@ mobs:register_mob("mobs_npc:npc", {
|
|||||||
water_damage = 0,
|
water_damage = 0,
|
||||||
lava_damage = 2,
|
lava_damage = 2,
|
||||||
light_damage = 0,
|
light_damage = 0,
|
||||||
follow = {"farming:bread", "mobs:meat", "default:diamond"},
|
follow = {"farming:bread", "mobs:meat", "default:diamond", "villages:colony_deed"},
|
||||||
view_range = 15,
|
view_range = 15,
|
||||||
owner = "",
|
owner = "",
|
||||||
order = "follow",
|
order = "follow",
|
||||||
@ -59,15 +59,41 @@ mobs:register_mob("mobs_npc:npc", {
|
|||||||
punch_start = 200,
|
punch_start = 200,
|
||||||
punch_end = 219,
|
punch_end = 219,
|
||||||
},
|
},
|
||||||
|
do_custom = function(self)
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
pos.y = pos.y + 0.5
|
||||||
|
|
||||||
|
local beds = minetest.find_node_near(pos, 5, {"beds:bed_bottom", "beds:bed", "beds:bed_yellow_bottom", "beds:bed_brown_bottom", "beds:bed_magenta_bottom", "beds:bed_blue_bottom", "beds:bed_orange_bottom", "beds:bed_cyan_bottom", "beds:bed_pink_bottom", "beds:bed_black_bottom", "beds:bed_white_bottom", "beds:bed_darkgrey_bottom", "beds:bed_grey_bottom", "beds:bed_green_bottom", "beds:bed_purple_bottom", "beds:bed_darkgreen_bottom"})
|
||||||
|
local light_sources = minetest.find_node_near(pos, 5, {"default:torch", "default:torch_wall", "default:torch_floor", "default:torch_ceiling", "mese_lamp"})
|
||||||
|
local doors = minetest.find_node_near(pos, 5, {"doors:door_wood_a", "doors:door_glass_a", "doors:door_obsidian_glass_a"})
|
||||||
|
local is_owned = minetest.find_node_near(pos, 5, {"villages:colony_deed", "villages:hobo_deed",})
|
||||||
|
local node_below = minetest.get_node({x=pos.x, y=pos.y-2.2, z=pos.z})
|
||||||
|
local good_floor = minetest.get_item_group("node_below", "crumbly")
|
||||||
|
if beds ~= nil and light_sources ~= nil and doors ~= nil and is_owned == nil and self.home == nil and good_floor == 0 then
|
||||||
|
self.home = pos
|
||||||
|
minetest.set_node({x=pos.x, y=pos.y-1.5, z=pos.z}, {name="villages:colony_deed", param2=1})
|
||||||
|
minetest.chat_send_all("NPC home set!")
|
||||||
|
end
|
||||||
|
|
||||||
|
local game_time = minetest.get_timeofday()*24000
|
||||||
|
|
||||||
|
if game_time >= 6000 and game_time <= 18000 then
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end,
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
|
|
||||||
|
local item = clicker:get_wielded_item()
|
||||||
|
local name = clicker:get_player_name()
|
||||||
|
|
||||||
-- feed to heal npc
|
-- feed to heal npc
|
||||||
if mobs:feed_tame(self, clicker, 8, true, true) then
|
if mobs:feed_tame(self, clicker, 8, true, true) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local item = clicker:get_wielded_item()
|
|
||||||
local name = clicker:get_player_name()
|
|
||||||
|
|
||||||
-- right clicking with gold lump drops random item from mobs.npc_drops
|
-- right clicking with gold lump drops random item from mobs.npc_drops
|
||||||
if item:get_name() == "default:gold_lump" then
|
if item:get_name() == "default:gold_lump" then
|
||||||
@ -90,6 +116,7 @@ mobs:register_mob("mobs_npc:npc", {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- capture npc with net or lasso
|
-- capture npc with net or lasso
|
||||||
mobs:capture_mob(self, clicker, 0, 5, 80, false, nil)
|
mobs:capture_mob(self, clicker, 0, 5, 80, false, nil)
|
||||||
|
|
||||||
|
@ -9,9 +9,10 @@ minetest.register_node("villages:colony_deed", {
|
|||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
selection_box = {type="wallmounted",},
|
selection_box = {type="wallmounted",},
|
||||||
groups = {crumbly=1, dig_immediate=3, oddly_breakable_by_hand=1},
|
groups = {crumbly=1, dig_immediate=3, oddly_breakable_by_hand=1},
|
||||||
on_construct = function(pos, node, placer)
|
--on_construct = function(pos, node, placer)
|
||||||
local meta = minetest.get_meta(pos)
|
--local meta = minetest.get_meta(pos)
|
||||||
end,
|
--end,
|
||||||
|
walkable = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("villages:hobo_deed", {
|
minetest.register_node("villages:hobo_deed", {
|
||||||
@ -24,13 +25,14 @@ minetest.register_node("villages:hobo_deed", {
|
|||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
selection_box = {type="wallmounted",},
|
selection_box = {type="wallmounted",},
|
||||||
groups = {crumbly=1, dig_immediate=3, oddly_breakable_by_hand=1,},
|
groups = {crumbly=1, dig_immediate=3, oddly_breakable_by_hand=1,},
|
||||||
on_construct = function(pos, node, placer)
|
--on_construct = function(pos, node, placer)
|
||||||
local meta = minetest.get_meta(pos)
|
--local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("position", "not in building")
|
--meta:set_string("position", "not in building")
|
||||||
meta:set_string("population", "0")
|
--meta:set_string("population", "0")
|
||||||
end,
|
--end,
|
||||||
|
walkable = false,
|
||||||
})
|
})
|
||||||
|
--[[
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"villages:colony_deed"},
|
nodenames = {"villages:colony_deed"},
|
||||||
interval = 5,
|
interval = 5,
|
||||||
@ -57,3 +59,4 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
]]
|
Loading…
x
Reference in New Issue
Block a user