Improve fire
This commit is contained in:
@@ -163,6 +163,7 @@ PyuTest.make_building_blocks("pyutest_blocks:ice", "Ice", { "pyutest-ice.png" },
|
||||
PyuTest.make_building_blocks("pyutest_blocks:molten_rock", "Molten Rock", { "pyutest-molten-rock.png" }, nil, {
|
||||
ground = 1,
|
||||
cracky = PyuTest.BLOCK_FAST,
|
||||
fire_persist = 1,
|
||||
}, { is_ground_content = false })
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:basalt", "Basalt", { "pyutest-basalt.png" }, nil, {
|
||||
|
31
mods/ITEMS/pyutest_blocks/crate.lua
Normal file
31
mods/ITEMS/pyutest_blocks/crate.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
PyuTest.make_node("pyutest_blocks:crate", "Crate", {
|
||||
choppy = PyuTest.BLOCK_NORMAL
|
||||
}, { "pyutest-crate.png" }, {
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inventory = meta:get_inventory()
|
||||
inventory:set_size("main", 8 * 4)
|
||||
end,
|
||||
|
||||
on_destruct = function (pos)
|
||||
local drops = {}
|
||||
PyuTest.get_inventory_drops(pos, "main", drops)
|
||||
|
||||
for _, v in pairs(drops) do
|
||||
minetest.add_item(pos, v)
|
||||
end
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
local spos = string.format("%d,%d,%d", pos.x, pos.y, pos.z)
|
||||
local formspec =
|
||||
"size[8,9]" ..
|
||||
"list[nodemeta:" .. spos .. ";main;0,0;8,4;]" ..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"listring[nodemeta:" .. spos .. ";main]" ..
|
||||
"listring[current_player;main]"
|
||||
minetest.show_formspec(clicker:get_player_name(), string.format("pyutest_blocks:crate_%d_%d_%d", pos.x, pos.y, pos.z),
|
||||
formspec)
|
||||
minetest.sound_play({ name = "crate_open", gain = 1 }, { pos = pos })
|
||||
end
|
||||
})
|
56
mods/ITEMS/pyutest_blocks/fire.lua
Normal file
56
mods/ITEMS/pyutest_blocks/fire.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
PyuTest.make_node("pyutest_blocks:fire", "Fire", {
|
||||
dig_immediate = 1,
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST,
|
||||
emits_heat = 1
|
||||
}, {
|
||||
{
|
||||
name = "pyutest-fire-animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 1
|
||||
}
|
||||
}
|
||||
}, {
|
||||
drawtype = "firelike",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
damage_per_second = 2,
|
||||
light_source = 8,
|
||||
drop = "pyutest_tools:ash 4"
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Fire Spread",
|
||||
nodenames = { "group:flammable" },
|
||||
neighbors = { "pyutest_blocks:fire" },
|
||||
interval = 1,
|
||||
chance = 4,
|
||||
action = function(pos)
|
||||
if not minetest.settings:get_bool("fire_spreads", true) then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.set_node(pos, {
|
||||
name = "pyutest_blocks:fire"
|
||||
})
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Fire Extinguish",
|
||||
nodenames = { "pyutest_blocks:fire" },
|
||||
interval = 1,
|
||||
chance = 16,
|
||||
action = function(pos)
|
||||
local name = minetest.get_node(pos - vector.new(0, 1, 0)).name
|
||||
if minetest.get_item_group(name, "fire_persist") ~= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
})
|
@@ -4,3 +4,5 @@ dofile(modpath .. "/api.lua")
|
||||
dofile(modpath .. "/basic.lua")
|
||||
dofile(modpath .. "/liquid.lua")
|
||||
dofile(modpath .. "/special.lua")
|
||||
dofile(modpath .. "/fire.lua")
|
||||
dofile(modpath .. "/crate.lua")
|
||||
|
@@ -64,31 +64,6 @@ PyuTest.make_node("pyutest_blocks:contagious_acid", "Contagious Acid", {
|
||||
solid_node = 1
|
||||
}, { "pyutest-acid.png" }, {})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:fire", "Fire", {
|
||||
dig_immediate = 1,
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST,
|
||||
emits_heat = 1
|
||||
}, {
|
||||
{
|
||||
name = "pyutest-fire-animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 1
|
||||
}
|
||||
}
|
||||
}, {
|
||||
drawtype = "firelike",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
damage_per_second = 2,
|
||||
light_source = 8,
|
||||
drop = "pyutest_tools:ash 4"
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:tnt", "TNT", {
|
||||
dig_immediate = 1,
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
|
||||
@@ -116,38 +91,6 @@ PyuTest.make_node("pyutest_blocks:tnt", "TNT", {
|
||||
end,
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:crate", "Crate", {
|
||||
choppy = PyuTest.BLOCK_NORMAL
|
||||
}, { "pyutest-crate.png" }, {
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inventory = meta:get_inventory()
|
||||
inventory:set_size("main", 8 * 4)
|
||||
end,
|
||||
|
||||
on_destruct = function (pos)
|
||||
local drops = {}
|
||||
PyuTest.get_inventory_drops(pos, "main", drops)
|
||||
|
||||
for _, v in pairs(drops) do
|
||||
minetest.add_item(pos, v)
|
||||
end
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
local spos = string.format("%d,%d,%d", pos.x, pos.y, pos.z)
|
||||
local formspec =
|
||||
"size[8,9]" ..
|
||||
"list[nodemeta:" .. spos .. ";main;0,0;8,4;]" ..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"listring[nodemeta:" .. spos .. ";main]" ..
|
||||
"listring[current_player;main]"
|
||||
minetest.show_formspec(clicker:get_player_name(), string.format("pyutest_blocks:crate_%d_%d_%d", pos.x, pos.y, pos.z),
|
||||
formspec)
|
||||
minetest.sound_play({ name = "crate_open", gain = 1 }, { pos = pos })
|
||||
end
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:workbench", "Workbench", {
|
||||
choppy = PyuTest.BLOCK_NORMAL
|
||||
}, {
|
||||
@@ -186,7 +129,8 @@ PyuTest.make_node("pyutest_blocks:ladder", "Ladder", {
|
||||
})
|
||||
|
||||
PyuTest.make_node("pyutest_blocks:magma", "Magma", {
|
||||
cracky = PyuTest.BLOCK_FAST
|
||||
cracky = PyuTest.BLOCK_FAST,
|
||||
fire_persist = 1
|
||||
}, { "pyutest-molten-rock.png" }, {
|
||||
paramtype = "light",
|
||||
light_source = 11,
|
||||
@@ -257,20 +201,3 @@ minetest.register_abm({
|
||||
})
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Fire Spread",
|
||||
nodenames = { "group:flammable" },
|
||||
neighbors = { "pyutest_blocks:fire" },
|
||||
interval = 1,
|
||||
chance = 4,
|
||||
action = function(pos)
|
||||
if not minetest.settings:get_bool("fire_spreads", true) then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.set_node(pos, {
|
||||
name = "pyutest_blocks:fire"
|
||||
})
|
||||
end
|
||||
})
|
||||
|
Reference in New Issue
Block a user