1
1
-- Minetest 0.4 mod: bucket
2
2
-- See README.txt for licensing and other information.
3
3
4
- local LIQUID_MAX = 8 -- The number of water levels when liquid_finite is enabled
5
-
6
4
minetest .register_alias (" bucket" , " bucket:bucket_empty" )
7
5
minetest .register_alias (" bucket_water" , " bucket:bucket_water" )
8
6
minetest .register_alias (" bucket_lava" , " bucket:bucket_lava" )
@@ -71,48 +69,28 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
71
69
itemstack ) or itemstack
72
70
end
73
71
74
- local place_liquid = function (pos , node , source , flowing , fullness )
72
+ local place_liquid = function (pos , node , source , flowing )
75
73
if check_protection (pos ,
76
74
user and user :get_player_name () or " " ,
77
75
" place " .. source ) then
78
76
return
79
77
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 })
98
79
end
99
80
100
81
-- Check if pointing to a buildable node
101
- local fullness = tonumber (itemstack :get_metadata ())
102
- if not fullness then fullness = LIQUID_MAX end
103
-
104
82
if ndef and ndef .buildable_to then
105
83
-- buildable; replace the node
106
84
place_liquid (pointed_thing .under , node ,
107
- source , flowing , fullness )
85
+ source , flowing )
108
86
else
109
87
-- not buildable to; place the liquid above
110
88
-- check if the node above can be replaced
111
89
local node = minetest .get_node_or_nil (pointed_thing .above )
112
90
if node and minetest .registered_nodes [node .name ].buildable_to then
113
91
place_liquid (pointed_thing .above ,
114
92
node , source ,
115
- flowing , fullness )
93
+ flowing )
116
94
else
117
95
-- do not remove the bucket with the liquid
118
96
return
@@ -138,9 +116,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
138
116
local node = minetest .get_node (pointed_thing .under )
139
117
local liquiddef = bucket .liquids [node .name ]
140
118
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
144
120
if check_protection (pointed_thing .under ,
145
121
user :get_player_name (),
146
122
" take " .. node .name ) then
@@ -149,11 +125,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
149
125
150
126
minetest .add_node (pointed_thing .under , {name = " air" })
151
127
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 )
157
129
end
158
130
end ,
159
131
})
0 commit comments