Skip to content

Commit 957f945

Browse files
committedDec 6, 2014
Remove remains of finite liquids from bucket mod
This reverts commit 79856c9.
1 parent 4ec4672 commit 957f945

File tree

1 file changed

+6
-34
lines changed

1 file changed

+6
-34
lines changed
 

‎mods/bucket/init.lua

+6-34
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
-- Minetest 0.4 mod: bucket
22
-- See README.txt for licensing and other information.
33

4-
local LIQUID_MAX = 8 --The number of water levels when liquid_finite is enabled
5-
64
minetest.register_alias("bucket", "bucket:bucket_empty")
75
minetest.register_alias("bucket_water", "bucket:bucket_water")
86
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
@@ -71,48 +69,28 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
7169
itemstack) or itemstack
7270
end
7371

74-
local place_liquid = function(pos, node, source, flowing, fullness)
72+
local place_liquid = function(pos, node, source, flowing)
7573
if check_protection(pos,
7674
user and user:get_player_name() or "",
7775
"place "..source) then
7876
return
7977
end
80-
if math.floor(fullness/128) == 1 or
81-
not minetest.setting_getbool("liquid_finite") then
82-
minetest.add_node(pos, {name=source,
83-
param2=fullness})
84-
return
85-
elseif node.name == flowing then
86-
fullness = fullness + node.param2
87-
elseif node.name == source then
88-
fullness = LIQUID_MAX
89-
end
90-
91-
if fullness >= LIQUID_MAX then
92-
minetest.add_node(pos, {name=source,
93-
param2=LIQUID_MAX})
94-
else
95-
minetest.add_node(pos, {name=flowing,
96-
param2=fullness})
97-
end
78+
minetest.add_node(pos, {name=source})
9879
end
9980

10081
-- Check if pointing to a buildable node
101-
local fullness = tonumber(itemstack:get_metadata())
102-
if not fullness then fullness = LIQUID_MAX end
103-
10482
if ndef and ndef.buildable_to then
10583
-- buildable; replace the node
10684
place_liquid(pointed_thing.under, node,
107-
source, flowing, fullness)
85+
source, flowing)
10886
else
10987
-- not buildable to; place the liquid above
11088
-- check if the node above can be replaced
11189
local node = minetest.get_node_or_nil(pointed_thing.above)
11290
if node and minetest.registered_nodes[node.name].buildable_to then
11391
place_liquid(pointed_thing.above,
11492
node, source,
115-
flowing, fullness)
93+
flowing)
11694
else
11795
-- do not remove the bucket with the liquid
11896
return
@@ -138,9 +116,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
138116
local node = minetest.get_node(pointed_thing.under)
139117
local liquiddef = bucket.liquids[node.name]
140118
if liquiddef ~= nil and liquiddef.itemname ~= nil and
141-
(node.name == liquiddef.source or
142-
(node.name == liquiddef.flowing and
143-
minetest.setting_getbool("liquid_finite"))) then
119+
node.name == liquiddef.source then
144120
if check_protection(pointed_thing.under,
145121
user:get_player_name(),
146122
"take ".. node.name) then
@@ -149,11 +125,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
149125

150126
minetest.add_node(pointed_thing.under, {name="air"})
151127

152-
if node.name == liquiddef.source then
153-
node.param2 = LIQUID_MAX
154-
end
155-
return ItemStack({name = liquiddef.itemname,
156-
metadata = tostring(node.param2)})
128+
return ItemStack(liquiddef.itemname)
157129
end
158130
end,
159131
})

0 commit comments

Comments
 (0)
Please sign in to comment.