From 0a24b0b9b2facee7c52d2a16707f427dd23d6226 Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 21 Jul 2015 00:08:59 -0500 Subject: [PATCH] Fix fill chests, adjust mg_villages config --- mods/mg/depends.txt | 6 +++++- mods/mg/fill_chests.lua | 20 ++++++++++++++++++++ mods/mg/init.lua | 1 + mods/mg_villages/config.lua | 6 +++--- mods/mg_villages/depends.txt | 2 +- mods/mg_villages/fill_chest.lua | 10 +++++----- 6 files changed, 35 insertions(+), 10 deletions(-) create mode 100755 mods/mg/fill_chests.lua diff --git a/mods/mg/depends.txt b/mods/mg/depends.txt index 0910f5d..940518e 100755 --- a/mods/mg/depends.txt +++ b/mods/mg/depends.txt @@ -1,2 +1,6 @@ default -mg_villages? \ No newline at end of file +hangle_schematics? +mg_villages? +experience? +farming? +bushes? diff --git a/mods/mg/fill_chests.lua b/mods/mg/fill_chests.lua new file mode 100755 index 0000000..9da9dc8 --- /dev/null +++ b/mods/mg/fill_chests.lua @@ -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) \ No newline at end of file diff --git a/mods/mg/init.lua b/mods/mg/init.lua index af7be1f..0e40ce7 100755 --- a/mods/mg/init.lua +++ b/mods/mg/init.lua @@ -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({ diff --git a/mods/mg_villages/config.lua b/mods/mg_villages/config.lua index 5ecab24..ce7f5b5 100755 --- a/mods/mg_villages/config.lua +++ b/mods/mg_villages/config.lua @@ -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 " -- 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 diff --git a/mods/mg_villages/depends.txt b/mods/mg_villages/depends.txt index a921525..852979b 100755 --- a/mods/mg_villages/depends.txt +++ b/mods/mg_villages/depends.txt @@ -1,5 +1,5 @@ -handle_schematics default +handle_schematics doors farming wool diff --git a/mods/mg_villages/fill_chest.lua b/mods/mg_villages/fill_chest.lua index 2cafa53..2c1bcb8 100755 --- a/mods/mg_villages/fill_chest.lua +++ b/mods/mg_villages/fill_chest.lua @@ -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