2017-04-25 17:39:41 +02:00
|
|
|
-- if the player builds a house manually, there are some nodes the players cannot
|
|
|
|
-- supply as the nodes are not obtainable (only their drop) - thus, in most cases,
|
|
|
|
-- the drop is what we ask for; except for these nodes where the origianl node
|
|
|
|
-- can be obtained through smelting/crafting:
|
|
|
|
handle_schematics.direct_instead_of_drop = {};
|
|
|
|
handle_schematics.direct_instead_of_drop[ "default:stone" ] = true;
|
|
|
|
handle_schematics.direct_instead_of_drop[ "default:desert_stone" ] = true;
|
|
|
|
handle_schematics.direct_instead_of_drop[ "default:clay" ] = true;
|
|
|
|
|
|
|
|
|
|
|
|
-- stores a table of node names and what the player can provide instead
|
|
|
|
-- of the very node; this is necessary as i.e. default:grass_5 cannot
|
|
|
|
-- be obtained without creative (it drops default:grass_1 or sometimes
|
|
|
|
-- wheat seeds); same applies for farming plants
|
|
|
|
handle_schematics.player_can_provide = {};
|
|
|
|
for i=1,5 do
|
|
|
|
handle_schematics.player_can_provide[ "default:grass_"..i ] = "default:grass_1";
|
|
|
|
end
|
|
|
|
-- neither can partly grown wheat or cotton plants be obtained
|
|
|
|
for i=1,8 do
|
|
|
|
handle_schematics.player_can_provide[ "farming:wheat_"..i ] = "farming:seed_wheat";
|
|
|
|
end
|
|
|
|
for i=1,8 do
|
|
|
|
handle_schematics.player_can_provide[ "farming:cotton_"..i ] = "farming:seed_cotton";
|
|
|
|
end
|
2017-04-26 01:23:08 +02:00
|
|
|
handle_schematics.player_can_provide[ "default:water_source" ] = "bucket:bucket_water";
|
|
|
|
handle_schematics.player_can_provide[ "default:river_water_source" ] = "bucket:bucket_river_water";
|
|
|
|
handle_schematics.player_can_provide[ "default:lava_source" ] = "bucket:bucket_lava";
|
2017-04-25 17:39:41 +02:00
|
|
|
|
|
|
|
-- makes use of handle_schematics.player_can_provide; but also takes
|
|
|
|
-- the drop into account (for i.e. doors or other open/closed nodes)
|
|
|
|
handle_schematics.get_what_player_can_provide = function( node_wanted )
|
|
|
|
|
|
|
|
-- stone, desert_stone, clay and perhaps some other nodes can be obtained even
|
|
|
|
-- though they drop something diffrent
|
|
|
|
if( handle_schematics.direct_instead_of_drop[ node_wanted ] ) then
|
|
|
|
return node_wanted;
|
|
|
|
end
|
|
|
|
|
|
|
|
-- the player can i.e. provide seeds for a plant or the harvested grass_1
|
|
|
|
if( handle_schematics.player_can_provide[ node_wanted ]) then
|
|
|
|
return handle_schematics.player_can_provide[ node_wanted ];
|
|
|
|
end
|
|
|
|
|
|
|
|
-- some nodes like i.e. dirt with grass or stone with coal cannot be obtained;
|
|
|
|
-- in such a case we ask for the drop; this is also useful for doors etc.
|
2017-06-26 23:26:36 +02:00
|
|
|
local node_def = handle_schematics.node_defined( node_wanted );
|
|
|
|
if( node_def
|
2017-04-25 17:39:41 +02:00
|
|
|
-- provided the drop actually exists
|
2017-06-26 23:26:36 +02:00
|
|
|
and node_def.drop
|
|
|
|
and minetest.registered_items[ node_def.drop ]) then
|
2017-04-25 17:39:41 +02:00
|
|
|
|
2017-06-26 23:26:36 +02:00
|
|
|
return node_def.drop;
|
2017-04-25 17:39:41 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
-- the player ought to be able to come up with this node (or we need to define more exceptions)
|
|
|
|
return node_wanted;
|
|
|
|
end
|