* `0`: player is drowning,
* `1`-`10`: remaining number of bubbles
* `11`: bubbles bar is not shown
-* `set_attribute(attribute, value)`: sets an extra attribute with value on player
+* `set_attribute(attribute, value)`:
+ * Sets an extra attribute with value on player.
+ * If value is nil, remove attribute from player.
* `get_attribute(attribute)`: returns value for extra attribute. Returns nil if no attribute found.
* `set_inventory_formspec(formspec)`
* Redefine player's inventory form
minetest.register_on_joinplayer(function(player)
local cb = function(player)
minetest.chat_send_player(player:get_player_name(), "This is the [minimal] \"Minimal Development Test\" game. Use [minetest_game] for the real thing.")
+ player:set_attribute("test_attribute", "test_me")
+ player:set_attribute("remove_this", nil)
end
minetest.after(2.0, cb, player)
end)
local srclist = inv:get_list("src")
local cooked = nil
-
+
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
-
+
local was_active = false
-
+
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true
meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
meta:set_string("src_time", 0)
end
end
-
+
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")
-
+
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
meta:set_string("fuel_totaltime", fuel.time)
meta:set_string("fuel_time", 0)
-
+
local stack = inv:get_stack("fuel", 1)
stack:take_item()
inv:set_stack("fuel", 1, stack)
y = y+th-1 -- (x, y, z) is now last piece of trunk
local leaves_a = VoxelArea:new{MinEdge={x=-2, y=-1, z=-2}, MaxEdge={x=2, y=2, z=2}}
local leaves_buffer = {}
-
+
-- Force leaves near the trunk
local d = 1
for xi = -d, d do
end
end
end
-
+
-- Add leaves randomly
for iii = 1, 8 do
local d = 1
local xx = pr:next(leaves_a.MinEdge.x, leaves_a.MaxEdge.x - d)
local yy = pr:next(leaves_a.MinEdge.y, leaves_a.MaxEdge.y - d)
local zz = pr:next(leaves_a.MinEdge.z, leaves_a.MaxEdge.z - d)
-
+
for xi = 0, d do
for yi = 0, d do
for zi = 0, d do
end
end
end
-
+
-- Add the leaves
for xi = leaves_a.MinEdge.x, leaves_a.MaxEdge.x do
for yi = leaves_a.MinEdge.y, leaves_a.MaxEdge.y do