2014-08-04 22:18:20 +02:00
-- reserve namespace for the villages
mg_villages = { }
2019-06-02 19:34:34 +02:00
-- Intllib
local S
if minetest.get_modpath ( " intllib " ) then
S = intllib.Getter ( )
else
S = function ( s ) return s end
end
mg_villages.intllib = S
2014-08-04 22:18:20 +02:00
mg_villages.all_villages = { }
mg_villages.mg_generated_map = { }
mg_villages.anz_villages = 0 ;
2019-06-02 19:34:34 +02:00
mg_villages.modpath = minetest.get_modpath ( " mg_villages " ) ;
2014-08-04 22:18:20 +02:00
2015-01-05 03:15:53 +01:00
mg_villages.DEBUG_LEVEL_NONE = - 1 -- -1: disable all printed messages
mg_villages.DEBUG_LEVEL_NORMAL = 0 -- 0: print information about which village spawned where plus important errors
mg_villages.DEBUG_LEVEL_WARNING = 1 -- 1: warnings/errors which may not be particulary helpful for non-developers
mg_villages.DEBUG_LEVEL_INFO = 2 -- 2: print even less important warnings
mg_villages.DEBUG_LEVEL_TIMING = 3 -- 3: detailled performance information
mg_villages.print = function ( level , msg )
if ( level <= mg_villages.DEBUG_LEVEL ) then
print ( " [mg_villages] " .. msg ) ;
end
end
2015-05-09 16:38:18 +02:00
-- save_restore is now part of handle_schematics
--dofile(mg_villages.modpath.."/save_restore.lua")
2014-08-04 22:18:20 +02:00
mg_villages.all_villages = save_restore.restore_data ( ' mg_all_villages.data ' ) ; -- read mg_villages.all_villages data saved for this world from previous runs
mg_villages.mg_generated_map = save_restore.restore_data ( ' mg_generated_map.data ' ) ;
2014-10-13 17:59:48 +02:00
dofile ( mg_villages.modpath .. " /config.lua " )
2014-08-05 19:49:02 +02:00
-- adds a special gravel node which will neither fall nor be griefed by mapgen
dofile ( mg_villages.modpath .. " /nodes.lua " )
2014-11-13 22:07:45 +01:00
-- the default game no longer provides helpful tree growing code
2020-04-08 03:13:33 +02:00
-- (but some mods may not have the default tree, jungletree and pinetree)
if ( minetest.registered_nodes [ " default:sapling " ] ) then
dofile ( mg_villages.modpath .. " /trees.lua " )
end
2014-11-13 22:07:45 +01:00
2014-12-14 13:29:28 +01:00
dofile ( mg_villages.modpath .. " /replacements.lua " )
2017-07-03 23:08:24 +02:00
-- fill mg_villages.all_buildings_list with precalculated paths
dofile ( mg_villages.modpath .. " /mg_villages_path_info.data " ) ;
2014-12-13 06:51:00 +01:00
-- multiple diffrent village types with their own sets of houses are supported
-- The function mg_villages.add_village_type( village_type_name, village_type_data )
-- allows other mods to add new village types.
dofile ( mg_villages.modpath .. " /village_types.lua " )
2017-07-21 17:03:33 +02:00
-- calls path calculation and stores front doors etc.; only called in mg_villages.add_building
dofile ( mg_villages.modpath .. " /analyze_building_for_mobs.lua " )
2014-08-04 22:18:20 +02:00
-- Note: the "buildings" talbe is not in the mg_villages.* namespace
2014-12-13 06:51:00 +01:00
-- The function mg_villages.add_building( building_data ) allows other mods to add buildings.
2014-08-04 22:18:20 +02:00
dofile ( mg_villages.modpath .. " /buildings.lua " )
2014-12-13 06:51:00 +01:00
-- mg_villages.init_weights() has to be called AFTER all village types and buildings have
-- been added using the functions above
dofile ( mg_villages.modpath .. " /init_weights.lua " )
2014-09-20 17:53:20 +02:00
-- generate village names
dofile ( mg_villages.modpath .. " /name_gen.lua " ) ;
2014-08-04 22:18:20 +02:00
dofile ( mg_villages.modpath .. " /villages.lua " )
2017-06-10 23:23:27 +02:00
-- determine type of work, name, age, bed position etc. for villagers (none included!)
dofile ( mg_villages.modpath .. " /inhabitants.lua " )
2017-07-21 17:27:20 +02:00
-- provides some extra functionality for development of mob mods etc.;
-- contains some deprecated functions
dofile ( mg_villages.modpath .. " /extras_for_development.lua " ) ;
2014-08-04 22:18:20 +02:00
-- adds a command that allows to teleport to a known village
dofile ( mg_villages.modpath .. " /chat_commands.lua " )
-- protect villages from griefing
dofile ( mg_villages.modpath .. " /protection.lua " )
2017-07-21 17:27:56 +02:00
-- allows to buy/sell/restore/.. plots and their buildings
dofile ( mg_villages.modpath .. " /plotmarker_formspec.lua " )
2014-08-04 22:18:20 +02:00
-- create and show a map of the world
dofile ( mg_villages.modpath .. " /map_of_world.lua " )
2014-08-05 01:24:11 +02:00
2014-11-08 23:01:13 +01:00
-- terrain blending for individual houses
dofile ( mg_villages.modpath .. " /terrain_blend.lua " )
2014-08-05 01:24:11 +02:00
-- the interface for the mapgen;
-- also takes care of spawning the player
dofile ( mg_villages.modpath .. " /mapgen.lua " )
2014-10-13 17:17:42 +02:00
dofile ( mg_villages.modpath .. " /spawn_player.lua " )
2017-07-09 23:31:58 +02:00
-- reconstruct the connection of the roads inside a village
dofile ( mg_villages.modpath .. " /roads.lua " )