1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-22 23:10:17 +01:00

Fix bucket code indentation

This commit is contained in:
ShadowNinja 2015-03-07 21:26:55 -05:00
parent 41837e6193
commit 794a436d86

View File

@ -103,55 +103,55 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
end end
minetest.register_craftitem("bucket:bucket_empty", { minetest.register_craftitem("bucket:bucket_empty", {
description = "Empty Bucket", description = "Empty Bucket",
inventory_image = "bucket.png", inventory_image = "bucket.png",
stack_max = 99, stack_max = 99,
liquids_pointable = true, liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to node -- Must be pointing to node
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
return return
end end
-- Check if pointing to a liquid source -- Check if pointing to a liquid source
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()
if liquiddef ~= nil if liquiddef ~= nil
and liquiddef.itemname ~= nil and liquiddef.itemname ~= nil
and node.name == liquiddef.source then and node.name == liquiddef.source then
if check_protection(pointed_thing.under, if check_protection(pointed_thing.under,
user:get_player_name(), user:get_player_name(),
"take ".. node.name) then "take ".. node.name) then
return return
end end
-- default set to return filled bucket -- default set to return filled bucket
local giving_back = liquiddef.itemname local giving_back = liquiddef.itemname
-- check if holding more than 1 empty bucket -- check if holding more than 1 empty bucket
if item_count > 1 then if item_count > 1 then
-- if space in inventory add filled bucked, otherwise drop as item -- if space in inventory add filled bucked, otherwise drop as item
local inv = user:get_inventory() local inv = user:get_inventory()
if inv:room_for_item("main", {name=liquiddef.itemname}) then if inv:room_for_item("main", {name=liquiddef.itemname}) then
inv:add_item("main", liquiddef.itemname) inv:add_item("main", liquiddef.itemname)
else else
local pos = user:getpos() local pos = user:getpos()
pos.y = math.floor(pos.y + 0.5) pos.y = math.floor(pos.y + 0.5)
core.add_item(pos, liquiddef.itemname) core.add_item(pos, liquiddef.itemname)
end end
-- set to return empty buckets minus 1 -- set to return empty buckets minus 1
giving_back = "bucket:bucket_empty "..tostring(item_count-1) giving_back = "bucket:bucket_empty "..tostring(item_count-1)
end end
minetest.add_node(pointed_thing.under, {name="air"}) minetest.add_node(pointed_thing.under, {name="air"})
return ItemStack(giving_back) return ItemStack(giving_back)
end end
end, end,
}) })
bucket.register_liquid( bucket.register_liquid(