fixed spelt/wheat replacements for realtest

master
Sokomine 2014-09-30 16:08:04 +02:00
parent a5b4a0acdb
commit e8d559201a
2 changed files with 138 additions and 51 deletions

View File

@ -3,86 +3,171 @@
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
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 = {
{"default:pick_stone", 10, 1, 3 },
{"default:pick_steel", 5, 1, 2 },
{"default:pick_mese", 2, 1, 2 },
{"default:shovel_stone", 5, 1, 3 },
{"default:shovel_steel", 5, 1, 2 },
{"default:axe_stone", 5, 1, 3 },
{"default:axe_steel", 5, 1, 2 },
{"default:sword_stone", 1, 1, 3 },
{"default:sword_steel", 1, 1, 3 },
{"default:stick", 20, 40, 2 },
{"default:torch", 50, 10, 4 },
mg_villages.random_chest_content = {};
{"default:book", 60, 1, 2 },
{"default:paper", 60, 6, 4 },
{"default:apple", 50, 10, 2 },
{"default:ladder", 20, 1, 2 },
ADD_RCC({"default:pick_stone", 10, 1, 3, farm_tiny=1, farm_full=1, shed=1, lumberjack=1, hut=1 });
ADD_RCC({"default:pick_steel", 5, 1, 2, forge=1 });
ADD_RCC({"default:pick_mese", 2, 1, 2, forge=1 });
ADD_RCC({"default:shovel_stone", 5, 1, 3, farm_tiny=1, farm_full=1, shed=1, lumberjack=1, hut=1 });
ADD_RCC({"default:shovel_steel", 5, 1, 2, forge=1 });
ADD_RCC({"default:axe_stone", 5, 1, 3, farm_tiny=1, farm_full=1 });
ADD_RCC({"default:axe_steel", 5, 1, 2, forge=1 });
ADD_RCC({"default:sword_wood", 1, 1, 3, guard=1 });
ADD_RCC({"default:sword_stone", 1, 1, 3, guard=1 });
ADD_RCC({"default:sword_steel", 1, 1, 3, forge=1, guard=1 });
ADD_RCC({"default:stick", 20, 40, 2, church=1, library=1, chest_private=1, shelf=5, shed=1, lumberjack=1, hut=1 });
ADD_RCC({"default:torch", 50, 10, 4, church=1, library=1, chest_private=1, shelf=1, shed=1, lumberjack=1, hut=1 });
ADD_RCC({"default:book", 60, 1, 2, church=1, library=1 });
ADD_RCC({"default:paper", 60, 6, 4, church=1, library=1 });
ADD_RCC({"default:apple", 50, 10, 2, chest_storage=4, chest_private=1, shelf=5});
ADD_RCC({"default:ladder", 20, 1, 2, church=1, library=1, shed=1, lumberjack=1, hut=1 });
{"default:coal_lump", 80, 30, 1 },
{"default:steel_ingot", 30, 4, 2 },
{"default:mese_crystal_fragment", 10, 3, 1 },
ADD_RCC({"default:coal_lump", 80, 30, 1, forge=1, shed=1, lumberjack=1, hut=1});
ADD_RCC({"default:steel_ingot", 30, 4, 2, forge=1 });
ADD_RCC({"default:mese_crystal_fragment", 10, 3, 1, forge=1, chest_storage=1 });
{"bucket:bucket_empty", 10, 3, 2 },
{"bucket:bucket_water", 5, 3, 2 },
{"bucket:bucket_lava", 3, 3, 2 },
ADD_RCC({"bucket:bucket_empty", 10, 3, 2, chest_work=1, forge=1, shed=1, hut=1 });
ADD_RCC({"bucket:bucket_water", 5, 3, 2, chest_work=1, forge=1 });
ADD_RCC({"bucket:bucket_lava", 3, 3, 2, forge=1 });
{"vessels:glass_bottle", 10, 10, 2 },
{"vessels:drinking_glass", 20, 2, 1 },
{"vessels:steel_bottle", 10, 1, 1 },
ADD_RCC({"vessels:glass_bottle", 10, 10, 2, church=1, library=1, shelf=1 });
ADD_RCC({"vessels:drinking_glass", 20, 2, 1, church=1, library=1, shelf=1 });
ADD_RCC({"vessels:steel_bottle", 10, 1, 1, church=1, library=1, shelf=1 });
{"wool:white", 60, 8, 2 },
}
ADD_RCC({"wool:white", 60, 8, 2, church=1, library=1 });
-- that someone will hide valuable ingots in chests that are not locked is fairly unrealistic; thus, those items are rare
if( minetest.get_modpath("moreores") ~= nil ) then
table.insert( mg_villages.random_chest_content, {"moreores:gold_ingot", 1, 2, 1 } );
table.insert( mg_villages.random_chest_content, {"moreores:silver_ingot", 1, 2, 1 } );
table.insert( mg_villages.random_chest_content, {"moreores:copper_ingot", 30, 10, 1 } );
table.insert( mg_villages.random_chest_content, {"moreores:tin_ingot", 1, 5, 1 } );
table.insert( mg_villages.random_chest_content, {"moreores:bronze_ingot", 1, 1, 1 } );
table.insert( mg_villages.random_chest_content, {"moreores:mithril_ingot", 1, 1, 1 } );
end
ADD_RCC({"moreores:gold_ingot", 1, 2, 1 });
ADD_RCC({"moreores:silver_ingot", 1, 2, 1 });
ADD_RCC({"moreores:copper_ingot", 30, 10, 1 });
ADD_RCC({"moreores:tin_ingot", 1, 5, 1 });
ADD_RCC({"moreores:bronze_ingot", 1, 1, 1 });
ADD_RCC({"moreores:mithril_ingot", 1, 1, 1 });
-- candles are a very likely content of chests
if( minetest.get_modpath("candles") ~= nil ) then
table.insert( mg_villages.random_chest_content, {"candles:candle", 80, 12, 2 } );
table.insert( mg_villages.random_chest_content, {"candles:candelabra_steel", 1, 1, 1 } );
table.insert( mg_villages.random_chest_content, {"candles:candelabra_copper", 1, 1, 1 } );
table.insert( mg_villages.random_chest_content, {"candles:honey", 50, 2, 1 } );
end
ADD_RCC({"candles:candle", 80, 12, 2, church=1, library=1, chest_private=1 });
ADD_RCC({"candles:candelabra_steel", 1, 1, 1, church=1, library=1, chest_private=1 });
ADD_RCC({"candles:candelabra_copper", 1, 1, 1, church=1, library=1, chest_private=1 });
ADD_RCC({"candles:honey", 50, 2, 1 });
-- our NPC have to spend their free time somehow...also adds food variety
if( minetest.get_modpath("fishing") ~= nil ) then
table.insert( mg_villages.random_chest_content, {"fishing:pole", 60, 1, 1 } );
end
ADD_RCC({"fishing:pole", 60, 1, 1 });
-- ropes are always useful
if( minetest.get_modpath("ropes") ~= nil ) then
table.insert( mg_villages.random_chest_content, {"ropes:rope", 60, 5, 2 } );
ADD_RCC({"ropes:rope", 60, 5, 2, chest_work=1, shelf=1, chest_storage=1 });
elseif( minetest.get_modpath("farming") ~= nil ) then
table.insert( mg_villages.random_chest_content, {"farming:string", 60, 5, 2 } );
ADD_RCC({"farming:string", 60, 5, 2, church=1, library=1, chest_work=1, shelf=1, chest_storage=1 });
elseif( minetest.get_modpath("moreblocks") ~= nil ) then
table.insert( mg_villages.random_chest_content, {"moreblocks:rope", 60, 5, 2 } );
ADD_RCC({"moreblocks:rope", 60, 5, 2, chest_work=1, shelf=1, chest_storage=1 });
end
-- TODO: food mod
ADD_RCC({'bees:bottle_honey', 50, 4, 1, beekeeper=3, tavern=1, inn=1, chest_storage=1 });
ADD_RCC({'bees:extractor', 80, 1, 2, beekeeper=1 });
ADD_RCC({'bees:frame_empty', 50, 2, 5, beekeeper=1 });
ADD_RCC({'bees:frame_full', 80, 1, 1, beekeeper=1 });
ADD_RCC({'bees:grafting_tool', 50, 1, 3, beekeeper=1 });
ADD_RCC({'bees:hive_industrial', 100, 1, 1, beekeeper=1 });
ADD_RCC({'bees:honey_comb', 50, 2, 2, beekeeper=1 });
ADD_RCC({'bees:queen_bee', 50, 2, 3, beekeeper=1 });
ADD_RCC({'bees:smoker', 80, 1, 2, beekeeper=1 });
ADD_RCC({'bees:wax', 80, 3, 3, beekeeper=1 });
ADD_RCC({'bushes:blackberry', 80, 20, 4, bakery=1 });
ADD_RCC({'bushes:blackberry_pie_cooked', 80, 12, 4, bakery=1 });
ADD_RCC({'bushes:blueberry', 80, 20, 4, bakery=1 });
ADD_RCC({'bushes:blueberry_pie_cooked', 80, 12, 4, bakery=1 });
ADD_RCC({'bushes:gooseberry', 80, 20, 4, bakery=1 });
ADD_RCC({'bushes:gooseberry_pie_cooked', 80, 12, 4, bakery=1 });
ADD_RCC({'bushes:raspberry', 80, 20, 4, bakery=1 });
ADD_RCC({'bushes:raspberry_pie_cooked', 80, 12, 4, bakery=1 });
ADD_RCC({'bushes:mixed_berry_pie_cooked', 80, 12, 4, bakery=1 });
ADD_RCC({'bushes:sugar', 80, 99, 5, bakery=1, shelf=1 });
ADD_RCC({'carts:cart', 80, 1, 2, miner=1});
ADD_RCC({'castle:battleaxe', 50, 1, 1, guard=1, forge=1 });
ADD_RCC({'castle:ropebox', 50, 2, 2, guard=1 });
ADD_RCC({'castle:ropes', 50, 1, 1, guard=2, chest_private=1, chest_work=2 });
ADD_RCC({'castle:shield', 50, 1, 1, guard=1 });
ADD_RCC({'castle:shield_2', 50, 1, 1, guard=1 });
ADD_RCC({'castle:shield_3', 50, 1, 1, guard=1 });
ADD_RCC({'cottages:anvil', 80, 1, 2, forge=1 });
ADD_RCC({'currency:minegeld', 80, 10, 2, chest_private=1, chest_work=1 }); -- TODO: could be in any chest with a certain chance
ADD_RCC({'farming:hoe_stone', 80, 1, 2, farm_tiny=2, farm_full=2, chest_work });
ADD_RCC({'homedecor:beer_mug', 50, 1, 2, tavern=5, inn=3});
ADD_RCC({'homedecor:book_blue', 50, 1, 2, church=1, library=1, chest_private=1});
ADD_RCC({'homedecor:book_red', 50, 1, 2, church=1, library=1, chest_private=1});
ADD_RCC({'homedecor:book_green', 50, 1, 2, church=1, library=1, chest_private=1});
ADD_RCC({'homedecor:bottle_brown', 50, 1, 2, tavern=3, inn=3, chest_private=1});
ADD_RCC({'homedecor:bottle_green', 50, 1, 2, tavern=3, inn=3, chest_private=1});
ADD_RCC({'homedecor:calendar', 50, 1, 1, church=1, library=1, chest_private=1, chest_work=1, chest_storage=1});
ADD_RCC({"homedecor:candle", 50, 2, 1, church=2, library=1, chest_private=1, chest_work=1, chest_storage=1 });
ADD_RCC({"homedecor:candle_thin", 50, 2, 1, church=1, library=1, chest_private=1, chest_work=1, chest_storage=1 });
ADD_RCC({"homedecor:copper_pans", 80, 1, 1, chest_work=1 });
ADD_RCC({"homedecor:dardboard", 50, 1, 1, tavern=1});
ADD_RCC({"homedecor:oil_extract", 80, 1, 3, church=1, library=1, chest_private=1, chest_work=1, chest_storage=1 });
ADD_RCC({"homedecor:oil_lamp", 50, 2, 1, church=1, library=1, chest_private=1, chest_work=1, chest_storage=1 });
ADD_RCC({"homedecor:torch_wall", 50, 2, 1, church=1, library=1, chest_private=1, chest_work=1, chest_storage=1 });
ADD_RCC({"locks:key", 50, 2, 1, chest_private=1, chest_work=1, chest_storage=1, forge=1 });
ADD_RCC({"locks:keychain", 50, 2, 1, chest_private=1, chest_work=1, chest_storage=1, forge=1 });
ADD_RCC({"moretrees:coconut_milk", 80, 5, 2, tavern=1, inn=1 });
ADD_RCC({"moretrees:raw_coconut", 80, 5, 2, tavern=1, inn=1 });
ADD_RCC({"moretrees:pine_nuts", 80, 99, 1, tavern=1, inn=1, chest_storage=3 });
ADD_RCC({"moretrees:spruce_nuts", 80, 99, 1, tavern=1, inn=1, chest_storage=3 });
ADD_RCC({"quartz:quartz_crystal", 80, 1, 1, library=1 });
ADD_RCC({"screwdriver:screwdriver", 80, 1, 1, chest_work=1 });
ADD_RCC({"unified_inventory:bag_large", 80, 1, 1, chest_private=1, chest_storage=2 });
ADD_RCC({"unified_inventory:bag_medium", 80, 1, 1, chest_private=1, chest_storage=2 });
ADD_RCC({"unified_inventory:bag_small", 80, 1, 1, tavern=1, inn=1, chest_work=1, chest_private=1 });
-- get some random content for a chest
mg_villages.fill_chest_random = function( pos, pr, building_nr, building_typ )
local building_data = mg_villages.BUILDINGS[ building_nr.btype ];
local meta = minetest.env:get_meta( pos );
local inv = meta:get_inventory();
local count = 0;
local typ = minetest.get_name_from_content_id( pos.typ );
if( not( typ ) or (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 );
end
local typ2 = nil;
if( typ == 'cottages:chest_work' and building_data.typ ) then
typ2 = building_data.typ;
end
--print('FILLING chest of type '..tostring( typ ));
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
@ -91,6 +176,7 @@ mg_villages.fill_chest_random = function( pos, pr, building_nr, building_typ )
-- to avoid too many things inside a chest, lower probability
if( count<30 -- make sure it does not get too much and there is still room for a new stack
and (v[ typ ] or (typ2 and v[ typ2 ]))
and inv_size and inv_size > 0 and v[ 2 ] > pr:next( 1, 200 )) then
--inv:add_item('main', v[ 1 ].." "..tostring( math.random( 1, tonumber(v[ 3 ]) )));
@ -102,7 +188,8 @@ mg_villages.fill_chest_random = function( pos, pr, building_nr, building_typ )
end
end
--[[ -- TODO
--[[
--the old code used by Nores mg mapgen
for _, n in pairs(village.to_add_data.extranodes) do
-- minetest.set_node(n.pos, n.node)

View File

@ -273,8 +273,8 @@ mg_villages.get_replacement_list = function( housetype, pr )
-- realtest lacks quite a lot from default
if( mg_villages.realtest_trees ) then
for i=1,8 do
table.insert( replacements, {'farming:wheat_'..i, 'farming:spelt_'..tostring( math.floor( (i+0.5)/2 )) });
table.insert( replacements, {'farming:cotton_'..i, 'farming:flax_' ..tostring( math.floor( (i+0.5)/2 )) });
table.insert( replacements, {'farming:wheat_'..i, 'farming:spelt_'..tostring( (i+(i%2))/2) });
table.insert( replacements, {'farming:cotton_'..i, 'farming:flax_' ..tostring( (i+(i%2))/2) });
end
for i=1,5 do
table.insert( replacements, {'default:grass_'..i, 'air' });