Fix some warnings on undeclared variables & add NALC liquids support

This commit is contained in:
Sys Quatre 2020-07-20 01:00:54 +02:00
parent 7bfcb73607
commit 95ce57d6e5
2 changed files with 18 additions and 14 deletions

View File

@ -96,7 +96,7 @@ minetest.register_tool( "replacer:replacer",
-- just place the stored node if now new one is to be selected
if( not( keys["sneak"] )) then
return replacer.replace( itemstack, placer, pointed_thing, 0 ); end
return replacer.replace( itemstack, placer, pointed_thing, true ); end
if( pointed_thing.type ~= "node" ) then
@ -104,7 +104,7 @@ minetest.register_tool( "replacer:replacer",
return nil;
end
local pos = minetest.get_pointed_thing_position( pointed_thing, under );
local pos = minetest.get_pointed_thing_position( pointed_thing, false );
local node = minetest.get_node_or_nil( pos );
--minetest.chat_send_player( name, " Target node: "..minetest.serialize( node ).." at pos "..minetest.serialize( pos )..".");
@ -124,7 +124,7 @@ minetest.register_tool( "replacer:replacer",
on_use = function(itemstack, user, pointed_thing)
return replacer.replace( itemstack, user, pointed_thing, above );
return replacer.replace( itemstack, user, pointed_thing, false );
end,
})
@ -221,14 +221,18 @@ replacer.replace = function( itemstack, user, pointed_thing, mode )
-- give the player the item by simulating digging if possible
if( node.name ~= "air"
and node.name ~= "ignore"
and node.name ~= "default:lava_source"
and node.name ~= "default:lava_flowing"
and node.name ~= "default:river_water_source"
and node.name ~= "default:river_water_flowing"
and node.name ~= "default:water_source"
and node.name ~= "default:water_flowing" ) then
if( node.name ~= "air"
and node.name ~= "ignore"
and node.name ~= "default:lava_source"
and node.name ~= "default:lava_flowing"
and node.name ~= "default:river_water_source"
and node.name ~= "default:river_water_flowing"
and node.name ~= "default:water_source"
and node.name ~= "default:water_flowing"
and node.name ~= "nalc:acid_source"
and node.name ~= "nalc:acid_flowing"
and node.name ~= "nalc:sand_source"
and node.name ~= "nalc:sand_flowing" ) then
minetest.node_dig( pos, node, user );
@ -265,4 +269,4 @@ minetest.register_craft({
}
})
minetest.log("action", "[replacer] loaded.")

View File

@ -190,7 +190,7 @@ replacer.add_circular_saw_receipe = function( node_name, receipes )
if( not( help ) or #help ~= 2 or help[1]=='stairs') then
return;
end
help2 = help[2]:split('_');
local help2 = help[2]:split('_');
if( not( help2 ) or #help2 < 2 or (help2[1]~='micro' and help2[1]~='panel' and help2[1]~='stair' and help2[1]~='slab')) then
return;
end
@ -199,7 +199,7 @@ replacer.add_circular_saw_receipe = function( node_name, receipes )
-- TODO: write better and more correct method of getting the names of the materials
-- TODO: make sure only nodes produced by the saw are listed here
help[1]='default';
help[1]='default';
local basic_node_name = help[1]..':'..help2[2];
-- node found that fits into the saw
receipes[ #receipes+1 ] = { method = 'saw', type = 'saw', items = { basic_node_name }, output = node_name};