1
0
Fork 0

Fixed missed alias uses and added set_node alias.

Two instances of add_node and add_item still used the full minetest
call, substitute the alias.
Added a set_node alias for several minetest.set_node calls.
This commit is contained in:
kabou 2022-02-20 17:58:17 +01:00
parent 315f251584
commit 13baa68b67
1 changed files with 6 additions and 5 deletions

View File

@ -19,6 +19,7 @@ local string = string
local raycast = minetest.raycast local raycast = minetest.raycast
local get_node = minetest.get_node local get_node = minetest.get_node
local set_node = minetest.set_node
local add_node = minetest.add_node local add_node = minetest.add_node
local add_item = minetest.add_item local add_item = minetest.add_item
@ -58,7 +59,7 @@ end
local function place_liquid(pos, itemstring) local function place_liquid(pos, itemstring)
local fullness = registered_nodes[itemstring].liquid_range local fullness = registered_nodes[itemstring].liquid_range
sound_place(itemstring, pos) sound_place(itemstring, pos)
minetest.add_node(pos, {name=itemstring, param2=fullness}) add_node(pos, {name=itemstring, param2=fullness})
end end
local function give_bucket(new_bucket, itemstack, user) local function give_bucket(new_bucket, itemstack, user)
@ -272,14 +273,14 @@ local function on_place_bucket_empty(itemstack, user, pointed_thing)
-- FIXME: replace this ugly code by cauldrons API -- FIXME: replace this ugly code by cauldrons API
if nn == "mcl_cauldrons:cauldron_3" then if nn == "mcl_cauldrons:cauldron_3" then
-- Take water out of full cauldron -- Take water out of full cauldron
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"}) set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
if not minetest.is_creative_enabled(user:get_player_name()) then if not minetest.is_creative_enabled(user:get_player_name()) then
new_bucket = ItemStack("mcl_buckets:bucket_water") new_bucket = ItemStack("mcl_buckets:bucket_water")
end end
sound_take("mcl_core:water_source", pointed_thing.under) sound_take("mcl_core:water_source", pointed_thing.under)
elseif nn == "mcl_cauldrons:cauldron_3r" then elseif nn == "mcl_cauldrons:cauldron_3r" then
-- Take river water out of full cauldron -- Take river water out of full cauldron
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"}) set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
if not minetest.is_creative_enabled(user:get_player_name()) then if not minetest.is_creative_enabled(user:get_player_name()) then
new_bucket = ItemStack("mcl_buckets:bucket_river_water") new_bucket = ItemStack("mcl_buckets:bucket_river_water")
end end
@ -384,13 +385,13 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
collect_liquid = true collect_liquid = true
end end
if collect_liquid then if collect_liquid then
minetest.set_node(droppos, {name="air"}) set_node(droppos, {name="air"})
-- Fill bucket with liquid -- Fill bucket with liquid
stack = new_bucket stack = new_bucket
else else
-- No liquid found: Drop empty bucket -- No liquid found: Drop empty bucket
minetest.add_item(droppos, stack) add_item(droppos, stack)
stack:take_item() stack:take_item()
end end
return stack return stack