update fork #6

Merged
chmodsayshello merged 260 commits from VoxeLibre/VoxeLibre:master into master 2022-05-29 21:37:34 +02:00
2 changed files with 18 additions and 0 deletions
Showing only changes of commit 46dbf8c0ab - Show all commits

View File

@ -1029,6 +1029,9 @@ mobs:register_mob("mobs_mc:villager", {
_player_scan_timer = 0, _player_scan_timer = 0,
_trading_players = {}, -- list of playernames currently trading with villager (open formspec) _trading_players = {}, -- list of playernames currently trading with villager (open formspec)
do_custom = function(self, dtime) do_custom = function(self, dtime)
if self.bed and vector.distance(self.object:get_pos(),self.bed) > 50 then
self.object:set_pos(self.bed)
end
-- Stand still if player is nearby. -- Stand still if player is nearby.
if not self._player_scan_timer then if not self._player_scan_timer then
self._player_scan_timer = 0 self._player_scan_timer = 0

View File

@ -48,6 +48,17 @@ if minetest.get_modpath("mobs_mc") then
end end
--]] --]]
local function spawn_villagers(minp,maxp)
local beds=minetest.find_nodes_in_area(minp,maxp,{"mcl_beds:bed_red_bottom"})
for _,bed in pairs(beds) do
minetest.get_meta(bed):set_string("villagebed","true")
local v=minetest.add_entity(bed,"mobs_mc:villager")
if v then
v:get_luaentity().bed = bed
end
end
end
-- --
-- on map generation, try to build a settlement -- on map generation, try to build a settlement
-- --
@ -66,6 +77,10 @@ local function build_a_settlement(minp, maxp, blockseed)
-- evaluate settlement_info and place schematics -- evaluate settlement_info and place schematics
settlements.place_schematics(settlement_info, pr) settlements.place_schematics(settlement_info, pr)
minetest.after(20,function()
spawn_villagers(minp,maxp)
end) --give the village some time to fully generate
end end
local function ecb_village(blockpos, action, calls_remaining, param) local function ecb_village(blockpos, action, calls_remaining, param)