From 91d7c42bbaa11153e1d5808d520e7108a7b9ba4c Mon Sep 17 00:00:00 2001 From: Sokomine Date: Sun, 18 Jun 2017 20:34:19 +0200 Subject: [PATCH] provide diffrent positions in front of the house --- place_buildings.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/place_buildings.lua b/place_buildings.lua index 3bdad73..4949aa0 100644 --- a/place_buildings.lua +++ b/place_buildings.lua @@ -130,22 +130,26 @@ end -- pos has to contain information about the building - o (orientation), bsizex and bsizez -- this function returns a position in front of the building, with the building stretching equally to the right and left -- (useful for mobs who want to leave/enter the plot) -handle_schematics.get_pos_in_front_of_house = function( pos ) +-- bed_nr can be used to assign diffrent spawn points to mobs in diffrent beds +handle_schematics.get_pos_in_front_of_house = function( pos, bed_nr ) + if( not( mob_nr )) then + mob_nr = 0; + end local p = {x=pos.x, y=pos.y+1, z=pos.z}; if( pos.o == 0 ) then p.x = p.x - 1; p.z = p.z + pos.bsizez - 1; - p.z = p.z - math.floor(pos.bsizex/2+0.5); + p.z = p.z - math.floor(pos.bsizex/2+0.5) - bed_nr; elseif( pos.o == 2 ) then p.x = p.x + pos.bsizex; - p.z = p.z + math.floor(pos.bsizex/2+0.5); + p.z = p.z + math.floor(pos.bsizex/2+0.5) + bed_nr; elseif( pos.o == 1 ) then p.z = p.z + pos.bsizez; p.x = p.x + pos.bsizex - 1; - p.x = p.x - math.floor(pos.bsizez/2+0.5); + p.x = p.x - math.floor(pos.bsizez/2+0.5) - bed_nr; elseif( pos.o == 3 ) then p.z = p.z - 1; - p.x = p.x + math.floor(pos.bsizez/2+0.5); + p.x = p.x + math.floor(pos.bsizez/2+0.5) + bed_nr; end return p; end