2015-05-01 18:04:03 +02:00
|
|
|
|
2015-05-01 18:10:43 +02:00
|
|
|
handle_schematics = {}
|
2015-05-01 18:04:03 +02:00
|
|
|
|
2017-06-07 22:43:29 +02:00
|
|
|
-- use the priv "creative" as provided by unified_inventory - or define it new;
|
|
|
|
-- the priv allows the player to spawn the schematics direclty (without scaffolding)
|
|
|
|
if( not( minetest.get_modpath( 'unified_inventory' ))) then
|
|
|
|
minetest.register_privilege("creative", {
|
|
|
|
description = "Can place schematics directly without scaffolding",
|
|
|
|
give_to_singleplayer = false,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2015-05-01 18:04:03 +02:00
|
|
|
handle_schematics.modpath = minetest.get_modpath( "handle_schematics");
|
|
|
|
|
2017-06-26 23:26:36 +02:00
|
|
|
-- realtest handles some things diffrently without beeing easy to identify
|
|
|
|
handle_schematics.is_realtest = nil;
|
|
|
|
if( minetest.registered_nodes["oven:oven"]
|
|
|
|
and not( minetest.registered_nodes["default:furnace"])
|
|
|
|
and minetest.registered_nodes["grounds:clay"]
|
|
|
|
and not( minetest.registered_nodes["default:clay"])) then
|
|
|
|
handle_schematics.is_realtest = true;
|
|
|
|
end
|
|
|
|
|
|
|
|
-- globally change nodes from the schematics into others; useful if you
|
|
|
|
-- i.e. do not have default installed
|
|
|
|
dofile(handle_schematics.modpath.."/replacements_global.lua")
|
|
|
|
|
2017-06-05 14:47:15 +02:00
|
|
|
-- populate handle_schematics.bed_node_names and handle_schematics.bed_content_ids
|
|
|
|
dofile(handle_schematics.modpath.."/mob_bed_detection.lua")
|
|
|
|
|
2015-05-01 18:04:03 +02:00
|
|
|
-- adds worldedit_file.* namespace
|
|
|
|
-- deserialize worldedit savefiles
|
|
|
|
dofile(handle_schematics.modpath.."/worldedit_file.lua")
|
|
|
|
|
|
|
|
-- uses handle_schematics.* namespace
|
|
|
|
-- reads and analyzes .mts files (minetest schematics)
|
|
|
|
dofile(handle_schematics.modpath.."/analyze_mts_file.lua")
|
|
|
|
-- reads and analyzes worldedit files
|
|
|
|
dofile(handle_schematics.modpath.."/analyze_we_file.lua")
|
2015-07-10 05:53:36 +02:00
|
|
|
-- reads and analyzes Minecraft schematic files
|
|
|
|
dofile(handle_schematics.modpath.."/translate_nodenames_for_mc_schematic.lua")
|
|
|
|
dofile(handle_schematics.modpath.."/analyze_mc_schematic_file.lua")
|
2015-05-01 18:04:03 +02:00
|
|
|
-- handles rotation and mirroring
|
|
|
|
dofile(handle_schematics.modpath.."/rotate.lua")
|
|
|
|
-- count nodes, take param2 into account for rotation etc.
|
|
|
|
dofile(handle_schematics.modpath.."/handle_schematics_misc.lua")
|
|
|
|
|
2015-05-09 16:47:10 +02:00
|
|
|
-- store and restore metadata
|
|
|
|
dofile(handle_schematics.modpath.."/save_restore.lua");
|
|
|
|
dofile(handle_schematics.modpath.."/handle_schematics_meta.lua");
|
|
|
|
|
2015-05-01 18:04:03 +02:00
|
|
|
-- uses replacements_group.* namespace
|
|
|
|
-- these functions are responsible for the optional dependencies; they check
|
|
|
|
-- which nodes are available and may be offered as possible replacements
|
|
|
|
replacements_group = {};
|
2015-05-01 20:23:29 +02:00
|
|
|
-- the replacement groups do add some non-ground nodes; needed by mg_villages
|
|
|
|
replacements_group.node_is_ground = {}
|
2016-03-20 23:57:53 +01:00
|
|
|
dofile(handle_schematics.modpath.."/replacements_discontinued_nodes.lua")
|
2015-05-01 18:04:03 +02:00
|
|
|
dofile(handle_schematics.modpath.."/replacements_wood.lua")
|
|
|
|
dofile(handle_schematics.modpath.."/replacements_realtest.lua")
|
|
|
|
dofile(handle_schematics.modpath.."/replacements_farming.lua")
|
|
|
|
dofile(handle_schematics.modpath.."/replacements_roof.lua")
|
|
|
|
|
|
|
|
-- transforms the replacement list into a table;
|
|
|
|
-- also creates a replacement if needed and replaces default:torch
|
|
|
|
dofile(handle_schematics.modpath.."/replacements_get_table.lua")
|
|
|
|
|
2017-04-24 18:59:24 +02:00
|
|
|
|
2017-04-27 20:14:17 +02:00
|
|
|
-- apart from dirt_with_grass, some other nodes may not be obtainable without
|
|
|
|
-- creative because their drop is diffrent from their node name (i.e grass,
|
|
|
|
-- farming, doors, ..)
|
|
|
|
dofile(handle_schematics.modpath.."/player_can_provide.lua")
|
|
|
|
|
2017-04-24 18:59:24 +02:00
|
|
|
-- assume dirt to be a general placeholder for "something you can
|
|
|
|
-- walk on"; might be stone, other dirt types etc.; this also
|
|
|
|
-- accepts other dirt and sand types for dirt_with_grass
|
|
|
|
dofile(handle_schematics.modpath.."/dirt_is_not_always_dirt.lua")
|
|
|
|
-- actually enable it (if you do not want this function just set
|
|
|
|
-- handle_schematics.also_acceptable = {} somewhere in your code
|
|
|
|
handle_schematics.enable_use_dirt_as_placeholder();
|
2017-04-27 20:14:17 +02:00
|
|
|
-- doors have the tendency to come in either "open" or "closed" state - neither
|
|
|
|
-- of which ought to make a difference
|
|
|
|
handle_schematics.enable_doors_open_closed();
|
2017-04-25 17:39:41 +02:00
|
|
|
|
2015-05-01 18:04:03 +02:00
|
|
|
-- uses build_chest.* namespace
|
|
|
|
-- a chest for spawning buildings manually
|
|
|
|
dofile(handle_schematics.modpath.."/build_chest.lua")
|
|
|
|
-- makes the replacements from replacements_group.* available to the build chest
|
|
|
|
dofile(handle_schematics.modpath.."/build_chest_handle_replacements.lua");
|
|
|
|
-- creates 2d previews of the schematic from left/right/back/front/top
|
|
|
|
dofile(handle_schematics.modpath.."/build_chest_preview_image.lua");
|
|
|
|
-- reads a file and adds the files listed there as menu entries
|
|
|
|
dofile(handle_schematics.modpath.."/build_chest_add_schems_from_file.lua");
|
2015-07-05 03:14:24 +02:00
|
|
|
-- locate schematics through directories
|
|
|
|
dofile(handle_schematics.modpath.."/build_chest_add_schems_by_directory.lua");
|
2015-05-01 18:04:03 +02:00
|
|
|
|
|
|
|
-- the main functionality of the mod;
|
|
|
|
-- provides the function handle_schematics.place_building_from_file
|
|
|
|
-- (and also place_buildings for mg_villages)
|
|
|
|
dofile(handle_schematics.modpath.."/place_buildings.lua")
|
|
|
|
|
|
|
|
-- dofile(handle_schematics.modpath.."/fill_chest.lua")
|
2015-05-24 15:12:51 +02:00
|
|
|
|
|
|
|
dofile(handle_schematics.modpath.."/nodes.lua")
|