mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-07 06:06:10 -04:00
Use a variable for the node definition
Searching a table that can get quite large isn't a good idea.
This commit is contained in:
parent
843631e760
commit
c01f86ff02
1 changed files with 4 additions and 3 deletions
|
@ -119,6 +119,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
local liquiddef = bucket.liquids[node.name]
|
local liquiddef = bucket.liquids[node.name]
|
||||||
local item_count = user:get_wielded_item():get_count()
|
local item_count = user:get_wielded_item():get_count()
|
||||||
|
local node_def = minetest.registered_nodes[node.name]
|
||||||
|
|
||||||
if liquiddef ~= nil
|
if liquiddef ~= nil
|
||||||
and liquiddef.itemname ~= nil
|
and liquiddef.itemname ~= nil
|
||||||
|
@ -153,10 +154,10 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
||||||
minetest.add_node(pointed_thing.under, {name="air"})
|
minetest.add_node(pointed_thing.under, {name="air"})
|
||||||
|
|
||||||
return ItemStack(giving_back)
|
return ItemStack(giving_back)
|
||||||
elseif minetest.registered_nodes[node.name] then
|
elseif node_def then
|
||||||
-- Buckets will run a node's on_punch function if it is not liquid.
|
-- Buckets will run a node's on_punch function if it is not liquid.
|
||||||
if minetest.registered_nodes[node.name].on_punch then
|
if node_def.on_punch then
|
||||||
minetest.registered_nodes[node.name].on_punch(
|
node_def.on_punch(
|
||||||
pointed_thing.under,
|
pointed_thing.under,
|
||||||
minetest.get_node(pointed_thing.under),
|
minetest.get_node(pointed_thing.under),
|
||||||
user,
|
user,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue