Fix fill chests, adjust mg_villages config

pull/14/head
Brandon 2015-07-21 00:08:59 -05:00
parent a266d37116
commit 0a24b0b9b2
6 changed files with 35 additions and 10 deletions

View File

@ -1,2 +1,6 @@
default
mg_villages?
hangle_schematics?
mg_villages?
experience?
farming?
bushes?

20
mods/mg/fill_chests.lua Executable file
View File

@ -0,0 +1,20 @@
ADD_RCC2 = function( data )
if( data and #data>3 and ( minetest.registered_nodes[ data[1] ] or minetest.registered_items[ data[1] ]) ) then
table.insert( mg_villages.random_chest_content, data );
end
end
minetest.after(5,function()
ADD_RCC2({"farming:bread", 85, 3, 2, church=1, library=1, chest_private=1, shelf=1, shed=1, lumberjack=1, hut=1})
ADD_RCC2({"mobs:meat_raw", 70, 2, 2, church=1, library=1, chest_private=1, shelf=1, shed=1, lumberjack=1, hut=1})
ADD_RCC2({"bushes:berry_pie_cooked", 80, 4, 3, church=1, library=1, chest_private=1, shelf=1, shed=1, lumberjack=1, hut=1})
ADD_RCC2({"throwing:arrow", 30, 1, 3, church=1, library=1, chest_private=1, shelf=1, shed=1, lumberjack=1, hut=1})
ADD_RCC2({"farming:pumpkin_bread", 60, 3, 2, church=1, library=1, chest_private=1, shelf=1, shed=1, lumberjack=1, hut=1})
ADD_RCC2({"farming_plus:potato_item", 66, 2, 2, church=1, library=1, chest_private=1, shelf=1, shed=1, lumberjack=1, hut=1})
ADD_RCC2({"experience:1_exp", 90, 6, 1, chest_storage=7, chest_private=6, shelf=5})
ADD_RCC2({"experience:3_exp", 85, 3, 1, chest_storage=7, chest_private=6, shelf=5})
ADD_RCC2({"experience:6_exp", 60, 2, 1, chest_storage=7, chest_private=6, shelf=5})
ADD_RCC2({"experience:9_exp", 40, 1, 1, chest_storage=7, chest_private=6, shelf=5})
ADD_RCC2({"experience:12_exp", 30, 1, 1, chest_storage=7, chest_private=6, shelf=5})
end)

View File

@ -44,6 +44,7 @@ dofile(mgpath.."/trees.lua")
dofile(mgpath.."/biomes.lua")
dofile(mgpath.."/decorations.lua")
dofile(mgpath.."/villages.lua")
dofile(mgpath.."/fill_chests.lua")
minetest.register_on_mapgen_init(function(params)
minetest.set_mapgen_params({

View File

@ -6,7 +6,7 @@ mg_villages.ENABLE_VILLAGES = true;
-- generate one random building for each mg_villages.INVERSE_HOUSE_DENSITY th mapchunk;
-- set to 0 in order to disable spawning of these lone buildings outside villages
mg_villages.INVERSE_HOUSE_DENSITY = 4;
mg_villages.INVERSE_HOUSE_DENSITY = 0;
-- cover some villages with artificial snow; probability: 1/mg_villages.artificial_snow_probability
mg_villages.artificial_snow_probability = 10;
@ -24,7 +24,7 @@ mg_villages.VILLAGE_DETECT_RANGE = 400;
-- if set to true, only players which have the mg_villages priv can use the "/visit <village nr>"
-- command which allows teleporting to the village with the given number
mg_villages.REQUIRE_PRIV_FOR_TELEPORT = false;
mg_villages.REQUIRE_PRIV_FOR_TELEPORT = true;
-- if set to true, players cannot modify spawned villages without buying the house from the village first
mg_villages.ENABLE_PROTECTION = true;
@ -33,7 +33,7 @@ mg_villages.ENABLE_PROTECTION = true;
mg_villages.FIRST_VILLAGE_TYPE = 'medieval';
-- choose the debug level you want
mg_villages.DEBUG_LEVEL = mg_villages.DEBUG_LEVEL_NORMAL
mg_villages.DEBUG_LEVEL = mg_villages.DEBUG_LEVEL_NONE
-- background image for the /vmap command
-- RealTest comes with a diffrent texture

View File

@ -1,5 +1,5 @@
handle_schematics
default
handle_schematics
doors
farming
wool

View File

@ -5,14 +5,14 @@ mg_villages.random_chest_content = {};
-- add random chest content
local ADD_RCC = function( data )
if( data and #data>3 and minetest.registered_nodes[ data[1] ] ) then
if( data and #data>3 and ( minetest.registered_nodes[ data[1] ] or minetest.registered_items[ data[1] ]) ) then
table.insert( mg_villages.random_chest_content, data );
end
end
-- things that can be found in private, not locked chests belonging to npc
-- contains tables of the following structure: { node_name, probability (in percent, 100=always, 0=never), max_amount, repeat (for more than one stack) }
mg_villages.random_chest_content = {};
--mg_villages.random_chest_content = {};
ADD_RCC({"default:pick_stone", 10, 1, 3, farm_tiny=1, farm_full=1, shed=1, lumberjack=1, hut=1, chest_work=1, lumberjack=1 });
ADD_RCC({"default:pick_steel", 5, 1, 2, forge=1 });
@ -158,7 +158,7 @@ mg_villages.fill_chest_random = function( pos, pr, building_nr, building_typ )
if( pos.typ_name ) then
typ = pos.typ_name;
end
if( not( typ ) or (typ ~= 'cottages:shelf' and typ ~= 'cottages:chest_work' and typ ~= 'cottages:chest_storage' and typ ~= 'cottages:chest_private' )) then
if( not( typ ) or (typ ~= "default:chest" and typ ~= 'cottages:shelf' and typ ~= 'cottages:chest_work' and typ ~= 'cottages:chest_storage' and typ ~= 'cottages:chest_private' )) then
typ = building_data.typ;
else
typ = string.sub( typ, 10 );
@ -167,13 +167,13 @@ mg_villages.fill_chest_random = function( pos, pr, building_nr, building_typ )
if( typ == 'cottages:chest_work' and building_data.typ ) then
typ2 = building_data.typ;
end
--print('FILLING chest of type '..tostring( typ )..' and '..tostring( typ2));
--print('FILLING chest of type '..tostring( typ )..' and '..tostring( typ2));
if( not( typ ) or typ=='' ) then
return;
end
local inv_size = inv:get_size('main');
for i,v in ipairs( mg_villages.random_chest_content ) do
--print(v[1])
-- repeat this many times
for count=1, v[ 4 ] do