mark bed foot as well
This commit is contained in:
parent
d2d6ede246
commit
5d5c9f8ea0
@ -64,7 +64,7 @@ local buildings = {
|
|||||||
-- {scm="church_2_twoelk", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='church', weight={medieval=4}, pervillage=1},
|
-- {scm="church_2_twoelk", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='church', weight={medieval=4}, pervillage=1},
|
||||||
{scm="forge_1", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='forge', weight={medieval=2, single=1/2}, pervillage=1, inh=-1},
|
{scm="forge_1", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='forge', weight={medieval=2, single=1/2}, pervillage=1, inh=-1},
|
||||||
{scm="mill_1", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='mill', weight={medieval=2 }, pervillage=1, inh=-1},
|
{scm="mill_1", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='mill', weight={medieval=2 }, pervillage=1, inh=-1},
|
||||||
{scm="watermill_1", yoff=-3, orients={3}, farming_plus=0, avoid='', typ='mill', weight={medieval=2 }, pervillage=1, inh=-2},
|
{scm="watermill_1", yoff=-3, orients={1}, farming_plus=0, avoid='', typ='mill', weight={medieval=2 }, pervillage=1, inh=-2},
|
||||||
{scm="hut_1", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='hut', weight={medieval=1, single=1 }, inh=1},
|
{scm="hut_1", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='hut', weight={medieval=1, single=1 }, inh=1},
|
||||||
{scm="hut_2", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='hut', weight={medieval=1, single=1 }, inh=2},
|
{scm="hut_2", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='hut', weight={medieval=1, single=1 }, inh=2},
|
||||||
{scm="farm_full_1", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='farm_full', weight={medieval=1/4, single=1 }, inh=2},
|
{scm="farm_full_1", yoff= 0, orients={0}, farming_plus=0, avoid='', typ='farm_full', weight={medieval=1/4, single=1 }, inh=2},
|
||||||
@ -382,7 +382,8 @@ mg_villages.add_building = function( building_data )
|
|||||||
for i,p in ipairs( paths[1] ) do
|
for i,p in ipairs( paths[1] ) do
|
||||||
-- the last entry has a diffrent meaning
|
-- the last entry has a diffrent meaning
|
||||||
if( p and p[1] and i<#paths[1]) then
|
if( p and p[1] and i<#paths[1]) then
|
||||||
building_data.bed_list[i] = p[1];
|
-- param2 is the 5th parameter
|
||||||
|
building_data.bed_list[i] = {p[1][1],p[1][2],p[1][3],p[1][5]};
|
||||||
-- also store where the mob may stand
|
-- also store where the mob may stand
|
||||||
if( p[2] ) then
|
if( p[2] ) then
|
||||||
building_data.stand_next_to_bed_list[i] = p[2];
|
building_data.stand_next_to_bed_list[i] = p[2];
|
||||||
@ -403,7 +404,7 @@ mg_villages.add_building = function( building_data )
|
|||||||
if( paths and paths[1] ) then
|
if( paths and paths[1] ) then
|
||||||
for i,p in ipairs( paths[1] ) do
|
for i,p in ipairs( paths[1] ) do
|
||||||
if( p and p[1] and i<#paths[1]) then
|
if( p and p[1] and i<#paths[1]) then
|
||||||
building_data.workplace_list[i] = p[1];
|
building_data.workplace_list[i] = {p[1][1],p[1][2],p[1][3],p[1][4]};
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -297,11 +297,11 @@ mg_villages.inhabitants.assign_mobs_to_beds = function( bpos, house_nr, village_
|
|||||||
bpos.beds[i] = {};
|
bpos.beds[i] = {};
|
||||||
-- store the index for faster lookup
|
-- store the index for faster lookup
|
||||||
bpos.beds[i].bnr = i;
|
bpos.beds[i].bnr = i;
|
||||||
local p = mg_villages.transform_coordinates( {bed[1],bed[2],bed[3]}, bpos )
|
local p = mg_villages.transform_coordinates( {bed[1],bed[2],bed[3],bed[4]}, bpos )
|
||||||
bpos.beds[i].x = p.x;
|
bpos.beds[i].x = p.x;
|
||||||
bpos.beds[i].y = p.y;
|
bpos.beds[i].y = p.y;
|
||||||
bpos.beds[i].z = p.z;
|
bpos.beds[i].z = p.z;
|
||||||
bpos.beds[i].p2 = bed[4];
|
bpos.beds[i].p2 =p.p2;
|
||||||
end
|
end
|
||||||
-- lumberjack home
|
-- lumberjack home
|
||||||
if( building_data.typ == "lumberjack" ) then
|
if( building_data.typ == "lumberjack" ) then
|
||||||
@ -717,6 +717,14 @@ mg_villages.inhabitants.print_mob_info = function( village_to_add_data_bpos, hou
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local next_to_bed_str = "";
|
||||||
|
if( this_mob_data.bnr and building_data.stand_next_to_bed_list[ this_mob_data.bnr ]) then
|
||||||
|
next_to_bed_str = ",Gets up from bed to:,"..
|
||||||
|
minetest.formspec_escape(
|
||||||
|
minetest.pos_to_string(
|
||||||
|
mg_villages.transform_coordinates(
|
||||||
|
building_data.stand_next_to_bed_list[ this_mob_data.bnr], bpos)));
|
||||||
|
end
|
||||||
local text =
|
local text =
|
||||||
"First name:,"..(this_mob_data.first_name or '- ? -')..
|
"First name:,"..(this_mob_data.first_name or '- ? -')..
|
||||||
",Middle initial:,"..(this_mob_data.middle_name or '- ? -').."."..
|
",Middle initial:,"..(this_mob_data.middle_name or '- ? -').."."..
|
||||||
@ -729,6 +737,8 @@ mg_villages.inhabitants.print_mob_info = function( village_to_add_data_bpos, hou
|
|||||||
",Sleeps in bed at:,"..minetest.formspec_escape( minetest.pos_to_string( this_mob_data )..
|
",Sleeps in bed at:,"..minetest.formspec_escape( minetest.pos_to_string( this_mob_data )..
|
||||||
", "..this_mob_data.p2.." ["..(this_mob_data.bnr or "-?-").."/"..
|
", "..this_mob_data.p2.." ["..(this_mob_data.bnr or "-?-").."/"..
|
||||||
(#building_data.bed_list or "-?-").."]")..
|
(#building_data.bed_list or "-?-").."]")..
|
||||||
|
-- place next to te bed where the mob can stand
|
||||||
|
next_to_bed_str..
|
||||||
-- position of the mob's mob spawner
|
-- position of the mob's mob spawner
|
||||||
",Has a spawner at:,"..minetest.formspec_escape( minetest.pos_to_string(
|
",Has a spawner at:,"..minetest.formspec_escape( minetest.pos_to_string(
|
||||||
handle_schematics.get_pos_in_front_of_house( bpos, bed_nr)))..
|
handle_schematics.get_pos_in_front_of_house( bpos, bed_nr)))..
|
||||||
@ -1066,7 +1076,7 @@ mg_villages.transform_coordinates = function( pos, bpos )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- param2 is rotated the same way as in handle_schematics.generate_building_what_to_place_here_and_how
|
-- param2 is rotated the same way as in handle_schematics.generate_building_what_to_place_here_and_how
|
||||||
if( p[4] ) then -- param2
|
if( pos[4] ) then -- param2
|
||||||
local mirror_x = false;
|
local mirror_x = false;
|
||||||
local mirror_z = false;
|
local mirror_z = false;
|
||||||
if( bpos.mirror ) then
|
if( bpos.mirror ) then
|
||||||
@ -1083,11 +1093,11 @@ mg_villages.transform_coordinates = function( pos, bpos )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if( mirror_x ) then
|
if( mirror_x ) then
|
||||||
p[4] = handle_schematics.rotation_table[ 'facedir' ][ p[4]+1 ][ bpos.brotate+1 ][ 2 ];
|
p.p2 = handle_schematics.rotation_table[ 'facedir' ][ pos[4]+1 ][ bpos.brotate+1 ][ 2 ];
|
||||||
elseif( mirror_z ) then
|
elseif( mirror_z ) then
|
||||||
p[4] = handle_schematics.rotation_table[ 'facedir' ][ p[4]+1 ][ bpos.brotate+1 ][ 3 ];
|
p.p2 = handle_schematics.rotation_table[ 'facedir' ][ pos[4]+1 ][ bpos.brotate+1 ][ 3 ];
|
||||||
else
|
else
|
||||||
p[4] = handle_schematics.rotation_table[ 'facedir' ][ p[4]+1 ][ bpos.brotate+1 ][ 1 ];
|
p.p2 = handle_schematics.rotation_table[ 'facedir' ][ pos[4]+1 ][ bpos.brotate+1 ][ 1 ];
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1259,8 +1269,7 @@ mg_villages.inhabitants.prepare_metadata = function( village, village_id, minp,
|
|||||||
for bed_nr, bed in ipairs( bpos.beds ) do
|
for bed_nr, bed in ipairs( bpos.beds ) do
|
||||||
-- if the bed is located withhin the given area OR no area is given
|
-- if the bed is located withhin the given area OR no area is given
|
||||||
-- (for manual calls later on, outside of mapgen)
|
-- (for manual calls later on, outside of mapgen)
|
||||||
if( not( minp ) or not( maxp )
|
if( not( minp ) or not( maxp ) or ( minp.x <= bed.x and maxp.x >= bed.x
|
||||||
or ( minp.x <= bed.x and maxp.x >= bed.x
|
|
||||||
and minp.y <= bed.y and maxp.y >= bed.y
|
and minp.y <= bed.y and maxp.y >= bed.y
|
||||||
and minp.z <= bed.z and maxp.z >= bed.z)) then
|
and minp.z <= bed.z and maxp.z >= bed.z)) then
|
||||||
local meta = minetest.get_meta( bed );
|
local meta = minetest.get_meta( bed );
|
||||||
@ -1270,6 +1279,23 @@ mg_villages.inhabitants.prepare_metadata = function( village, village_id, minp,
|
|||||||
meta:set_int( 'plot_nr', plot_nr);
|
meta:set_int( 'plot_nr', plot_nr);
|
||||||
meta:set_int( 'bed_nr', bed_nr);
|
meta:set_int( 'bed_nr', bed_nr);
|
||||||
end
|
end
|
||||||
|
-- beds from the beds mod tend to have their foot as the selection box;
|
||||||
|
-- we need to set the infotext for the bed's foot as well
|
||||||
|
local p_foot = {x=bed.x,y=bed.y,z=bed.z};
|
||||||
|
if( bed.p2==0 ) then p_foot.z = p_foot.z-1;
|
||||||
|
elseif( bed.p2==1 ) then p_foot.x = p_foot.x-1;
|
||||||
|
elseif( bed.p2==2 ) then p_foot.z = p_foot.z+1;
|
||||||
|
elseif( bed.p2==3 ) then p_foot.x = p_foot.x+1;
|
||||||
|
end
|
||||||
|
if( not( minp ) or not( maxp )
|
||||||
|
or ( minp.x <= p_foot.x and maxp.x >= p_foot.x
|
||||||
|
and minp.y <= p_foot.y and maxp.y >= p_foot.y
|
||||||
|
and minp.z <= p_foot.z and maxp.z >= p_foot.z)) then
|
||||||
|
local meta = minetest.get_meta( p_foot );
|
||||||
|
-- setting the infotext is enough here
|
||||||
|
meta:set_string('infotext', 'Bed of '..
|
||||||
|
mg_villages.inhabitants.mob_get_full_name( bed, bpos.beds[1] ));
|
||||||
|
end
|
||||||
-- there might be a workplace belonging to the bed/mob
|
-- there might be a workplace belonging to the bed/mob
|
||||||
if( bed.works_at and bed.workplace
|
if( bed.works_at and bed.workplace
|
||||||
and bed.workplace>0
|
and bed.workplace>0
|
||||||
|
File diff suppressed because one or more lines are too long
@ -63,6 +63,10 @@ mg_villages.plotmarker_formspec = function( pos, formname, fields, player )
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local mirror_str = "";
|
||||||
|
if( plot.mirror ) then
|
||||||
|
mirror_str = minetest.formspec_escape(" (mirrored)");
|
||||||
|
end
|
||||||
-- create the header
|
-- create the header
|
||||||
local formspec = "size[13,10]"..
|
local formspec = "size[13,10]"..
|
||||||
"label[3.3,0.0;Plot No.: "..tostring( plot_nr )..", with "..tostring( mg_villages.BUILDINGS[ plot.btype ].scm ).."]"..
|
"label[3.3,0.0;Plot No.: "..tostring( plot_nr )..", with "..tostring( mg_villages.BUILDINGS[ plot.btype ].scm ).."]"..
|
||||||
@ -210,7 +214,7 @@ mg_villages.plotmarker_formspec = function( pos, formname, fields, player )
|
|||||||
"button[6.0,1.0;2.0,0.5;inhabitants;Who lives here]"..
|
"button[6.0,1.0;2.0,0.5;inhabitants;Who lives here]"..
|
||||||
"label[1.0,0.5;Plot No.: "..tostring( plot_nr ).."]"..
|
"label[1.0,0.5;Plot No.: "..tostring( plot_nr ).."]"..
|
||||||
"label[2.5,0.5;Building:]"..
|
"label[2.5,0.5;Building:]"..
|
||||||
"label[3.5,0.5;"..tostring( mg_villages.BUILDINGS[btype].scm ).."]"..
|
"label[3.5,0.5;"..tostring( mg_villages.BUILDINGS[btype].scm )..mirror_str.."]"..
|
||||||
"field[20,20;0.1,0.1;pos2str;Pos;"..minetest.pos_to_string( pos ).."]";
|
"field[20,20;0.1,0.1;pos2str;Pos;"..minetest.pos_to_string( pos ).."]";
|
||||||
local formspec = "";
|
local formspec = "";
|
||||||
local ifinhabit = "";
|
local ifinhabit = "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user