poikilos
3 years ago
5 changed files with 381 additions and 0 deletions
@ -0,0 +1,155 @@ |
|||||
|
|
||||
|
local function smoke(pos, node, clicker, enable) |
||||
|
local meta = minetest.get_meta(pos) |
||||
|
local handler = meta:get_int("sound") |
||||
|
local particle = meta:get_int("smoke") |
||||
|
|
||||
|
if particle ~= 0 or enable ~= true then |
||||
|
if handler then |
||||
|
minetest.sound_stop(handler) |
||||
|
end |
||||
|
minetest.delete_particlespawner(particle) |
||||
|
meta:set_int("smoke", 0) |
||||
|
meta:set_int("sound", 0) |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
local node = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name |
||||
|
|
||||
|
if node ~= "air" or particle ~= 0 then |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
particle = minetest.add_particlespawner({ |
||||
|
amount = 4, |
||||
|
time = 0, |
||||
|
collisiondetection = true, |
||||
|
minpos = {x = pos.x - 0.25, y = pos.y + 0.4, z = pos.z-0.25}, |
||||
|
maxpos = {x = pos.x + 0.25, y = pos.y + 5, z = pos.z + 0.25}, |
||||
|
minvel = {x = -0.2, y = 0.3, z = -0.2}, |
||||
|
maxvel = {x = 0.2, y = 1, z = 0.2}, |
||||
|
minacc = {x = 0, y = 0, z = 0}, |
||||
|
maxacc = {x = 0, y = 0.5, z = 0}, |
||||
|
minexptime = 1, |
||||
|
maxexptime = 3, |
||||
|
minsize = 4, |
||||
|
maxsize = 8, |
||||
|
texture = "smoke_particle.png", |
||||
|
}) |
||||
|
|
||||
|
handler = minetest.sound_play("fire_small", { |
||||
|
pos = pos, |
||||
|
max_hear_distance = 5, |
||||
|
loop = true |
||||
|
}) |
||||
|
|
||||
|
meta:set_int("smoke", particle) |
||||
|
meta:set_int("sound", handler) |
||||
|
end |
||||
|
|
||||
|
|
||||
|
-- flame types |
||||
|
local flame_types = { |
||||
|
"green", "yellow", "black", "orange", "cyan", |
||||
|
"magenta", "purple", "blue", "red", "frosted" |
||||
|
} |
||||
|
|
||||
|
for _, f in pairs(flame_types) do |
||||
|
minetest.register_node("abriflame:" .. f .. "_fire", { |
||||
|
inventory_image = f .. "_fire_inv.png", |
||||
|
wield_image = f .. "_fire_inv.png", |
||||
|
description = f .. " fire", |
||||
|
drawtype = "plantlike", |
||||
|
paramtype = "light", |
||||
|
groups = {dig_immediate = 3, not_in_creative_inventory = 1}, |
||||
|
sunlight_propagates = true, |
||||
|
buildable_to = true, |
||||
|
walkable = false, |
||||
|
light_source = 14, |
||||
|
waving = 1, |
||||
|
drop = "", |
||||
|
tiles = {{ |
||||
|
name = f .. "_fire_animated.png", |
||||
|
animation = { |
||||
|
type = "vertical_frames", |
||||
|
aspect_w = 16, |
||||
|
aspect_h = 16, |
||||
|
length = 1.5 |
||||
|
}, |
||||
|
}}, |
||||
|
|
||||
|
on_rightclick = function (pos, node, clicker) |
||||
|
smoke(pos, node, clicker, true) |
||||
|
end, |
||||
|
|
||||
|
on_destruct = function (pos) |
||||
|
smoke(pos, nil, nil, false) |
||||
|
minetest.sound_play("fire_extinguish_flame", { |
||||
|
pos = pos, |
||||
|
max_hear_distance = 5, |
||||
|
gain = 0.25 |
||||
|
}) |
||||
|
end, |
||||
|
}) |
||||
|
end |
||||
|
|
||||
|
|
||||
|
-- fire starter tool |
||||
|
minetest.register_tool("abriflame:flint", { |
||||
|
description = "Fire Starter", |
||||
|
inventory_image = "fire_flint_steel.png", |
||||
|
stack_max = 1, |
||||
|
liquids_pointable = false, |
||||
|
|
||||
|
on_use = function(itemstack, user, pointed_thing) |
||||
|
if pointed_thing.type ~= "node" then |
||||
|
return itemstack |
||||
|
end |
||||
|
|
||||
|
local pos = ({x = pointed_thing.under.x, |
||||
|
y = pointed_thing.under.y + 1, |
||||
|
z = pointed_thing.under.z}) |
||||
|
|
||||
|
if minetest.get_node(pos).name ~= "air" or |
||||
|
minetest.is_protected(pos, user:get_player_name()) or |
||||
|
minetest.is_protected(pointed_thing.above, user:get_player_name()) then |
||||
|
return itemstack |
||||
|
end |
||||
|
|
||||
|
local nod = minetest.get_node(pointed_thing.under).name |
||||
|
|
||||
|
if nod == "abriglass:stained_glass_green" then |
||||
|
minetest.set_node(pos, {name = "abriflame:green_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_yellow" then |
||||
|
minetest.set_node(pos, {name = "abriflame:yellow_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_black" then |
||||
|
minetest.set_node(pos, {name = "abriflame:black_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_orange" then |
||||
|
minetest.set_node(pos, {name = "abriflame:orange_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_cyan" then |
||||
|
minetest.set_node(pos, {name = "abriflame:cyan_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_magenta" then |
||||
|
minetest.set_node(pos, {name = "abriflame:magenta_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_purple" then |
||||
|
minetest.set_node(pos, {name = "abriflame:purple_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_blue" then |
||||
|
minetest.set_node(pos, {name = "abriflame:blue_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_red" then |
||||
|
minetest.set_node(pos, {name = "abriflame:red_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_frosted" then |
||||
|
minetest.set_node(pos, {name = "abriflame:frosted_fire"}) |
||||
|
end |
||||
|
|
||||
|
itemstack:add_wear(65535 / 65) |
||||
|
return itemstack |
||||
|
end, |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
-- fire starter tool recipe |
||||
|
minetest.register_craft({ |
||||
|
output = "abriflame:flint", |
||||
|
recipe = { |
||||
|
{"default:mese_crystal_fragment", "default:steel_ingot"} |
||||
|
} |
||||
|
}) |
@ -0,0 +1,35 @@ |
|||||
|
|
||||
|
Textures: |
||||
|
Original textures from Semmett9's fake_fire, now found in the homedecor modpack (https://github.com/minetest-mods/homedecor_modpack), |
||||
|
with adjustments and recolouring by Shara RedCat. |
||||
|
License: CC-BY-SA 3.0 or higher (https://creativecommons.org/licenses/by/3.0/). |
||||
|
|
||||
|
Code: |
||||
|
License: MIT (https://opensource.org/licenses/MIT) |
||||
|
By Shara RedCat and tenplus1 |
||||
|
|
||||
|
|
||||
|
|
||||
|
--- |
||||
|
|
||||
|
The MIT License (MIT) |
||||
|
|
||||
|
Copyright (c) 2017 Shara RedCat |
||||
|
|
||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
|
of this software and associated documentation files (the "Software"), to deal |
||||
|
in the Software without restriction, including without limitation the rights |
||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
|
copies of the Software, and to permit persons to whom the Software is |
||||
|
furnished to do so, subject to the following conditions: |
||||
|
|
||||
|
The above copyright notice and this permission notice shall be included in |
||||
|
all copies or substantial portions of the Software. |
||||
|
|
||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
|
THE SOFTWARE. |
@ -0,0 +1,155 @@ |
|||||
|
|
||||
|
local function smoke(pos, node, clicker, enable) |
||||
|
local meta = minetest.get_meta(pos) |
||||
|
local handler = meta:get_int("sound") |
||||
|
local particle = meta:get_int("smoke") |
||||
|
|
||||
|
if particle ~= 0 or enable ~= true then |
||||
|
if handler then |
||||
|
minetest.sound_stop(handler) |
||||
|
end |
||||
|
minetest.delete_particlespawner(particle) |
||||
|
meta:set_int("smoke", 0) |
||||
|
meta:set_int("sound", 0) |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
local node = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name |
||||
|
|
||||
|
if node ~= "air" or particle ~= 0 then |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
particle = minetest.add_particlespawner({ |
||||
|
amount = 4, |
||||
|
time = 0, |
||||
|
collisiondetection = true, |
||||
|
minpos = {x = pos.x - 0.25, y = pos.y + 0.4, z = pos.z-0.25}, |
||||
|
maxpos = {x = pos.x + 0.25, y = pos.y + 5, z = pos.z + 0.25}, |
||||
|
minvel = {x = -0.2, y = 0.3, z = -0.2}, |
||||
|
maxvel = {x = 0.2, y = 1, z = 0.2}, |
||||
|
minacc = {x = 0, y = 0, z = 0}, |
||||
|
maxacc = {x = 0, y = 0.5, z = 0}, |
||||
|
minexptime = 1, |
||||
|
maxexptime = 3, |
||||
|
minsize = 4, |
||||
|
maxsize = 8, |
||||
|
texture = "smoke_particle.png", |
||||
|
}) |
||||
|
|
||||
|
handler = minetest.sound_play("fire_small", { |
||||
|
pos = pos, |
||||
|
max_hear_distance = 5, |
||||
|
loop = true |
||||
|
}) |
||||
|
|
||||
|
meta:set_int("smoke", particle) |
||||
|
meta:set_int("sound", handler) |
||||
|
end |
||||
|
|
||||
|
|
||||
|
-- flame types |
||||
|
local flame_types = { |
||||
|
"green", "yellow", "black", "orange", "cyan", |
||||
|
"magenta", "purple", "blue", "red", "frosted" |
||||
|
} |
||||
|
|
||||
|
for _, f in pairs(flame_types) do |
||||
|
minetest.register_node("abriflame:" .. f .. "_fire", { |
||||
|
inventory_image = f .. "_fire_inv.png", |
||||
|
wield_image = f .. "_fire_inv.png", |
||||
|
description = f .. " fire", |
||||
|
drawtype = "plantlike", |
||||
|
paramtype = "light", |
||||
|
groups = {dig_immediate = 3, not_in_creative_inventory = 1}, |
||||
|
sunlight_propagates = true, |
||||
|
buildable_to = true, |
||||
|
walkable = false, |
||||
|
light_source = 14, |
||||
|
waving = 1, |
||||
|
drop = "", |
||||
|
tiles = {{ |
||||
|
name = f .. "_fire_animated.png", |
||||
|
animation = { |
||||
|
type = "vertical_frames", |
||||
|
aspect_w = 16, |
||||
|
aspect_h = 16, |
||||
|
length = 1.5 |
||||
|
}, |
||||
|
}}, |
||||
|
|
||||
|
on_rightclick = function (pos, node, clicker) |
||||
|
smoke(pos, node, clicker, true) |
||||
|
end, |
||||
|
|
||||
|
on_destruct = function (pos) |
||||
|
smoke(pos, nil, nil, false) |
||||
|
minetest.sound_play("fire_extinguish_flame", { |
||||
|
pos = pos, |
||||
|
max_hear_distance = 5, |
||||
|
gain = 0.25 |
||||
|
}) |
||||
|
end, |
||||
|
}) |
||||
|
end |
||||
|
|
||||
|
|
||||
|
-- fire starter tool |
||||
|
minetest.register_tool("abriflame:flint", { |
||||
|
description = "Fire Starter", |
||||
|
inventory_image = "abriflame_fire_starter.png", |
||||
|
stack_max = 1, |
||||
|
liquids_pointable = false, |
||||
|
|
||||
|
on_use = function(itemstack, user, pointed_thing) |
||||
|
if pointed_thing.type ~= "node" then |
||||
|
return itemstack |
||||
|
end |
||||
|
|
||||
|
local pos = ({x = pointed_thing.under.x, |
||||
|
y = pointed_thing.under.y + 1, |
||||
|
z = pointed_thing.under.z}) |
||||
|
|
||||
|
if minetest.get_node(pos).name ~= "air" or |
||||
|
minetest.is_protected(pos, user:get_player_name()) or |
||||
|
minetest.is_protected(pointed_thing.above, user:get_player_name()) then |
||||
|
return itemstack |
||||
|
end |
||||
|
|
||||
|
local nod = minetest.get_node(pointed_thing.under).name |
||||
|
|
||||
|
if nod == "abriglass:stained_glass_green" then |
||||
|
minetest.set_node(pos, {name = "abriflame:green_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_yellow" then |
||||
|
minetest.set_node(pos, {name = "abriflame:yellow_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_black" then |
||||
|
minetest.set_node(pos, {name = "abriflame:black_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_orange" then |
||||
|
minetest.set_node(pos, {name = "abriflame:orange_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_cyan" then |
||||
|
minetest.set_node(pos, {name = "abriflame:cyan_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_magenta" then |
||||
|
minetest.set_node(pos, {name = "abriflame:magenta_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_purple" then |
||||
|
minetest.set_node(pos, {name = "abriflame:purple_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_blue" then |
||||
|
minetest.set_node(pos, {name = "abriflame:blue_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_red" then |
||||
|
minetest.set_node(pos, {name = "abriflame:red_fire"}) |
||||
|
elseif nod == "abriglass:stained_glass_frosted" then |
||||
|
minetest.set_node(pos, {name = "abriflame:frosted_fire"}) |
||||
|
end |
||||
|
|
||||
|
itemstack:add_wear(65535 / 65) |
||||
|
return itemstack |
||||
|
end, |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
-- fire starter tool recipe |
||||
|
minetest.register_craft({ |
||||
|
output = "abriflame:flint", |
||||
|
recipe = { |
||||
|
{"default:mese_crystal_fragment", "default:steel_ingot"} |
||||
|
} |
||||
|
}) |
@ -0,0 +1,36 @@ |
|||||
|
|
||||
|
Textures: |
||||
|
Original textures from Semmett9's fake_fire, now found in the homedecor modpack (https://github.com/minetest-mods/homedecor_modpack), |
||||
|
with adjustments and recolouring by Shara RedCat. |
||||
|
New fire starter graphic (abriflame_fire_starter.png) 2021 Poikilos |
||||
|
License: CC-BY-SA 3.0 or higher (https://creativecommons.org/licenses/by/3.0/). |
||||
|
|
||||
|
Code: |
||||
|
License: MIT (https://opensource.org/licenses/MIT) |
||||
|
By Shara RedCat, tenplus1, and Poikilos |
||||
|
|
||||
|
|
||||
|
|
||||
|
--- |
||||
|
|
||||
|
The MIT License (MIT) |
||||
|
|
||||
|
Copyright (c) 2017 Shara RedCat, 2021 Poikilos |
||||
|
|
||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
|
of this software and associated documentation files (the "Software"), to deal |
||||
|
in the Software without restriction, including without limitation the rights |
||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
|
copies of the Software, and to permit persons to whom the Software is |
||||
|
furnished to do so, subject to the following conditions: |
||||
|
|
||||
|
The above copyright notice and this permission notice shall be included in |
||||
|
all copies or substantial portions of the Software. |
||||
|
|
||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
|
THE SOFTWARE. |
After Width: | Height: | Size: 380 B |
Loading…
Reference in new issue