small updates and cleaning of code.

master
NathanSalapat 2020-06-04 22:04:36 -05:00
parent 25cf56720a
commit b86d78cc77
24 changed files with 1204 additions and 1031 deletions

View File

@ -1,19 +0,0 @@
Textures:
Flint image created by me with Blender.
Charcoal_Lump created from the default_coal_lump that ships with minetest.
campfire inventory image from Esteban on the minetest forum licensed CC by SA
Kindling inventory image created by modifying Esteban's campfire image.
Lighter image created by me with Blender.
Code:
3d torch code and nodebox's from Carbone, by Calinou CC0 1.0 Will be replaced with mesh torches once I figure that bit out.
Smokebomb and molotov cocktail coded by Napiophelios
Inspiration:
Napiophelios, from the forum, who gave me some really good ideas from the old campfire mod, which I didn't even know about.
Sound Effects:
Sparker sound from BroAsis on Freesound. https://www.freesound.org/people/BroAsis/sounds/106853/

View File

@ -1,3 +0,0 @@
This mod is licensed CC by SA, I'd do it at CC 0, but I've used some CC by SA items, so I have to use that. When I replace everything with my own materials I'll change it to CC 0.
Feel free to dissect and use portions of code or graphics for your own projects.

356
abms.lua
View File

@ -1,198 +1,196 @@
minetest.register_abm({ -- Controls non-contained fire minetest.register_abm({ -- Controls non-contained fire
nodenames = {'more_fire:embers','more_fire:campfire'}, nodenames = {'more_fire:embers','more_fire:campfire'},
interval = 1.0, interval = 1.0,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local fuel_time = meta:get_float("fuel_time") or 0 local fuel_time = meta:get_float("fuel_time") or 0
local src_time = meta:get_float("src_time") or 0 local src_time = meta:get_float("src_time") or 0
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
local inv = meta:get_inventory() local inv = meta:get_inventory()
local srclist = inv:get_list("src") local srclist = inv:get_list("src")
local cooked = nil local cooked = nil
if srclist then if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end end
local was_active = false local was_active = false
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true was_active = true
meta:set_float("fuel_time", meta:get_float("fuel_time") + 0.25) meta:set_float("fuel_time", meta:get_float("fuel_time") + 0.25)
meta:set_float("src_time", meta:get_float("src_time") + 0.25) meta:set_float("src_time", meta:get_float("src_time") + 0.25)
if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
if inv:room_for_item("dst",cooked.item) then if inv:room_for_item("dst",cooked.item) then
inv:add_item("dst", cooked.item) inv:add_item("dst", cooked.item)
local srcstack = inv:get_stack("src", 1) local srcstack = inv:get_stack("src", 1)
srcstack:take_item() srcstack:take_item()
inv:set_stack("src", 1, srcstack) inv:set_stack("src", 1, srcstack)
else end
print("Could not insert '"..cooked.item:to_string().."'") meta:set_string("src_time", 0)
end end
meta:set_string("src_time", 0) end
end
end
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
minetest.sound_play({name="campfire_small"},{pos=pos}, {max_hear_distance = 1},{loop=true},{gain=0.009}) minetest.sound_play({name="campfire_small"},{pos=pos}, {max_hear_distance = 1},{loop=true},{gain=0.009})
local percent = math.floor(meta:get_float("fuel_time") / local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100) meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext","Campfire active: "..percent.."%") meta:set_string("infotext","Campfire active: "..percent.."%")
minetest.swap_node(pos, {name = 'more_fire:campfire'}) minetest.swap_node(pos, {name = 'more_fire:campfire'})
return return
end end
local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
local cookable = true
if cooked.time == 0 then
cookable = false
end
local item_state = ''
local item_percent = 0
if cookable then
item_percent = math.floor(src_time / cooked.time * 100)
item_state = item_percent .. "%"
end
local fuel = nil local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
local cooked = nil local cookable = true
local fuellist = inv:get_list("fuel") if cooked.time == 0 then
local srclist = inv:get_list("src") cookable = false
if srclist then end
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end local item_state = ''
local item_percent = 0
if fuellist then if cookable then
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) item_percent = math.floor(src_time / cooked.time * 100)
end item_state = item_percent .. "%"
end
if fuel.time <= 0 then
meta:set_string("infotext","The campfire is out.") local fuel = nil
minetest.swap_node(pos, {name = 'more_fire:embers'}) local cooked = nil
meta:set_string("formspec", more_fire.fire_formspec(item_percent)) local fuellist = inv:get_list("fuel")
return local srclist = inv:get_list("src")
end if srclist then
meta:set_string("fuel_totaltime", fuel.time) cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
meta:set_string("fuel_time", 0) end
local stack = inv:get_stack("fuel", 1)
stack:take_item() if fuellist then
inv:set_stack("fuel", 1, stack) fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
meta:set_string("formspec", more_fire.fire_formspec(item_percent)) end
end,
if fuel.time <= 0 then
meta:set_string("infotext","The campfire is out.")
minetest.swap_node(pos, {name = 'more_fire:embers'})
meta:set_string("formspec", more_fire.fire_formspec(item_percent))
return
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)
meta:set_string("formspec", more_fire.fire_formspec(item_percent))
end,
}) })
minetest.register_abm({ -- Controls the contained fires. minetest.register_abm({ -- Controls the contained fires.
nodenames = {'more_fire:embers_contained', 'more_fire:campfire_contained'}, nodenames = {'more_fire:embers_contained', 'more_fire:campfire_contained'},
interval = 1.0, interval = 1.0,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local fuel_time = meta:get_float("fuel_time") or 0 local fuel_time = meta:get_float("fuel_time") or 0
local src_time = meta:get_float("src_time") or 0 local src_time = meta:get_float("src_time") or 0
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
local inv = meta:get_inventory() local inv = meta:get_inventory()
local srclist = inv:get_list("src") local srclist = inv:get_list("src")
local cooked = nil local cooked = nil
if srclist then if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end end
local was_active = false local was_active = false
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true was_active = true
meta:set_float("fuel_time", meta:get_float("fuel_time") + 0.25) meta:set_float("fuel_time", meta:get_float("fuel_time") + 0.25)
meta:set_float("src_time", meta:get_float("src_time") + 0.25) meta:set_float("src_time", meta:get_float("src_time") + 0.25)
if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
if inv:room_for_item("dst",cooked.item) then if inv:room_for_item("dst",cooked.item) then
inv:add_item("dst", cooked.item) inv:add_item("dst", cooked.item)
local srcstack = inv:get_stack("src", 1) local srcstack = inv:get_stack("src", 1)
srcstack:take_item() srcstack:take_item()
inv:set_stack("src", 1, srcstack) inv:set_stack("src", 1, srcstack)
else else
print("Could not insert '"..cooked.item:to_string().."'") print("Could not insert '"..cooked.item:to_string().."'")
end end
meta:set_string("src_time", 0) meta:set_string("src_time", 0)
end end
end end
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
minetest.sound_play({name="campfire_small"},{pos=pos}, {max_hear_distance = 1},{loop=true},{gain=0.009}) minetest.sound_play({name="campfire_small"},{pos=pos}, {max_hear_distance = 1},{loop=true},{gain=0.009})
local percent = math.floor(meta:get_float("fuel_time") / local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100) meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext","Campfire active: "..percent.."%") meta:set_string("infotext","Campfire active: "..percent.."%")
minetest.swap_node(pos, {name = 'more_fire:campfire_contained'}) minetest.swap_node(pos, {name = 'more_fire:campfire_contained'})
return return
end end
local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
local cookable = true
if cooked.time == 0 then
cookable = false
end
local item_state = ''
local item_percent = 0
if cookable then
item_percent = math.floor(src_time / cooked.time * 100)
item_state = item_percent .. "%"
end
local fuel = nil local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
local cooked = nil local cookable = true
local fuellist = inv:get_list("fuel") if cooked.time == 0 then
local srclist = inv:get_list("src") cookable = false
if srclist then end
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end local item_state = ''
local item_percent = 0
if fuellist then if cookable then
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) item_percent = math.floor(src_time / cooked.time * 100)
end item_state = item_percent .. "%"
end
if fuel.time <= 0 then
meta:set_string("infotext","The campfire is out.") local fuel = nil
minetest.swap_node(pos, {name = 'more_fire:embers_contained'}) local cooked = nil
meta:set_string("formspec", more_fire.embers_formspec) local fuellist = inv:get_list("fuel")
return local srclist = inv:get_list("src")
end if srclist then
meta:set_string("fuel_totaltime", fuel.time) cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
meta:set_string("fuel_time", 0) end
local stack = inv:get_stack("fuel", 1)
stack:take_item() if fuellist then
inv:set_stack("fuel", 1, stack) fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
meta:set_string("formspec", more_fire.fire_formspec(item_percent)) end
end,
if fuel.time <= 0 then
meta:set_string("infotext","The campfire is out.")
minetest.swap_node(pos, {name = 'more_fire:embers_contained'})
meta:set_string("formspec", more_fire.embers_formspec)
return
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)
meta:set_string("formspec", more_fire.fire_formspec(item_percent))
end,
}) })
minetest.register_abm({ --smoke for embers minetest.register_abm({ --smoke for embers
nodenames = {'more_fire:embers', 'more_fire:embers_contained'}, nodenames = {'more_fire:embers', 'more_fire:embers_contained'},
interval = 1, interval = 1,
chance = 2, chance = 2,
action = function(pos, node) action = function(pos, node)
if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then
smoke_particles(pos) smoke_particles(pos)
end end
end end
}) })
minetest.register_abm({ --embers for fire minetest.register_abm({ --embers for fire
nodenames = {'more_fire:campfire', 'more_fire:campfire_contained'}, nodenames = {'more_fire:campfire', 'more_fire:campfire_contained'},
interval = 1, interval = 1,
chance = 2, chance = 2,
action = function(pos, node) action = function(pos, node)
if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then
ember_particles(pos) ember_particles(pos)
end end
end end
}) })
minetest.register_abm({ --lava minetest.register_abm({ --lava
nodenames = {'default:lava_source', 'default:lava_flowing'}, nodenames = {'default:lava_source', 'default:lava_flowing'},
interval = 4, interval = 4,
chance = 15, chance = 15,
action = function(pos, node) action = function(pos, node)
if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then
lava_particles(pos) lava_particles(pos)
end end
end end
}) })

View File

@ -1,3 +1,6 @@
6-4-20:
Code updates and cleaning. No new features.
8-26-15: 8-26-15:
You can finally cook in the fires, there seems to be a little bug yet in the arrow showing the progress of the cooking, but mechanics all seem to work alright. You can finally cook in the fires, there seems to be a little bug yet in the arrow showing the progress of the cooking, but mechanics all seem to work alright.

View File

@ -1,23 +1,22 @@
-- check if charcoal already defined by mod ethereal -- check if charcoal already defined by mod ethereal
if minetest.get_modpath("ethereal") then if minetest.get_modpath("ethereal") then
minetest.override_item("ethereal:charcoal_lump",{groups={coal = 1}}) minetest.override_item("ethereal:charcoal_lump",{groups={coal = 1}})
minetest.register_alias("more_fire:charcoal", "ethereal:charcoal_lump") minetest.register_alias("more_fire:charcoal", "ethereal:charcoal_lump")
else else
minetest.register_craftitem('more_fire:charcoal', { minetest.register_craftitem('more_fire:charcoal', {
description = 'Charcoal', description = 'Charcoal',
inventory_image = 'more_fire_charcoal_lump.png', inventory_image = 'more_fire_charcoal_lump.png',
groups = {coal = 1} groups = {coal = 1}
}) })
end end
minetest.register_craftitem('more_fire:oil', { minetest.register_craftitem('more_fire:oil', {
description = 'lantern oil', description = 'lantern oil',
inventory_image = 'more_fire_oil.png', inventory_image = 'more_fire_oil.png',
}) })
minetest.register_craftitem('more_fire:dried_grass', { minetest.register_craftitem('more_fire:dried_grass', {
description = 'dried grass', description = 'dried grass',
inventory_image = 'more_fire_grass_dried.png', inventory_image = 'more_fire_grass_dried.png',
groups = {kindling=1} groups = {kindling=1}
}) })

View File

@ -1,167 +1,167 @@
minetest.register_craft({ --recycle old torches. minetest.register_craft({ --recycle old torches.
type = 'shapeless', type = 'shapeless',
output = 'default:stick', output = 'default:stick',
recipe = {'more_fire:torch_stub', 'more_fire:torch_stub', 'more_fire:torch_stub', 'more_fire:torch_stub'}, recipe = {'more_fire:torch_stub', 'more_fire:torch_stub', 'more_fire:torch_stub', 'more_fire:torch_stub'},
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:charcoal_block 1', output = 'more_fire:charcoal_block',
recipe = { recipe = {
{'more_fire:charcoal', 'more_fire:charcoal', 'more_fire:charcoal'}, {'more_fire:charcoal', 'more_fire:charcoal', 'more_fire:charcoal'},
{'more_fire:charcoal', 'more_fire:charcoal', 'more_fire:charcoal'}, {'more_fire:charcoal', 'more_fire:charcoal', 'more_fire:charcoal'},
{'more_fire:charcoal', 'more_fire:charcoal', 'more_fire:charcoal'}, {'more_fire:charcoal', 'more_fire:charcoal', 'more_fire:charcoal'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:charcoal 9', output = 'more_fire:charcoal 9',
recipe = { recipe = {
{'more_fire:charcoal_block'} {'more_fire:charcoal_block'}
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:embers 1', output = 'more_fire:embers',
recipe = { recipe = {
{'more_fire:kindling'}, {'more_fire:kindling'},
{'default:torch'}, {'default:torch'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:embers 1', output = 'more_fire:embers',
recipe = { recipe = {
{'group:kindling', 'default:torch', 'group:kindling'}, {'group:kindling', 'default:torch', 'group:kindling'},
{'group:wood', 'group:wood', 'group:wood'}, {'group:wood', 'group:wood', 'group:wood'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:embers 1', output = 'more_fire:embers',
recipe = { recipe = {
{'group:flammable', 'default:torch', 'group:flammable'}, {'group:flammable', 'default:torch', 'group:flammable'},
{'group:wood', 'group:wood', 'group:wood'}, {'group:wood', 'group:wood', 'group:wood'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:embers_contained 1', output = 'more_fire:embers_contained',
recipe = { recipe = {
{'', 'more_fire:embers', ''}, {'', 'more_fire:embers', ''},
{'default:cobble', 'default:cobble', 'default:cobble'}, {'default:cobble', 'default:cobble', 'default:cobble'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:embers_contained 1', output = 'more_fire:embers_contained',
recipe = { recipe = {
{'more_fire:kindling_contained'}, {'more_fire:kindling_contained'},
{'default:torch'}, {'default:torch'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:torch_weak 4', output = 'more_fire:torch_weak 4',
recipe = { recipe = {
{'group:kindling', 'group:kindling', 'group:kindling'}, {'group:kindling', 'group:kindling', 'group:kindling'},
{'group:kindling', 'group:stick', 'group:kindling'}, {'group:kindling', 'group:stick', 'group:kindling'},
{'', 'group:stick', ''} {'', 'group:stick', ''}
} }
}) })
minetest.register_craft({ minetest.register_craft({
type = 'shapeless', type = 'shapeless',
output = 'default:torch', output = 'default:torch',
recipe = {'more_fire:torch_weak', 'group:coal'}, recipe = {'more_fire:torch_weak', 'group:coal'},
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:kindling 1', output = 'more_fire:kindling',
recipe = { recipe = {
{'group:kindling', '', 'group:kindling'}, {'group:kindling', '', 'group:kindling'},
{'group:kindling', 'group:wood', 'group:kindling'}, {'group:kindling', 'group:wood', 'group:kindling'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:kindling_contained 1', output = 'more_fire:kindling_contained',
recipe = { recipe = {
{'','more_fire:kindling', ''}, {'','more_fire:kindling', ''},
{'default:cobble','default:cobble','default:cobble'}, {'default:cobble','default:cobble','default:cobble'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:oil_lamp_off 1', output = 'more_fire:oil_lamp_off',
recipe = { recipe = {
{'default:glass'}, {'default:glass'},
{'farming:cotton'}, {'farming:cotton'},
{'default:iron_lump'}, {'default:iron_lump'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:oil 1', output = 'more_fire:oil',
recipe = { recipe = {
{'group:leaves', 'group:leaves', 'group:leaves'}, {'group:leaves', 'group:leaves', 'group:leaves'},
{'group:leaves', 'group:leaves', 'group:leaves'}, {'group:leaves', 'group:leaves', 'group:leaves'},
{'', 'vessels:glass_bottle', ''}, {'', 'vessels:glass_bottle', ''},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:oil_lamp_off 1', output = 'more_fire:oil_lamp_off',
recipe = { recipe = {
{'more_fire:oil_lamp_table_off'} {'more_fire:oil_lamp_table_off'}
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'more_fire:oil_lamp_table_off 1', output = 'more_fire:oil_lamp_table_off',
recipe = { recipe = {
{'more_fire:oil_lamp_off'} {'more_fire:oil_lamp_off'}
} }
}) })
-- cooking recipes -- cooking recipes
if not minetest.get_modpath("ethereal") then if not minetest.get_modpath("ethereal") then
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = 'cooking',
recipe = 'group:tree', recipe = 'group:tree',
output = 'more_fire:charcoal', output = 'more_fire:charcoal',
}) })
end end
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = 'cooking',
recipe = 'default:grass_1', recipe = 'default:grass_1',
output = 'more_fire:dried_grass', output = 'more_fire:dried_grass',
cooktime = 1, cooktime = 1,
}) })
-- fuel recipes -- fuel recipes
if not minetest.get_modpath("ethereal") then if not minetest.get_modpath("ethereal") then
minetest.register_craft({ minetest.register_craft({
type = 'fuel', type = 'fuel',
recipe = 'more_fire:charcoal', recipe = 'more_fire:charcoal',
burntime = 35, burntime = 35,
}) })
end end
minetest.register_craft({ minetest.register_craft({
type = 'fuel', type = 'fuel',
recipe = 'more_fire:oil', recipe = 'more_fire:oil',
burntime = 10, burntime = 10,
}) })
minetest.register_craft({ minetest.register_craft({
type = 'fuel', type = 'fuel',
recipe = 'more_fire:charcoal_block', recipe = 'more_fire:charcoal_block',
burntime = 315, burntime = 315,
}) })
minetest.register_craft({ minetest.register_craft({
type = 'fuel', type = 'fuel',
recipe = 'more_fire:torch_stub', recipe = 'more_fire:torch_stub',
burntime = 2, burntime = 2,
}) })

View File

@ -1,4 +0,0 @@
default
farming
fire
vessels

View File

@ -1 +0,0 @@
This is a Minetest mod that adds more/better fire related stuff.

View File

@ -1,104 +1,101 @@
function default.get_hotbar_bg(x,y) function default.get_hotbar_bg(x,y)
local out = '' local out = ''
for i=0,7,1 do for i=0,7,1 do
out = out ..'image['..x+i..','..y..';1,1;gui_hb_bg.png]' out = out ..'image['..x+i..','..y..';1,1;gui_hb_bg.png]'
end end
return out return out
end end
function more_fire.fire_formspec(item_percent) function more_fire.fire_formspec(item_percent)
local formspec = local formspec =
'size[8,6.75]'.. 'size[8,6.75]'..
default.gui_slots.. default.gui_slots..
'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'.. 'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'..
'background[8,6.75;0,0;more_fire_campfire_bg.png;true]'.. 'background[8,6.75;0,0;more_fire_campfire_bg.png;true]'..
'label[2,.75;< Add More Wood]'.. 'label[2,.75;< Add More Wood]'..
'label[1.25,2; Cook Something >]'.. 'label[1.25,2; Cook Something >]'..
'list[current_name;fuel;1,.5;1,1;]'.. 'list[current_name;fuel;1,.5;1,1;]'..
'list[current_name;src;4,1.75;1,1;]'.. 'list[current_name;src;4,1.75;1,1;]'..
'image[5,1.75;1,1;gui_furnace_arrow_bg.png^[lowpart:'.. 'image[5,1.75;1,1;gui_furnace_arrow_bg.png^[lowpart:'..
(item_percent)..':gui_furnace_arrow_fg.png^[transformR270]'.. (item_percent)..':gui_furnace_arrow_fg.png^[transformR270]'..
'list[current_name;dst;6,1.75;2,1;]'.. 'list[current_name;dst;6,1.75;2,1;]'..
'list[current_player;main;0,2.75;8,1;]'.. 'list[current_player;main;0,2.75;8,1;]'..
'list[current_player;main;0,4;8,3;8]'.. 'list[current_player;main;0,4;8,3;8]'..
default.get_hotbar_bg(0,2.75) default.get_hotbar_bg(0,2.75)
return formspec return formspec
end end
more_fire.embers_formspec = more_fire.embers_formspec =
'size[8,6.75]'.. 'size[8,6.75]'..
default.gui_slots.. default.gui_slots..
'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'.. 'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'..
'background[8,6.75;0,0;more_fire_campfire_bg.png;true]'.. 'background[8,6.75;0,0;more_fire_campfire_bg.png;true]'..
'label[2,.75;< Add More Wood]'.. 'label[2,.75;< Add More Wood]'..
'label[1.25,2; Cook Something >]'.. 'label[1.25,2; Cook Something >]'..
'list[current_name;fuel;1,.5;1,1;]'.. 'list[current_name;fuel;1,.5;1,1;]'..
'list[current_name;src;4,1.75;1,1;]'.. 'list[current_name;src;4,1.75;1,1;]'..
'image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270]'.. 'image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270]'..
'list[current_name;dst;6,1.75;2,1;]'.. 'list[current_name;dst;6,1.75;2,1;]'..
'list[current_player;main;0,2.75;8,1;]'.. 'list[current_player;main;0,2.75;8,1;]'..
'list[current_player;main;0,4;8,3;8]'.. 'list[current_player;main;0,4;8,3;8]'..
default.get_hotbar_bg(0,2.75) default.get_hotbar_bg(0,2.75)
function smoke_particles(pos) function smoke_particles(pos)
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 1, -- how many particles do you want amount = 1, -- how many particles do you want
time = 2, -- spawner stops after this time (use 0 for infinite) time = 2, -- spawner stops after this time (use 0 for infinite)
minpos = {x=pos.x, y=pos.y, z=pos.z}, -- minimum offset minpos = {x=pos.x, y=pos.y, z=pos.z}, -- minimum offset
maxpos = {x=pos.x, y=pos.y, z=pos.z}, -- maximum offset maxpos = {x=pos.x, y=pos.y, z=pos.z}, -- maximum offset
minvel = {x=-.1, y=0, z=-.1}, -- minimum velocity minvel = {x=-.1, y=0, z=-.1}, -- minimum velocity
maxvel = {x=.1, y=.4, z=.1}, -- maximum velocity maxvel = {x=.1, y=.4, z=.1}, -- maximum velocity
minacc = {x=-.05, y=.02, z=-.05}, -- minimum acceleration minacc = {x=-.05, y=.02, z=-.05}, -- minimum acceleration
maxacc = {x=.1, y=.1, z=.1}, -- maximim acceleration maxacc = {x=.1, y=.1, z=.1}, -- maximim acceleration
minexptime = 3, -- minimum expiration time minexptime = 3, -- minimum expiration time
maxexptime = 6, -- maximum expiration time maxexptime = 6, -- maximum expiration time
minsize = 3, -- minimum size (0.5 = half size) minsize = 3, -- minimum size (0.5 = half size)
maxsize = 8, -- maximum size (1=full resolution) maxsize = 8, -- maximum size (1=full resolution)
collisiondetection = false, -- do particles stop when they hit solid node collisiondetection = false, -- do particles stop when they hit solid node
texture = 'more_fire_smoke.png', -- image to use (e.g. 'bubble.png' ) texture = 'more_fire_smoke.png', -- image to use (e.g. 'bubble.png' )
vertical = false, -- upright/vertical image for rain vertical = false, -- upright/vertical image for rain
-- playername = 'singleplayer', -- particles only appear for this player })
})
end end
function ember_particles(pos) function ember_particles(pos)
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 1, amount = 1,
time = 2, time = 2,
minpos = {x=pos.x, y=pos.y, z=pos.z}, minpos = {x=pos.x, y=pos.y, z=pos.z},
maxpos = {x=pos.x, y=pos.y, z=pos.z}, maxpos = {x=pos.x, y=pos.y, z=pos.z},
minvel = {x=-.15, y=.3, z=-.15}, minvel = {x=-.15, y=.3, z=-.15},
maxvel = {x=.1, y=.6, z=.1}, maxvel = {x=.1, y=.6, z=.1},
minacc = {x=-.05, y=.02, z=-.05}, minacc = {x=-.05, y=.02, z=-.05},
maxacc = {x=.1, y=.3, z=.1}, maxacc = {x=.1, y=.3, z=.1},
minexptime = 1, minexptime = 1,
maxexptime = 3, maxexptime = 3,
minsize = 1, minsize = 1,
maxsize = 2, maxsize = 2,
collisiondetection = false, collisiondetection = false,
texture = 'more_fire_embers.png', texture = 'more_fire_embers.png',
vertical = false, vertical = false,
-- playername = 'singleplayer', })
})
end end
function lava_particles(pos) function lava_particles(pos)
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 2, amount = 2,
time = 1, time = 1,
minpos = {x=pos.x, y=pos.y-.5, z=pos.z}, minpos = {x=pos.x, y=pos.y-.5, z=pos.z},
maxpos = {x=pos.x, y=pos.y, z=pos.z}, maxpos = {x=pos.x, y=pos.y, z=pos.z},
minvel = {x=-.4, y=1, z=-.4}, minvel = {x=-.4, y=1, z=-.4},
maxvel = {x=.4, y=1.5, z=.4}, maxvel = {x=.4, y=1.5, z=.4},
minacc = {x=-.4, y=1, z=-.4}, minacc = {x=-.4, y=1, z=-.4},
maxacc = {x=.4, y=1.5, z=.4}, maxacc = {x=.4, y=1.5, z=.4},
minexptime = 1, minexptime = 1,
maxexptime = 1.5, maxexptime = 1.5,
minsize = .6, minsize = .6,
maxsize = 2, maxsize = 2,
collisiondetection = false, collisiondetection = false,
texture = 'more_fire_lava_blob.png', texture = 'more_fire_lava_blob.png',
vertical = false, vertical = false,
-- playername = 'singleplayer', })
})
end end

View File

@ -12,7 +12,6 @@ dofile(minetest.get_modpath('more_fire')..'/abms.lua')
dofile(minetest.get_modpath('more_fire')..'/nodes.lua') dofile(minetest.get_modpath('more_fire')..'/nodes.lua')
dofile(minetest.get_modpath('more_fire')..'/craftitems.lua') dofile(minetest.get_modpath('more_fire')..'/craftitems.lua')
dofile(minetest.get_modpath('more_fire')..'/crafts.lua') dofile(minetest.get_modpath('more_fire')..'/crafts.lua')
dofile(minetest.get_modpath('more_fire')..'/tools.lua')
if minetest.settings:get_bool('more_fire.pyromania') then if minetest.settings:get_bool('more_fire.pyromania') then
dofile(minetest.get_modpath('more_fire')..'/molotov.lua') dofile(minetest.get_modpath('more_fire')..'/molotov.lua')
dofile(minetest.get_modpath('more_fire')..'/smokebomb.lua') dofile(minetest.get_modpath('more_fire')..'/smokebomb.lua')

12
license.txt Normal file
View File

@ -0,0 +1,12 @@
Code is licensed MIT
Smokebomb and Molotov cocktail by Napiophelios.
Everything else by Nathan Salapat
lib/Vec3_1-0.lua by prestidigitator licensed under WTFPL
Models and Textures licensed CC by SA Nathan Salapat
Spark sound licensed CC0 by BroAsis, https://freesound.org/people/BroAsis/sounds/106853/
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.

View File

@ -1,5 +1,6 @@
name = more_fire name = more_fire
depends=default,farming,fire,vessels title = More Fire
depends = default,farming,fire,vessels
description = This is a Minetest mod that adds more/better fire related stuff. description = This is a Minetest mod that adds more/better fire related stuff.
author = Nathan, Napiophelios author = Nathan, Napiophelios
optional_depends = ethereal optional_depends = ethereal

225
models/campfire.obj Normal file
View File

@ -0,0 +1,225 @@
# Blender v2.79 (sub 0) OBJ File: 'campfire.blend'
# www.blender.org
o Plane
v -0.240246 -0.438696 -0.141059
v 0.205043 -0.438696 0.192756
v -0.239959 0.135875 -0.141442
v 0.205331 0.135875 0.192373
v -0.216088 -0.438696 0.214432
v 0.181502 -0.438696 -0.162771
v -0.216417 0.135875 0.214085
v 0.181172 0.135875 -0.163119
vt 0.000000 0.875000
vt 1.000000 0.875000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.875000
vt 1.000000 0.875000
vt 1.000000 1.000000
vt -0.000000 1.000000
vn -0.5998 0.0008 0.8001
vn 0.6883 0.0008 0.7255
g Plane_Plane_Material.001
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 5/5/2 6/6/2 8/7/2 7/8/2
o nodebox3
v 0.250000 -0.500000 -0.500000
v 0.250000 -0.500000 0.500000
v 0.250000 -0.437500 0.500000
v 0.250000 -0.437500 -0.500000
v -0.250000 -0.500000 -0.500000
v -0.250000 -0.500000 0.500000
v -0.250000 -0.437500 0.500000
v -0.250000 -0.437500 -0.500000
v 0.243779 -0.499707 -0.497529
v 0.493779 -0.499707 -0.497421
v 0.493779 -0.249707 -0.497421
v 0.243779 -0.249707 -0.497529
v 0.243349 -0.499707 0.502471
v 0.493349 -0.499707 0.502579
v 0.493349 -0.249707 0.502578
v 0.243349 -0.249707 0.502471
v 0.493779 -0.499707 -0.497421
v 0.493779 -0.249707 -0.497421
v 0.493349 -0.499707 0.502579
v 0.493349 -0.249707 0.502578
v -0.500021 -0.499707 -0.497848
v -0.250021 -0.499707 -0.497741
v -0.250021 -0.249707 -0.497741
v -0.500021 -0.249707 -0.497848
v -0.500451 -0.499707 0.502152
v -0.250451 -0.499707 0.502259
v -0.250451 -0.249707 0.502259
v -0.500451 -0.249707 0.502152
v -0.250021 -0.499707 -0.497741
v -0.250021 -0.249707 -0.497741
v -0.250451 -0.499707 0.502259
v -0.250451 -0.249707 0.502259
v 0.500000 -0.312500 -0.493800
v 0.500000 -0.312500 -0.243800
v 0.500000 -0.062500 -0.243800
v 0.500000 -0.062500 -0.493800
v -0.500000 -0.312500 -0.493800
v -0.500000 -0.312500 -0.243800
v -0.500000 -0.062500 -0.243800
v -0.500000 -0.062500 -0.493800
v 0.500000 -0.312500 -0.243800
v 0.500000 -0.062500 -0.243800
v -0.500000 -0.312500 -0.243800
v -0.500000 -0.062500 -0.243800
v 0.500000 -0.312500 0.250000
v 0.500000 -0.312500 0.500000
v 0.500000 -0.062500 0.500000
v 0.500000 -0.062500 0.250000
v -0.500000 -0.312500 0.250000
v -0.500000 -0.312500 0.500000
v -0.500000 -0.062500 0.500000
v -0.500000 -0.062500 0.250000
v 0.500000 -0.312500 0.500000
v 0.500000 -0.062500 0.500000
v -0.500000 -0.312500 0.500000
v -0.500000 -0.062500 0.500000
vt 0.999982 0.000018
vt 0.999982 0.031267
vt 0.000018 0.031267
vt 0.000018 0.000018
vt 0.999982 0.000018
vt 0.999982 0.031267
vt 0.000018 0.031267
vt 0.000018 0.000018
vt 1.000000 0.109375
vt 0.000000 0.109375
vt 0.000071 0.000071
vt 0.999929 0.000071
vt 1.000000 0.125000
vt 0.000000 0.125000
vt 0.000071 0.000071
vt 0.000000 0.937500
vt 0.000000 0.875000
vt 0.250000 0.875000
vt 0.250000 0.937500
vt 0.000000 0.937500
vt 0.000000 0.875000
vt 0.250000 0.875000
vt 0.250000 0.937500
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.937500
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.937500
vt 0.000000 0.937500
vt 0.000000 0.875000
vt 0.250000 0.875000
vt 0.250000 0.937500
vt 0.000000 0.937500
vt 0.000000 0.875000
vt 0.250000 0.875000
vt 0.250000 0.937500
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.937500
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.937500
vt 0.000000 0.937500
vt 0.000000 0.875000
vt 0.250000 0.875000
vt 0.250000 0.937500
vt 0.000000 0.937500
vt 0.000000 0.875000
vt 0.250000 0.875000
vt 0.250000 0.937500
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.937500
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.937500
vt 0.000000 0.937500
vt 0.000000 0.875000
vt 0.250000 0.875000
vt 0.250000 0.937500
vt 0.000000 0.937500
vt 0.000000 0.875000
vt 0.250000 0.875000
vt 0.250000 0.937500
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.937500
vt 1.000000 0.937500
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.937500
vt 0.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 0.000000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 -0.0000
vn -0.0004 0.0000 1.0000
vn 1.0000 -0.0000 0.0004
vn -1.0000 0.0000 0.0000
g nodebox3_nodebox3_none
s off
f 9/9/3 12/10/3 16/11/3 13/12/3
f 10/13/3 11/14/3 15/15/3 14/16/3
f 9/9/4 10/17/4 14/18/4 13/19/4
f 12/20/4 11/21/4 15/22/4 16/23/4
f 17/24/5 18/25/5 19/26/5 20/27/5
f 21/28/5 22/29/5 23/30/5 24/31/5
f 17/32/6 20/33/6 24/34/6 21/28/6
f 17/32/4 18/35/4 22/36/4 21/28/4
f 20/37/4 19/38/4 23/39/4 24/40/4
f 25/41/6 26/42/6 28/43/6 27/44/6
f 29/45/5 30/46/5 31/47/5 32/48/5
f 33/49/5 34/50/5 35/51/5 36/52/5
f 29/53/6 32/54/6 36/55/6 33/49/6
f 29/53/4 30/56/4 34/57/4 33/49/4
f 32/58/4 31/59/4 35/60/4 36/61/4
f 37/62/6 38/63/6 40/64/6 39/65/6
f 41/66/7 42/67/7 43/68/7 44/69/7
f 45/70/7 46/71/7 47/72/7 48/73/7
f 41/74/3 44/75/3 48/76/3 45/70/3
f 41/74/4 42/77/4 46/78/4 45/70/4
f 44/79/4 43/80/4 47/81/4 48/82/4
f 49/83/3 50/84/3 52/85/3 51/86/3
f 53/87/7 54/88/7 55/89/7 56/90/7
f 57/91/7 58/92/7 59/93/7 60/94/7
f 53/95/3 56/96/3 60/97/3 57/91/3
f 53/95/4 54/98/4 58/99/4 57/91/4
f 56/100/4 55/101/4 59/102/4 60/103/4
f 61/104/3 62/105/3 64/106/3 63/107/3
g nodebox3_nodebox3_none_NONE
f 9/108/7 10/109/7 11/110/7 12/111/7
f 13/12/7 14/16/7 15/112/7 16/113/7

Binary file not shown.

View File

@ -1,14 +0,0 @@
# Blender v2.74 (sub 5) OBJ File: ''
# www.blender.org
o Plane
v -0.500000 -0.479483 0.500000
v 0.500000 -0.479483 0.500000
v -0.500000 -0.479483 -0.500000
v 0.500000 -0.479483 -0.500000
vt 0.000100 0.000100
vt 0.999900 0.000100
vt 0.999900 0.999900
vt 0.000100 0.999900
vn 0.000000 1.000000 0.000000
s off
f 1/1/1 2/2/1 4/3/1 3/4/1

Binary file not shown.

View File

@ -1,233 +1,233 @@
--Molotov Cocktail_[rev002] --Molotov Cocktail_[rev002]
--base code is from throwing enhanced and potions mods --base code is from throwing enhanced and potions mods
local MOD_NAME = minetest.get_current_modname() local MOD_NAME = minetest.get_current_modname()
local MOD_PATH = minetest.get_modpath(MOD_NAME) local MOD_PATH = minetest.get_modpath(MOD_NAME)
local Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua') local Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua')
minetest.register_craftitem('more_fire:molotov_cocktail', { minetest.register_craftitem('more_fire:molotov_cocktail', {
description = 'Molotov Cocktail', description = 'Molotov Cocktail',
inventory_image = 'more_fire_molotov_cocktail.png', inventory_image = 'more_fire_molotov_cocktail.png',
on_place = function(itemstack, user, pointed_thing) on_place = function(itemstack, user, pointed_thing)
itemstack:take_item() itemstack:take_item()
minetest.sound_play('more_fire_shatter', {gain = 1.0}) minetest.sound_play('more_fire_shatter', {gain = 1.0})
n = minetest.get_node(pointed_thing) n = minetest.get_node(pointed_thing)
if pointed_thing.type == 'node' then if pointed_thing.type == 'node' then
minetest.add_node(pointed_thing.above, {name='more_fire:napalm'}) minetest.add_node(pointed_thing.above, {name='more_fire:napalm'})
minetest.sound_play('more_fire_ignite', {pos,pos}) minetest.sound_play('more_fire_ignite', {pos,pos})
end end
--Shattered glass Particles --Shattered glass Particles
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 40, amount = 40,
time = 0.1, time = 0.1,
minpos = pointed_thing.above, minpos = pointed_thing.above,
maxpos = pointed_thing.above, maxpos = pointed_thing.above,
minvel = {x=2, y=0.2, z=2}, minvel = {x=2, y=0.2, z=2},
maxvel = {x=-2, y=0.5, z=-2}, maxvel = {x=-2, y=0.5, z=-2},
minacc = {x=0, y=-6, z=0}, minacc = {x=0, y=-6, z=0},
maxacc = {x=0, y=-10, z=0}, maxacc = {x=0, y=-10, z=0},
minexptim = 0.5, minexptim = 0.5,
maxexptime = 2, maxexptime = 2,
minsize = 0.2, minsize = 0.2,
maxsize = 5, maxsize = 5,
collisiondetection = true, collisiondetection = true,
texture = 'more_fire_shatter.png'}) texture = 'more_fire_shatter.png'})
--fire ember particles --fire ember particles
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 100, amount = 100,
time = 0.1, time = 0.1,
minpos = pointed_thing.above, minpos = pointed_thing.above,
maxpos = pointed_thing.above, maxpos = pointed_thing.above,
minvel = {x=-2, y=0.5, z=-2}, minvel = {x=-2, y=0.5, z=-2},
maxvel = {x=2, y=0.5, z=2}, maxvel = {x=2, y=0.5, z=2},
minacc = {x=0, y=-10, z=0}, minacc = {x=0, y=-10, z=0},
maxacc = {x=0, y=-6, z=0}, maxacc = {x=0, y=-6, z=0},
minexptime = 2, minexptime = 2,
maxexptime = 3, maxexptime = 3,
minsize = 0.25, minsize = 0.25,
maxsize = 0.5, maxsize = 0.5,
collisiondetection = true, collisiondetection = true,
texture = 'more_fire_spark.png'}) texture = 'more_fire_spark.png'})
local dir = Vec3(user:get_look_dir()) *20 local dir = Vec3(user:get_look_dir()) *20
minetest.add_particle( minetest.add_particle(
{x=user:getpos().x, y=user:getpos().y+1.5, z=user:getpos().z}, {x=dir.x, y=dir.y, z=dir.z}, {x=0, y=-10, z=0}, 0.2, {x=user:getpos().x, y=user:getpos().y+1.5, z=user:getpos().z}, {x=dir.x, y=dir.y, z=dir.z}, {x=0, y=-10, z=0}, 0.2,
6, false, 'more_fire_molotov_cocktail.png') 6, false, 'more_fire_molotov_cocktail.png')
return itemstack return itemstack
end, end,
}) })
local function throw_cocktail(item, player) local function throw_cocktail(item, player)
local playerpos = player:getpos() local playerpos = player:getpos()
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.625,z=playerpos.z}, 'more_fire:molotov_entity') local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.625,z=playerpos.z}, 'more_fire:molotov_entity')
local dir = player:get_look_dir() local dir = player:get_look_dir()
obj:setvelocity({x=dir.x*30, y=dir.y*30, z=dir.z*30}) obj:setvelocity({x=dir.x*30, y=dir.y*30, z=dir.z*30})
obj:setacceleration({x=dir.x*-3, y=-dir.y^8*80-10, z=dir.z*-3}) obj:setacceleration({x=dir.x*-3, y=-dir.y^8*80-10, z=dir.z*-3})
if not minetest.settings:get_bool('creative_mode') then if not minetest.settings:get_bool('creative_mode') then
item:take_item() item:take_item()
end end
return item return item
end end
local radius = 5.0 local radius = 5.0
local function add_effects(pos, radius) local function add_effects(pos, radius)
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 10, amount = 10,
time = 0.2, time = 0.2,
minpos = vector.subtract(pos, radius / 2), minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2), maxpos = vector.add(pos, radius / 2),
minvel = {x=-2, y=-2, z=-2}, minvel = {x=-2, y=-2, z=-2},
maxvel = {x=2, y=-4, z=2}, maxvel = {x=2, y=-4, z=2},
minacc = {x=0, y=-4, z=0}, minacc = {x=0, y=-4, z=0},
--~ maxacc = {x=-20, y=-50, z=-50}, --~ maxacc = {x=-20, y=-50, z=-50},
minexptime = 1, minexptime = 1,
maxexptime = 1.5, maxexptime = 1.5,
minsize = 1, minsize = 1,
maxsize = 2, maxsize = 2,
texture = 'more_fire_spark.png', texture = 'more_fire_spark.png',
}) })
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 10, amount = 10,
time = 0.2, time = 0.2,
minpos = vector.subtract(pos, radius / 2), minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2), maxpos = vector.add(pos, radius / 2),
minvel = {x=-1.25, y=-1.25, z=-1.25}, minvel = {x=-1.25, y=-1.25, z=-1.25},
maxvel = {x=0.5, y=-4, z=0.5}, maxvel = {x=0.5, y=-4, z=0.5},
minacc = {x=1.25, y=-1.25, z=1.25}, minacc = {x=1.25, y=-1.25, z=1.25},
--~ maxacc = {x=-20, y=-50, z=-50}, --~ maxacc = {x=-20, y=-50, z=-50},
minexptime =1, minexptime =1,
maxexptime = 1.5, maxexptime = 1.5,
minsize = 1, minsize = 1,
maxsize = 2, maxsize = 2,
texture = 'more_fire_spark.png', texture = 'more_fire_spark.png',
}) })
end end
local function napalm(pos) local function napalm(pos)
minetest.sound_play('more_fire_ignite', {pos=pos, gain=1}) minetest.sound_play('more_fire_ignite', {pos=pos, gain=1})
minetest.set_node(pos, {name='more_fire:napalm'}) minetest.set_node(pos, {name='more_fire:napalm'})
minetest.get_node_timer(pos):start(5.0) minetest.get_node_timer(pos):start(5.0)
add_effects(pos, radius) add_effects(pos, radius)
end end
local MORE_FIRE_MOLOTOV_ENTITY = { local MORE_FIRE_MOLOTOV_ENTITY = {
timer=0, timer=0,
collisionbox = {0,0,0,0,0,0}, collisionbox = {0,0,0,0,0,0},
physical = false, physical = false,
textures = {'more_fire_molotov_cocktail.png'}, textures = {'more_fire_molotov_cocktail.png'},
lastpos={}, lastpos={},
} }
MORE_FIRE_MOLOTOV_ENTITY.on_step = function(self, dtime) MORE_FIRE_MOLOTOV_ENTITY.on_step = function(self, dtime)
self.timer = self.timer + dtime self.timer = self.timer + dtime
local pos = self.object:getpos() local pos = self.object:getpos()
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 10, amount = 10,
time = 0.5, time = 0.5,
minpos = pos, minpos = pos,
maxpos = pos, maxpos = pos,
minvel = {x=-0, y=0, z=-0.5}, minvel = {x=-0, y=0, z=-0.5},
maxvel = {x=0, y=0, z=-0.75}, maxvel = {x=0, y=0, z=-0.75},
minacc = vector.new(), minacc = vector.new(),
maxacc = vector.new(), maxacc = vector.new(),
minexptime = 0.5, minexptime = 0.5,
maxexptime = 1, maxexptime = 1,
minsize = 0.25, minsize = 0.25,
maxsize = 0.5, maxsize = 0.5,
texture = 'more_fire_smoke.png', texture = 'more_fire_smoke.png',
}) })
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 100, amount = 100,
time = 0.25, time = 0.25,
minpos = pos, minpos = pos,
maxpos = pos, maxpos = pos,
minvel = {x=-0, y=0, z=-0.5}, minvel = {x=-0, y=0, z=-0.5},
maxvel = {x=0, y=0, z=-0.75}, maxvel = {x=0, y=0, z=-0.75},
minacc = {x=0, y=0, z=-0.75}, minacc = {x=0, y=0, z=-0.75},
maxacc = {x=-0, y=0, z=-0.5}, maxacc = {x=-0, y=0, z=-0.5},
minexptime = 0.25, minexptime = 0.25,
maxexptime = 0.5, maxexptime = 0.5,
minsize = 0.5, minsize = 0.5,
maxsize = 0.75, maxsize = 0.75,
texture = 'more_fire_spark.png', texture = 'more_fire_spark.png',
}) })
if self.timer>0.2 then if self.timer>0.2 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= 'more_fire:molotov_entity' and obj:get_luaentity().name ~= '__builtin:item' then if obj:get_luaentity().name ~= 'more_fire:molotov_entity' and obj:get_luaentity().name ~= '__builtin:item' then
if self.node ~= '' then if self.node ~= '' then
minetest.sound_play('more_fire_shatter', {gain = 1.0}) minetest.sound_play('more_fire_shatter', {gain = 1.0})
for dx=-3,3 do for dx=-3,3 do
for dy=-3,3 do for dy=-3,3 do
for dz=-3,3 do for dz=-3,3 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.get_node(pos).name local n = minetest.get_node(pos).name
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
minetest.sound_play('more_fire_ignite', {pos = self.lastpos}) minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.set_node(p, {name='more_fire:napalm'}) minetest.set_node(p, {name='more_fire:napalm'})
else else
--minetest.remove_node(p) --minetest.remove_node(p)
minetest.sound_play('more_fire_ignite', {pos = self.lastpos}) minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.set_node(p, {name='fire:basic_flame'}) minetest.set_node(p, {name='fire:basic_flame'})
end end
end end
end end
end end
end end
self.object:remove() self.object:remove()
end end
else else
if self.node ~= '' then if self.node ~= '' then
minetest.sound_play('more_fire_shatter', {gain = 1.0}) minetest.sound_play('more_fire_shatter', {gain = 1.0})
for dx=-2,2 do for dx=-2,2 do
for dy=-2,2 do for dy=-2,2 do
for dz=-2,2 do for dz=-2,2 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.get_node(pos).name local n = minetest.get_node(pos).name
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
minetest.sound_play('more_fire_ignite', {pos = self.lastpos}) minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.set_node(p, {name='more_fire:napalm'}) minetest.set_node(p, {name='more_fire:napalm'})
else else
--minetest.remove_node(p) --minetest.remove_node(p)
minetest.sound_play('more_fire_ignite', {pos = self.lastpos}) minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.set_node(p, {name='fire:basic_flame'}) minetest.set_node(p, {name='fire:basic_flame'})
end end
end end
end end
end end
end end
self.object:remove() self.object:remove()
end end
end end
end end
if self.lastpos.x~=nil then if self.lastpos.x~=nil then
if node.name ~= 'air' then if node.name ~= 'air' then
if self.node ~= '' then if self.node ~= '' then
minetest.sound_play('more_fire_shatter', {gain = 1.0}) minetest.sound_play('more_fire_shatter', {gain = 1.0})
for dx=-1,1 do for dx=-1,1 do
for dy=-1,1 do for dy=-1,1 do
for dz=-1,1 do for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.get_node(pos).name local n = minetest.get_node(pos).name
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
minetest.sound_play('more_fire_ignite', {pos = self.lastpos}) minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.set_node(p, {name='more_fire:naplam'}) minetest.set_node(p, {name='more_fire:napalm'})
else else
minetest.sound_play('more_fire_ignite', {pos = self.lastpos}) minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.set_node(p, {name='fire:basic_flame'}) minetest.set_node(p, {name='fire:basic_flame'})
end end
end end
end end
end end
end end
self.object:remove() self.object:remove()
napalm(self.lastpos) napalm(self.lastpos)
end end
end end
self.lastpos={x=pos.x, y=pos.y, z=pos.z} self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end end
minetest.register_entity('more_fire:molotov_entity', MORE_FIRE_MOLOTOV_ENTITY) minetest.register_entity('more_fire:molotov_entity', MORE_FIRE_MOLOTOV_ENTITY)
@ -235,147 +235,145 @@ minetest.register_entity('more_fire:molotov_entity', MORE_FIRE_MOLOTOV_ENTITY)
minetest.override_item('more_fire:molotov_cocktail', {on_use = throw_cocktail}) minetest.override_item('more_fire:molotov_cocktail', {on_use = throw_cocktail})
minetest.register_node('more_fire:napalm', { minetest.register_node('more_fire:napalm', {
drawtype = 'firelike', drawtype = 'firelike',
tiles = {{ tiles = {{
name='fire_basic_flame_animated.png', name='fire_basic_flame_animated.png',
animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1}, animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1},
}}, }},
inventory_image = 'fire_basic_flame.png', inventory_image = 'fire_basic_flame.png',
light_source = 14, light_source = 14,
groups = {igniter=1,dig_immediate=3, not_in_creative_inventory =1, not_in_craft_guide=1}, groups = {igniter=1,dig_immediate=3, not_in_creative_inventory =1, not_in_craft_guide=1},
drop = '', drop = '',
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
damage_per_second = 4, damage_per_second = 4,
}) })
minetest.register_abm({ minetest.register_abm({
nodenames={'more_fire:napalm'}, nodenames={'more_fire:napalm'},
neighbors={'air'}, neighbors={'air'},
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos,node,active_object_count,active_object_count_wider) action = function(pos,node,active_object_count,active_object_count_wider)
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 200, amount = 200,
time = 3, time = 3,
minpos = pos, minpos = pos,
maxpos = pos, maxpos = pos,
minvel = {x=2, y=-0.2, z=2}, minvel = {x=2, y=-0.2, z=2},
maxvel = {x=-2, y=-0.5, z=-2}, maxvel = {x=-2, y=-0.5, z=-2},
minacc = {x=0, y=-6, z=0}, minacc = {x=0, y=-6, z=0},
maxacc = {x=0, y=-10, z=0}, maxacc = {x=0, y=-10, z=0},
minexptime = 2, minexptime = 2,
maxexptime = 6, maxexptime = 6,
minsize = 0.05, minsize = 0.05,
maxsize = 0.5, maxsize = 0.5,
collisiondetection = false, collisiondetection = false,
texture = 'more_fire_spark.png'}) texture = 'more_fire_spark.png'})
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 20, amount = 20,
time = 2, time = 2,
minpos = pos, minpos = pos,
maxpos = pos, maxpos = pos,
minvel = {x=-2, y=2, z=-2}, minvel = {x=-2, y=2, z=-2},
maxvel = {x=1, y=3, z=1}, maxvel = {x=1, y=3, z=1},
minacc = {x=0, y=6, z=0}, minacc = {x=0, y=6, z=0},
maxacc = {x=0, y=2, z=0}, maxacc = {x=0, y=2, z=0},
minexptime = 1, minexptime = 1,
maxexptime = 3, maxexptime = 3,
minsize = 3, minsize = 3,
maxsize = 5, maxsize = 5,
collisiondetection = false, collisiondetection = false,
texture = 'more_fire_smoke.png'}) texture = 'more_fire_smoke.png'})
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 10, amount = 10,
time = 4, time = 4,
minpos = pos, minpos = pos,
maxpos = pos, maxpos = pos,
minvel = {x=0, y= 3, z=0}, minvel = {x=0, y= 3, z=0},
maxvel = {x=0, y=5, z=0}, maxvel = {x=0, y=5, z=0},
minacc = {x=0.1, y=0.5, z=-0.1}, minacc = {x=0.1, y=0.5, z=-0.1},
maxacc = {x=-0.2, y=2, z=0.2}, maxacc = {x=-0.2, y=2, z=0.2},
minexptime = 1, minexptime = 1,
maxexptime = 3, maxexptime = 3,
minsize = 1, minsize = 1,
maxsize = 3, maxsize = 3,
collisiondetection = false, collisiondetection = false,
texture = 'more_fire_smoke.png'}) texture = 'more_fire_smoke.png'})
local r = 0-- Radius for destroying local r = 0-- Radius for destroying
for x = pos.x-r, pos.x+r, 1 do for x = pos.x-r, pos.x+r, 1 do
for y = pos.y-r, pos.y+r, 1 do for y = pos.y-r, pos.y+r, 1 do
for z = pos.z-r, pos.z+r, 1 do for z = pos.z-r, pos.z+r, 1 do
local cpos = {x=x,y=y,z=z} local cpos = {x=x,y=y,z=z}
if minetest.get_node(cpos).name == 'more_fire:napalm' then if minetest.get_node(cpos).name == 'more_fire:napalm' then
minetest.set_node(cpos,{name='fire:basic_flame'}) minetest.set_node(cpos,{name='fire:basic_flame'})
end end
if math.random(0,1) == 1 if math.random(0,1) == 1
or minetest.get_node(cpos).name == 'more_fire:napalm' or minetest.get_node(cpos).name == 'more_fire:napalm'
then then
minetest.remove_node(cpos) minetest.remove_node(cpos)
end end
end end
end end
end end
end, end,
}) })
minetest.register_abm({ minetest.register_abm({
nodenames={'fire:basic_flame'}, nodenames={'fire:basic_flame'},
neighbors={'air'}, neighbors={'air'},
interval = 1, interval = 1,
chance = 2, chance = 2,
action = function(pos, node) action = function(pos, node)
if if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' and
minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' and minetest.get_node({x=pos.x, y=pos.y+2.0, z=pos.z}).name == 'air' then
minetest.get_node({x=pos.x, y=pos.y+2.0, z=pos.z}).name == 'air' minetest.add_particlespawner({
then amount = 30,
minetest.add_particlespawner({ time = 2,
amount = 30, minpos = pos,
time = 2, maxpos = pos,
minpos = pos, minvel = {x=-2, y=2, z=-2},
maxpos = pos, maxvel = {x=1, y=3, z=1},
minvel = {x=-2, y=2, z=-2}, minacc = {x=0, y=6, z=0},
maxvel = {x=1, y=3, z=1}, maxacc = {x=0, y=2, z=0},
minacc = {x=0, y=6, z=0}, minexptime = 1,
maxacc = {x=0, y=2, z=0}, maxexptime = 3,
minexptime = 1, minsize = 10,
maxexptime = 3, maxsize = 20,
minsize = 10, collisiondetection = false,
maxsize = 20, texture = 'more_fire_smoke.png'})
collisiondetection = false, minetest.add_particlespawner({
texture = 'more_fire_smoke.png'}) amount = 15,
minetest.add_particlespawner({ time = 4,
amount = 15, minpos = pos,
time = 4, maxpos = pos,
minpos = pos, minvel = {x=0, y= 3, z=0},
maxpos = pos, maxvel = {x=0, y=5, z=0},
minvel = {x=0, y= 3, z=0}, minacc = {x=0.1, y=0.5, z=-0.1},
maxvel = {x=0, y=5, z=0}, maxacc = {x=-0.2, y=2, z=0.2},
minacc = {x=0.1, y=0.5, z=-0.1}, minexptime = 1,
maxacc = {x=-0.2, y=2, z=0.2}, maxexptime = 3,
minexptime = 1, minsize = 5,
maxexptime = 3, maxsize = 10,
minsize = 5, collisiondetection = false,
maxsize = 10, texture ='more_fire_smoke.png'})
collisiondetection = false, end
texture ='more_fire_smoke.png'}) end
end
end
}) })
--crafting recipes --crafting recipes
minetest.register_craft( { minetest.register_craft( {
output = 'more_fire:molotov_cocktail', output = 'more_fire:molotov_cocktail',
recipe = { recipe = {
{'farming:cotton'}, {'farming:cotton'},
{'more_fire:oil'}, {'more_fire:oil'},
{'vessels:glass_bottle'}, {'vessels:glass_bottle'},
} }
}) })
-- fuel recipes -- fuel recipes
minetest.register_craft({ minetest.register_craft({
type = 'fuel', type = 'fuel',
recipe = 'more_fire:molotov_cocktail', recipe = 'more_fire:molotov_cocktail',
burntime = 5, burntime = 5,
}) })

View File

@ -223,8 +223,7 @@ minetest.register_node('more_fire:campfire', {
description = 'Burning Campfire', description = 'Burning Campfire',
drawtype = 'mesh', drawtype = 'mesh',
mesh = 'more_fire_campfire.obj', mesh = 'more_fire_campfire.obj',
tiles = { tiles = {{name='fire_basic_flame_animated.png', animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1}},{name='more_fire_campfire_logs.png'}},
{name='fire_basic_flame_animated.png', animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1}}, {name='more_fire_campfire_logs.png'}},
inventory_image = 'more_fire_campfire.png', inventory_image = 'more_fire_campfire.png',
wield_image = 'more_fire_campfire.png', wield_image = 'more_fire_campfire.png',
paramtype = 'light', paramtype = 'light',
@ -385,6 +384,7 @@ minetest.register_node('more_fire:oil_lamp_on', {
drawtype = 'mesh', drawtype = 'mesh',
mesh = 'more_fire_lamp_wall.obj', mesh = 'more_fire_lamp_wall.obj',
tiles = {'more_fire_lamp.png'}, tiles = {'more_fire_lamp.png'},
use_alpha_texture = true,
groups = {choppy=2, dig_immediate=2, not_in_creative_inventory=1}, groups = {choppy=2, dig_immediate=2, not_in_creative_inventory=1},
paramtype = 'light', paramtype = 'light',
paramtype2 = 'facedir', paramtype2 = 'facedir',

View File

@ -6,199 +6,197 @@
local Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua') local Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua')
minetest.register_craftitem('more_fire:smokebomb', { minetest.register_craftitem('more_fire:smokebomb', {
description = 'Smoke Bomb', description = 'Smoke Bomb',
inventory_image = 'more_fire_smokebomb.png', inventory_image = 'more_fire_smokebomb.png',
on_place = function(itemstack, user, pointed_thing) on_place = function(itemstack, user, pointed_thing)
itemstack:take_item() itemstack:take_item()
minetest.sound_play('more_fire_shatter', {gain = 1.0}) minetest.sound_play('more_fire_shatter', {gain = 1.0})
--Shattered glass Particles --Shattered glass Particles
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 40, amount = 40,
time = 0.1, time = 0.1,
minpos = pointed_thing.above, minpos = pointed_thing.above,
maxpos = pointed_thing.above, maxpos = pointed_thing.above,
minvel = {x=2, y=0.2, z=2}, minvel = {x=2, y=0.2, z=2},
maxvel = {x=-2, y=0.5, z=-2}, maxvel = {x=-2, y=0.5, z=-2},
minacc = {x=0, y=-6, z=0}, minacc = {x=0, y=-6, z=0},
maxacc = {x=0, y=-10, z=0}, maxacc = {x=0, y=-10, z=0},
minexptime = 0.5, minexptime = 0.5,
maxexptime = 2, maxexptime = 2,
minsize = 0.2, minsize = 0.2,
maxsize = 5, maxsize = 5,
collisiondetection = true, collisiondetection = true,
texture = 'more_fire_shatter.png'}) texture = 'more_fire_shatter.png'})
--smoke particles --smoke particles
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 400, amount = 400,
time = 0.1, time = 0.1,
minpos = pointed_thing.above, minpos = pointed_thing.above,
maxpos = pointed_thing.above, maxpos = pointed_thing.above,
minvel = {x=2, y=0.2, z=2}, minvel = {x=2, y=0.2, z=2},
maxvel = {x=-2, y=0.5, z=-2}, maxvel = {x=-2, y=0.5, z=-2},
minacc = {x=0, y=-6, z=0}, minacc = {x=0, y=-6, z=0},
maxacc = {x=0, y=-10, z=0}, maxacc = {x=0, y=-10, z=0},
minexptime = 5, minexptime = 5,
maxexptime = 2, maxexptime = 2,
minsize = 5, minsize = 5,
maxsize = 20, maxsize = 20,
collisiondetection = true, collisiondetection = true,
texture = 'more_fire_smoke.png'}) texture = 'more_fire_smoke.png'})
--more smoke particles --more smoke particles
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 600, amount = 600,
time = 1, time = 1,
minpos = pointed_thing.above, minpos = pointed_thing.above,
maxpos = pointed_thing.above, maxpos = pointed_thing.above,
minvel = {x=10, y= 3, z=10}, minvel = {x=10, y= 3, z=10},
maxvel = {x=-10, y= 3, z=-10}, maxvel = {x=-10, y= 3, z=-10},
minacc = {x=2, y=2, z=2}, minacc = {x=2, y=2, z=2},
maxacc = {x=-2, y=1, z=-2}, maxacc = {x=-2, y=1, z=-2},
minexptime = 2, minexptime = 2,
maxexptime = 3, maxexptime = 3,
minsize = 2, minsize = 2,
maxsize = 20, maxsize = 20,
collisiondetection = true, collisiondetection = true,
texture = 'more_fire_smoke.png'}) texture = 'more_fire_smoke.png'})
--even more smoke particles --even more smoke particles
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 400, amount = 400,
time = 1, time = 1,
minpos = pointed_thing.above, minpos = pointed_thing.above,
maxpos = pointed_thing.above, maxpos = pointed_thing.above,
minvel = {x=0.2, y=0.2, z=0.2}, minvel = {x=0.2, y=0.2, z=0.2},
maxvel = {x=-0.2, y=0.5, z=-0.2}, maxvel = {x=-0.2, y=0.5, z=-0.2},
minacc = {x=10, y= 2, z=10}, minacc = {x=10, y= 2, z=10},
maxacc = {x=-10, y= 1, z=-10}, maxacc = {x=-10, y= 1, z=-10},
minexptime = 2, minexptime = 2,
maxexptime = 3, maxexptime = 3,
minsize = 20, minsize = 20,
maxsize = 2, maxsize = 2,
collisiondetection = true, collisiondetection = true,
texture = 'more_fire_smoke.png'}) texture = 'more_fire_smoke.png'})
local dir = Vec3(user:get_look_dir()) *20 local dir = Vec3(user:get_look_dir()) *20
minetest.add_particle( minetest.add_particle(
{x=user:getpos().x, y=user:getpos().y+1.5, z=user:getpos().z}, {x=dir.x, y=dir.y, z=dir.z}, {x=0, y=-10, z=0}, 0.2, {x=user:getpos().x, y=user:getpos().y+1.5, z=user:getpos().z}, {x=dir.x, y=dir.y, z=dir.z}, {x=0, y=-10, z=0}, 0.2,
6, false, 'more_fire_smokebomb.png') 6, false, 'more_fire_smokebomb.png')
return itemstack return itemstack
end, end,
}) })
local function throw_smokebomb(item, player) local function throw_smokebomb(item, player)
local playerpos = player:getpos() local playerpos = player:getpos()
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.625,z=playerpos.z}, 'more_fire:smokebomb_entity') local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.625,z=playerpos.z}, 'more_fire:smokebomb_entity')
local dir = player:get_look_dir() local dir = player:get_look_dir()
obj:setvelocity({x=dir.x*30, y=dir.y*30, z=dir.z*30}) obj:setvelocity({x=dir.x*30, y=dir.y*30, z=dir.z*30})
obj:setacceleration({x=dir.x*-3, y=-dir.y^8*80-10, z=dir.z*-3}) obj:setacceleration({x=dir.x*-3, y=-dir.y^8*80-10, z=dir.z*-3})
if not minetest.settings:get_bool('creative_mode') then if not minetest.settings:get_bool('creative_mode') then
item:take_item() item:take_item()
end end
return item return item
end end
local radius = 5 local function add_effects(pos)
minetest.add_particlespawner({
local function add_effects(pos, radius) amount = 200,
minetest.add_particlespawner({ time = 0.1,
amount = 200, minpos = vector.subtract(pos, 5 / 3),
time = 0.1, maxpos = vector.add(pos, 5 / 3),
minpos = vector.subtract(pos, radius / 3), minvel = {x=2, y=0.2, z=2},
maxpos = vector.add(pos, radius / 3), maxvel = {x=-2, y=-0.5, z=-2},
minvel = {x=2, y=0.2, z=2}, minacc = {x=1, y=-6, z=1},
maxvel = {x=-2, y=-0.5, z=-2}, maxacc = {x=1, y=-10, z=1},
minacc = {x=1, y=-6, z=1}, minexptime = 1,
maxacc = {x=1, y=-10, z=1}, maxexptime = 5,
minexptime = 1, minsize = 10,
maxexptime = 5, maxsize = 20,
minsize = 10, texture = 'more_fire_smoke.png',})
maxsize = 20, minetest.add_particlespawner({
texture = 'more_fire_smoke.png',}) amount = 100,
minetest.add_particlespawner({ time = 2,
amount = 100, minpos = vector.subtract(pos, 5 / 2),
time = 2, maxpos = vector.add(pos, 5 / 2),
minpos = vector.subtract(pos, radius / 2), minvel = {x=0.2, y=0.2, z=0.2},
maxpos = vector.add(pos, radius / 2), maxvel = {x=-0.2, y=0.5, z=-0.2},
minvel = {x=0.2, y=0.2, z=0.2}, minacc = {x=10, y= 2, z=10},
maxvel = {x=-0.2, y=0.5, z=-0.2}, maxacc = {x=-10, y= 1, z=-10},
minacc = {x=10, y= 2, z=10}, minexptime =1,
maxacc = {x=-10, y= 1, z=-10}, maxexptime = 3,
minexptime =1, minsize = 5,
maxexptime = 3, maxsize = 15,
minsize = 5, texture = 'more_fire_smoke.png',})
maxsize = 15,
texture = 'more_fire_smoke.png',})
end end
local function plume(pos) local function plume(pos)
minetest.set_node(pos, {name='more_fire:plume'}) minetest.set_node(pos, {name='more_fire:plume'})
minetest.get_node_timer(pos):start(3.0) minetest.get_node_timer(pos):start(3.0)
add_effects(pos, radius) add_effects(pos)
end end
local MORE_FIRE_SMOKEBOMB_ENTITY = { local MORE_FIRE_SMOKEBOMB_ENTITY = {
timer=0, timer=0,
collisionbox = {0,0,0,0,0,0}, collisionbox = {0,0,0,0,0,0},
physical = false, physical = false,
textures = {'more_fire_smokebomb.png'}, textures = {'more_fire_smokebomb.png'},
lastpos={}, lastpos={},
} }
MORE_FIRE_SMOKEBOMB_ENTITY.on_step = function(self, dtime) MORE_FIRE_SMOKEBOMB_ENTITY.on_step = function(self, dtime)
self.timer = self.timer + dtime self.timer = self.timer + dtime
local pos = self.object:getpos() local pos = self.object:getpos()
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 10, amount = 10,
time = 0.5, time = 0.5,
minpos = pos, minpos = pos,
maxpos = pos, maxpos = pos,
minvel = {x=-0, y=0, z=-0.5}, minvel = {x=-0, y=0, z=-0.5},
maxvel = {x=0, y=0, z=-0.75}, maxvel = {x=0, y=0, z=-0.75},
minacc = vector.new(), minacc = vector.new(),
maxacc = vector.new(), maxacc = vector.new(),
minexptime = 0.5, minexptime = 0.5,
maxexptime = 1, maxexptime = 1,
minsize = 0.25, minsize = 0.25,
maxsize = 0.5, maxsize = 0.5,
texture = 'more_fire_smoke.png',}) texture = 'more_fire_smoke.png',})
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 10, amount = 10,
time = 0.25, time = 0.25,
minpos = pos, minpos = pos,
maxpos = pos, maxpos = pos,
minvel = {x=-0, y=0, z=-0.5}, minvel = {x=-0, y=0, z=-0.5},
maxvel = {x=0, y=0, z=-0.75}, maxvel = {x=0, y=0, z=-0.75},
minacc = {x=0, y=0, z=-0.75}, minacc = {x=0, y=0, z=-0.75},
maxacc = {x=-0, y=0, z=-0.5}, maxacc = {x=-0, y=0, z=-0.5},
minexptime = 0.25, minexptime = 0.25,
maxexptime = 0.5, maxexptime = 0.5,
minsize = 0.5, minsize = 0.5,
maxsize = 0.75, maxsize = 0.75,
texture = 'more_fire_smoke.png',}) texture = 'more_fire_smoke.png',})
if self.timer>0.2 then if self.timer>0.2 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= 'more_fire:smokebomb_entity' and obj:get_luaentity().name ~= '__builtin:item' then if obj:get_luaentity().name ~= 'more_fire:smokebomb_entity' and obj:get_luaentity().name ~= '__builtin:item' then
if self.node ~= '' then if self.node ~= '' then
minetest.sound_play('more_fire_shatter', {gain = 1.0}) minetest.sound_play('more_fire_shatter', {gain = 1.0})
local damage = 1 local damage = 1
obj:punch(self.object, 1.0, { obj:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval=1.0,
damage_groups={fleshy=damage}, damage_groups={fleshy=damage},
}, nil) }, nil)
self.object:remove() self.object:remove()
end end
end end
end end
end end
if self.lastpos.x~=nil then if self.lastpos.x~=nil then
if node.name ~= 'air' then if node.name ~= 'air' then
self.object:remove() self.object:remove()
plume(self.lastpos) plume(self.lastpos)
end end
end end
self.lastpos={x=pos.x, y=pos.y, z=pos.z} self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end end
end end
minetest.register_entity('more_fire:smokebomb_entity', MORE_FIRE_SMOKEBOMB_ENTITY) minetest.register_entity('more_fire:smokebomb_entity', MORE_FIRE_SMOKEBOMB_ENTITY)
@ -208,86 +206,83 @@ minetest.override_item('more_fire:smokebomb', {on_use = throw_smokebomb})
minetest.register_node('more_fire:plume', { minetest.register_node('more_fire:plume', {
drawtype = 'plantlike', drawtype = 'plantlike',
description = 'Smoke Plume', description = 'Smoke Plume',
tiles = {{ tiles = {{
name='more_fire_smoke_animated.png', name='more_fire_smoke_animated.png',
animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1}, animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1},
}}, }},
inventory_image = 'more_fire_smoke.png', inventory_image = 'more_fire_smoke.png',
light_source = 8, light_source = 8,
groups = {dig_immediate=3, not_in_creative_inventory =1, not_in_craft_guide=1}, groups = {dig_immediate=3, not_in_creative_inventory =1, not_in_craft_guide=1},
drop = '', drop = '',
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
on_timer = function(pos, elapsed) damage_per_second = 1,
minetest.remove_node(pos) on_timer = function(pos, elapsed)
end, minetest.remove_node(pos)
damage_per_second = 1, end,
}) })
minetest.register_abm({ minetest.register_abm({
nodenames={'more_fire:plume'}, nodenames={'more_fire:plume'},
neighbors={'air'}, neighbors={'air'},
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node) action = function(pos, node)
if if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' and
minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' and minetest.get_node({x=pos.x, y=pos.y+2.0, z=pos.z}).name == 'air' then
minetest.get_node({x=pos.x, y=pos.y+2.0, z=pos.z}).name == 'air' minetest.add_particlespawner({
then amount = 400,
minetest.add_particlespawner({ time = 3,
amount = 400, minpos = pos,
time = 3, maxpos = pos,
minpos = pos, minvel = {x=2, y=-0.2, z=2},
maxpos = pos, maxvel = {x=-2, y=-0.5, z=-2},
minvel = {x=2, y=-0.2, z=2}, minacc = {x=0, y=-6, z=0},
maxvel = {x=-2, y=-0.5, z=-2}, maxacc = {x=0, y=-10, z=0},
minacc = {x=0, y=-6, z=0}, minexptime = 2,
maxacc = {x=0, y=-10, z=0}, maxexptime = 6,
minexptime = 2, minsize = 0.05,
maxexptime = 6, maxsize = 0.5,
minsize = 0.05, collisiondetection =false,
maxsize = 0.5, texture = 'more_fire_smoke.png'})
collisiondetection =false, minetest.add_particlespawner({
texture = 'more_fire_smoke.png'}) amount = 50,
minetest.add_particlespawner({ time = 2,
amount = 50, minpos = pos,
time = 2, maxpos = pos,
minpos = pos, minvel = {x=-2, y=0.5, z=-2},
maxpos = pos, maxvel = {x=2, y=0.5, z=2},
minvel = {x=-2, y=0.5, z=-2}, minacc = {x=0, y=0.04, z=0},
maxvel = {x=2, y=0.5, z=2}, maxacc = {x=0, y=0.01, z=0},
minacc = {x=0, y=0.04, z=0}, minexptime = 1,
maxacc = {x=0, y=0.01, z=0}, maxexptime = 3,
minexptime = 1, minsize = 3,
maxexptime = 3, maxsize = 5,
minsize = 3, collisiondetection = false,
maxsize = 5, texture = 'more_fire_smoke.png'})
collisiondetection = false, minetest.add_particlespawner({
texture = 'more_fire_smoke.png'}) amount = 400,
minetest.add_particlespawner({ time = 2,
amount = 400, minpos = vector.subtract(pos, 5 / 2),
time = 2, maxpos = vector.add(pos, 5 / 2),
minpos = vector.subtract(pos, radius / 2), minvel = {x=0.2, y=2, z=0.2},
maxpos = vector.add(pos, radius / 2), maxvel = {x=-0.2, y=2, z=-0.2},
minvel = {x=0.2, y=2, z=0.2}, minacc = {x=10, y= 2, z=10},
maxvel = {x=-0.2, y=2, z=-0.2}, maxacc = {x=-10, y= 1, z=-10},
minacc = {x=10, y= 2, z=10}, minexptime =1,
maxacc = {x=-10, y= 1, z=-10}, maxexptime = 3,
minexptime =1, minsize = 5,
maxexptime = 3, maxsize = 15,
minsize = 5, texture = 'more_fire_smoke.png',})
maxsize = 15, end
texture = 'more_fire_smoke.png',}) end
end
end
}) })
--crafting recipes minetest.register_craft({
minetest.register_craft( { output = 'more_fire:smoke_bomb',
output = 'more_fire:smoke_bomb', recipe = {
recipe = { {'more_fire:flintstone'},
{'more_fire:flintstone'}, {'more_fire:charcoal'},
{'more_fire:charcoal'}, {'vessels:glass_bottle'},
{'vessels:glass_bottle'}, }
}
}) })

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

View File

@ -1,13 +0,0 @@
local USES = 20
minetest.register_tool('more_fire:marker', {
description = 'chard stick',
inventory_image = 'more_fire_chard_stick.png',
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == 'node' then
minetest.set_node(pointed_thing.above, {name = "more_fire:marking", param2=minetest.dir_to_facedir(user:get_look_dir())})
itemstack:add_wear(65535 / (USES - 1))
return itemstack
end
end,
})