small updates and cleaning of code.
parent
25cf56720a
commit
b86d78cc77
19
Credits.txt
19
Credits.txt
|
@ -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/
|
||||
|
3
LICENSE
3
LICENSE
|
@ -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
356
abms.lua
|
@ -1,198 +1,196 @@
|
|||
minetest.register_abm({ -- Controls non-contained fire
|
||||
nodenames = {'more_fire:embers','more_fire:campfire'},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local fuel_time = meta:get_float("fuel_time") or 0
|
||||
local src_time = meta:get_float("src_time") or 0
|
||||
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
|
||||
local inv = meta:get_inventory()
|
||||
local srclist = inv:get_list("src")
|
||||
local cooked = nil
|
||||
if srclist then
|
||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
local was_active = false
|
||||
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||
was_active = true
|
||||
meta:set_float("fuel_time", meta:get_float("fuel_time") + 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 inv:room_for_item("dst",cooked.item) then
|
||||
inv:add_item("dst", cooked.item)
|
||||
local srcstack = inv:get_stack("src", 1)
|
||||
srcstack:take_item()
|
||||
inv:set_stack("src", 1, srcstack)
|
||||
else
|
||||
print("Could not insert '"..cooked.item:to_string().."'")
|
||||
end
|
||||
meta:set_string("src_time", 0)
|
||||
end
|
||||
end
|
||||
nodenames = {'more_fire:embers','more_fire:campfire'},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local fuel_time = meta:get_float("fuel_time") or 0
|
||||
local src_time = meta:get_float("src_time") or 0
|
||||
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
|
||||
local inv = meta:get_inventory()
|
||||
local srclist = inv:get_list("src")
|
||||
local cooked = nil
|
||||
if srclist then
|
||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
local was_active = false
|
||||
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||
was_active = true
|
||||
meta:set_float("fuel_time", meta:get_float("fuel_time") + 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 inv:room_for_item("dst",cooked.item) then
|
||||
inv:add_item("dst", cooked.item)
|
||||
local srcstack = inv:get_stack("src", 1)
|
||||
srcstack:take_item()
|
||||
inv:set_stack("src", 1, srcstack)
|
||||
end
|
||||
meta:set_string("src_time", 0)
|
||||
end
|
||||
end
|
||||
|
||||
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})
|
||||
local percent = math.floor(meta:get_float("fuel_time") /
|
||||
meta:get_float("fuel_totaltime") * 100)
|
||||
meta:set_string("infotext","Campfire active: "..percent.."%")
|
||||
minetest.swap_node(pos, {name = 'more_fire:campfire'})
|
||||
return
|
||||
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
|
||||
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})
|
||||
local percent = math.floor(meta:get_float("fuel_time") /
|
||||
meta:get_float("fuel_totaltime") * 100)
|
||||
meta:set_string("infotext","Campfire active: "..percent.."%")
|
||||
minetest.swap_node(pos, {name = 'more_fire:campfire'})
|
||||
return
|
||||
end
|
||||
|
||||
local fuel = nil
|
||||
local cooked = nil
|
||||
local fuellist = inv:get_list("fuel")
|
||||
local srclist = inv:get_list("src")
|
||||
if srclist then
|
||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
|
||||
if fuellist then
|
||||
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||
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,
|
||||
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 = nil
|
||||
local fuellist = inv:get_list("fuel")
|
||||
local srclist = inv:get_list("src")
|
||||
if srclist then
|
||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
|
||||
if fuellist then
|
||||
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||
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.
|
||||
nodenames = {'more_fire:embers_contained', 'more_fire:campfire_contained'},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
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 src_time = meta:get_float("src_time") or 0
|
||||
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
|
||||
local inv = meta:get_inventory()
|
||||
local srclist = inv:get_list("src")
|
||||
local cooked = nil
|
||||
if srclist then
|
||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
local was_active = false
|
||||
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||
was_active = true
|
||||
meta:set_float("fuel_time", meta:get_float("fuel_time") + 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 inv:room_for_item("dst",cooked.item) then
|
||||
inv:add_item("dst", cooked.item)
|
||||
local srcstack = inv:get_stack("src", 1)
|
||||
srcstack:take_item()
|
||||
inv:set_stack("src", 1, srcstack)
|
||||
else
|
||||
print("Could not insert '"..cooked.item:to_string().."'")
|
||||
end
|
||||
meta:set_string("src_time", 0)
|
||||
end
|
||||
end
|
||||
nodenames = {'more_fire:embers_contained', 'more_fire:campfire_contained'},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
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 src_time = meta:get_float("src_time") or 0
|
||||
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
|
||||
local inv = meta:get_inventory()
|
||||
local srclist = inv:get_list("src")
|
||||
local cooked = nil
|
||||
if srclist then
|
||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
local was_active = false
|
||||
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||
was_active = true
|
||||
meta:set_float("fuel_time", meta:get_float("fuel_time") + 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 inv:room_for_item("dst",cooked.item) then
|
||||
inv:add_item("dst", cooked.item)
|
||||
local srcstack = inv:get_stack("src", 1)
|
||||
srcstack:take_item()
|
||||
inv:set_stack("src", 1, srcstack)
|
||||
else
|
||||
print("Could not insert '"..cooked.item:to_string().."'")
|
||||
end
|
||||
meta:set_string("src_time", 0)
|
||||
end
|
||||
end
|
||||
|
||||
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})
|
||||
local percent = math.floor(meta:get_float("fuel_time") /
|
||||
meta:get_float("fuel_totaltime") * 100)
|
||||
meta:set_string("infotext","Campfire active: "..percent.."%")
|
||||
minetest.swap_node(pos, {name = 'more_fire:campfire_contained'})
|
||||
return
|
||||
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
|
||||
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})
|
||||
local percent = math.floor(meta:get_float("fuel_time") /
|
||||
meta:get_float("fuel_totaltime") * 100)
|
||||
meta:set_string("infotext","Campfire active: "..percent.."%")
|
||||
minetest.swap_node(pos, {name = 'more_fire:campfire_contained'})
|
||||
return
|
||||
end
|
||||
|
||||
local fuel = nil
|
||||
local cooked = nil
|
||||
local fuellist = inv:get_list("fuel")
|
||||
local srclist = inv:get_list("src")
|
||||
if srclist then
|
||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
|
||||
if fuellist then
|
||||
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||
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,
|
||||
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 = nil
|
||||
local fuellist = inv:get_list("fuel")
|
||||
local srclist = inv:get_list("src")
|
||||
if srclist then
|
||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
end
|
||||
|
||||
if fuellist then
|
||||
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||
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
|
||||
nodenames = {'more_fire:embers', 'more_fire:embers_contained'},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then
|
||||
smoke_particles(pos)
|
||||
end
|
||||
end
|
||||
nodenames = {'more_fire:embers', 'more_fire:embers_contained'},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then
|
||||
smoke_particles(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({ --embers for fire
|
||||
nodenames = {'more_fire:campfire', 'more_fire:campfire_contained'},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then
|
||||
ember_particles(pos)
|
||||
end
|
||||
end
|
||||
nodenames = {'more_fire:campfire', 'more_fire:campfire_contained'},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then
|
||||
ember_particles(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({ --lava
|
||||
nodenames = {'default:lava_source', 'default:lava_flowing'},
|
||||
interval = 4,
|
||||
chance = 15,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then
|
||||
lava_particles(pos)
|
||||
end
|
||||
end
|
||||
nodenames = {'default:lava_source', 'default:lava_flowing'},
|
||||
interval = 4,
|
||||
chance = 15,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z}).name == 'air' then
|
||||
lava_particles(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
6-4-20:
|
||||
Code updates and cleaning. No new features.
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
|
||||
-- check if charcoal already defined by mod ethereal
|
||||
if minetest.get_modpath("ethereal") then
|
||||
minetest.override_item("ethereal:charcoal_lump",{groups={coal = 1}})
|
||||
minetest.register_alias("more_fire:charcoal", "ethereal:charcoal_lump")
|
||||
minetest.override_item("ethereal:charcoal_lump",{groups={coal = 1}})
|
||||
minetest.register_alias("more_fire:charcoal", "ethereal:charcoal_lump")
|
||||
else
|
||||
minetest.register_craftitem('more_fire:charcoal', {
|
||||
description = 'Charcoal',
|
||||
inventory_image = 'more_fire_charcoal_lump.png',
|
||||
groups = {coal = 1}
|
||||
})
|
||||
minetest.register_craftitem('more_fire:charcoal', {
|
||||
description = 'Charcoal',
|
||||
inventory_image = 'more_fire_charcoal_lump.png',
|
||||
groups = {coal = 1}
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craftitem('more_fire:oil', {
|
||||
description = 'lantern oil',
|
||||
inventory_image = 'more_fire_oil.png',
|
||||
description = 'lantern oil',
|
||||
inventory_image = 'more_fire_oil.png',
|
||||
})
|
||||
|
||||
minetest.register_craftitem('more_fire:dried_grass', {
|
||||
description = 'dried grass',
|
||||
inventory_image = 'more_fire_grass_dried.png',
|
||||
groups = {kindling=1}
|
||||
description = 'dried grass',
|
||||
inventory_image = 'more_fire_grass_dried.png',
|
||||
groups = {kindling=1}
|
||||
})
|
||||
|
|
194
crafts.lua
194
crafts.lua
|
@ -1,167 +1,167 @@
|
|||
minetest.register_craft({ --recycle old torches.
|
||||
type = 'shapeless',
|
||||
output = 'default:stick',
|
||||
recipe = {'more_fire:torch_stub', 'more_fire:torch_stub', 'more_fire:torch_stub', 'more_fire:torch_stub'},
|
||||
type = 'shapeless',
|
||||
output = 'default:stick',
|
||||
recipe = {'more_fire:torch_stub', 'more_fire:torch_stub', 'more_fire:torch_stub', 'more_fire:torch_stub'},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:charcoal_block 1',
|
||||
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'},
|
||||
}
|
||||
output = 'more_fire:charcoal_block',
|
||||
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'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:charcoal 9',
|
||||
recipe = {
|
||||
{'more_fire:charcoal_block'}
|
||||
}
|
||||
output = 'more_fire:charcoal 9',
|
||||
recipe = {
|
||||
{'more_fire:charcoal_block'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:embers 1',
|
||||
recipe = {
|
||||
{'more_fire:kindling'},
|
||||
{'default:torch'},
|
||||
}
|
||||
output = 'more_fire:embers',
|
||||
recipe = {
|
||||
{'more_fire:kindling'},
|
||||
{'default:torch'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:embers 1',
|
||||
recipe = {
|
||||
{'group:kindling', 'default:torch', 'group:kindling'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
}
|
||||
output = 'more_fire:embers',
|
||||
recipe = {
|
||||
{'group:kindling', 'default:torch', 'group:kindling'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:embers 1',
|
||||
recipe = {
|
||||
{'group:flammable', 'default:torch', 'group:flammable'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
}
|
||||
output = 'more_fire:embers',
|
||||
recipe = {
|
||||
{'group:flammable', 'default:torch', 'group:flammable'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:embers_contained 1',
|
||||
recipe = {
|
||||
{'', 'more_fire:embers', ''},
|
||||
{'default:cobble', 'default:cobble', 'default:cobble'},
|
||||
}
|
||||
output = 'more_fire:embers_contained',
|
||||
recipe = {
|
||||
{'', 'more_fire:embers', ''},
|
||||
{'default:cobble', 'default:cobble', 'default:cobble'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:embers_contained 1',
|
||||
recipe = {
|
||||
{'more_fire:kindling_contained'},
|
||||
{'default:torch'},
|
||||
}
|
||||
output = 'more_fire:embers_contained',
|
||||
recipe = {
|
||||
{'more_fire:kindling_contained'},
|
||||
{'default:torch'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:torch_weak 4',
|
||||
recipe = {
|
||||
{'group:kindling', 'group:kindling', 'group:kindling'},
|
||||
{'group:kindling', 'group:stick', 'group:kindling'},
|
||||
{'', 'group:stick', ''}
|
||||
}
|
||||
output = 'more_fire:torch_weak 4',
|
||||
recipe = {
|
||||
{'group:kindling', 'group:kindling', 'group:kindling'},
|
||||
{'group:kindling', 'group:stick', 'group:kindling'},
|
||||
{'', 'group:stick', ''}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'shapeless',
|
||||
output = 'default:torch',
|
||||
recipe = {'more_fire:torch_weak', 'group:coal'},
|
||||
type = 'shapeless',
|
||||
output = 'default:torch',
|
||||
recipe = {'more_fire:torch_weak', 'group:coal'},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:kindling 1',
|
||||
recipe = {
|
||||
output = 'more_fire:kindling',
|
||||
recipe = {
|
||||
{'group:kindling', '', 'group:kindling'},
|
||||
{'group:kindling', 'group:wood', 'group:kindling'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:kindling_contained 1',
|
||||
recipe = {
|
||||
{'','more_fire:kindling', ''},
|
||||
{'default:cobble','default:cobble','default:cobble'},
|
||||
}
|
||||
output = 'more_fire:kindling_contained',
|
||||
recipe = {
|
||||
{'','more_fire:kindling', ''},
|
||||
{'default:cobble','default:cobble','default:cobble'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:oil_lamp_off 1',
|
||||
recipe = {
|
||||
{'default:glass'},
|
||||
{'farming:cotton'},
|
||||
{'default:iron_lump'},
|
||||
}
|
||||
output = 'more_fire:oil_lamp_off',
|
||||
recipe = {
|
||||
{'default:glass'},
|
||||
{'farming:cotton'},
|
||||
{'default:iron_lump'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:oil 1',
|
||||
recipe = {
|
||||
{'group:leaves', 'group:leaves', 'group:leaves'},
|
||||
{'group:leaves', 'group:leaves', 'group:leaves'},
|
||||
{'', 'vessels:glass_bottle', ''},
|
||||
}
|
||||
output = 'more_fire:oil',
|
||||
recipe = {
|
||||
{'group:leaves', 'group:leaves', 'group:leaves'},
|
||||
{'group:leaves', 'group:leaves', 'group:leaves'},
|
||||
{'', 'vessels:glass_bottle', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:oil_lamp_off 1',
|
||||
recipe = {
|
||||
{'more_fire:oil_lamp_table_off'}
|
||||
}
|
||||
output = 'more_fire:oil_lamp_off',
|
||||
recipe = {
|
||||
{'more_fire:oil_lamp_table_off'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:oil_lamp_table_off 1',
|
||||
recipe = {
|
||||
{'more_fire:oil_lamp_off'}
|
||||
}
|
||||
output = 'more_fire:oil_lamp_table_off',
|
||||
recipe = {
|
||||
{'more_fire:oil_lamp_off'}
|
||||
}
|
||||
})
|
||||
|
||||
-- cooking recipes
|
||||
if not minetest.get_modpath("ethereal") then
|
||||
minetest.register_craft({
|
||||
type = 'cooking',
|
||||
recipe = 'group:tree',
|
||||
output = 'more_fire:charcoal',
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = 'cooking',
|
||||
recipe = 'group:tree',
|
||||
output = 'more_fire:charcoal',
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'cooking',
|
||||
recipe = 'default:grass_1',
|
||||
output = 'more_fire:dried_grass',
|
||||
cooktime = 1,
|
||||
type = 'cooking',
|
||||
recipe = 'default:grass_1',
|
||||
output = 'more_fire:dried_grass',
|
||||
cooktime = 1,
|
||||
})
|
||||
|
||||
-- fuel recipes
|
||||
if not minetest.get_modpath("ethereal") then
|
||||
minetest.register_craft({
|
||||
type = 'fuel',
|
||||
recipe = 'more_fire:charcoal',
|
||||
burntime = 35,
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = 'fuel',
|
||||
recipe = 'more_fire:charcoal',
|
||||
burntime = 35,
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'fuel',
|
||||
recipe = 'more_fire:oil',
|
||||
burntime = 10,
|
||||
type = 'fuel',
|
||||
recipe = 'more_fire:oil',
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'fuel',
|
||||
recipe = 'more_fire:charcoal_block',
|
||||
burntime = 315,
|
||||
type = 'fuel',
|
||||
recipe = 'more_fire:charcoal_block',
|
||||
burntime = 315,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'fuel',
|
||||
recipe = 'more_fire:torch_stub',
|
||||
burntime = 2,
|
||||
type = 'fuel',
|
||||
recipe = 'more_fire:torch_stub',
|
||||
burntime = 2,
|
||||
})
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
default
|
||||
farming
|
||||
fire
|
||||
vessels
|
|
@ -1 +0,0 @@
|
|||
This is a Minetest mod that adds more/better fire related stuff.
|
173
functions.lua
173
functions.lua
|
@ -1,104 +1,101 @@
|
|||
function default.get_hotbar_bg(x,y)
|
||||
local out = ''
|
||||
for i=0,7,1 do
|
||||
out = out ..'image['..x+i..','..y..';1,1;gui_hb_bg.png]'
|
||||
end
|
||||
return out
|
||||
local out = ''
|
||||
for i=0,7,1 do
|
||||
out = out ..'image['..x+i..','..y..';1,1;gui_hb_bg.png]'
|
||||
end
|
||||
return out
|
||||
end
|
||||
|
||||
function more_fire.fire_formspec(item_percent)
|
||||
local formspec =
|
||||
'size[8,6.75]'..
|
||||
default.gui_slots..
|
||||
'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'..
|
||||
'background[8,6.75;0,0;more_fire_campfire_bg.png;true]'..
|
||||
'label[2,.75;< Add More Wood]'..
|
||||
'label[1.25,2; Cook Something >]'..
|
||||
'list[current_name;fuel;1,.5;1,1;]'..
|
||||
'list[current_name;src;4,1.75;1,1;]'..
|
||||
'image[5,1.75;1,1;gui_furnace_arrow_bg.png^[lowpart:'..
|
||||
(item_percent)..':gui_furnace_arrow_fg.png^[transformR270]'..
|
||||
'list[current_name;dst;6,1.75;2,1;]'..
|
||||
'list[current_player;main;0,2.75;8,1;]'..
|
||||
'list[current_player;main;0,4;8,3;8]'..
|
||||
default.get_hotbar_bg(0,2.75)
|
||||
return formspec
|
||||
local formspec =
|
||||
'size[8,6.75]'..
|
||||
default.gui_slots..
|
||||
'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'..
|
||||
'background[8,6.75;0,0;more_fire_campfire_bg.png;true]'..
|
||||
'label[2,.75;< Add More Wood]'..
|
||||
'label[1.25,2; Cook Something >]'..
|
||||
'list[current_name;fuel;1,.5;1,1;]'..
|
||||
'list[current_name;src;4,1.75;1,1;]'..
|
||||
'image[5,1.75;1,1;gui_furnace_arrow_bg.png^[lowpart:'..
|
||||
(item_percent)..':gui_furnace_arrow_fg.png^[transformR270]'..
|
||||
'list[current_name;dst;6,1.75;2,1;]'..
|
||||
'list[current_player;main;0,2.75;8,1;]'..
|
||||
'list[current_player;main;0,4;8,3;8]'..
|
||||
default.get_hotbar_bg(0,2.75)
|
||||
return formspec
|
||||
end
|
||||
|
||||
more_fire.embers_formspec =
|
||||
'size[8,6.75]'..
|
||||
default.gui_slots..
|
||||
'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'..
|
||||
'background[8,6.75;0,0;more_fire_campfire_bg.png;true]'..
|
||||
'label[2,.75;< Add More Wood]'..
|
||||
'label[1.25,2; Cook Something >]'..
|
||||
'list[current_name;fuel;1,.5;1,1;]'..
|
||||
'list[current_name;src;4,1.75;1,1;]'..
|
||||
'image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270]'..
|
||||
'list[current_name;dst;6,1.75;2,1;]'..
|
||||
'list[current_player;main;0,2.75;8,1;]'..
|
||||
'list[current_player;main;0,4;8,3;8]'..
|
||||
default.get_hotbar_bg(0,2.75)
|
||||
'size[8,6.75]'..
|
||||
default.gui_slots..
|
||||
'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'..
|
||||
'background[8,6.75;0,0;more_fire_campfire_bg.png;true]'..
|
||||
'label[2,.75;< Add More Wood]'..
|
||||
'label[1.25,2; Cook Something >]'..
|
||||
'list[current_name;fuel;1,.5;1,1;]'..
|
||||
'list[current_name;src;4,1.75;1,1;]'..
|
||||
'image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270]'..
|
||||
'list[current_name;dst;6,1.75;2,1;]'..
|
||||
'list[current_player;main;0,2.75;8,1;]'..
|
||||
'list[current_player;main;0,4;8,3;8]'..
|
||||
default.get_hotbar_bg(0,2.75)
|
||||
|
||||
function smoke_particles(pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 1, -- how many particles do you want
|
||||
time = 2, -- spawner stops after this time (use 0 for infinite)
|
||||
minpos = {x=pos.x, y=pos.y, z=pos.z}, -- minimum offset
|
||||
maxpos = {x=pos.x, y=pos.y, z=pos.z}, -- maximum offset
|
||||
minvel = {x=-.1, y=0, z=-.1}, -- minimum velocity
|
||||
maxvel = {x=.1, y=.4, z=.1}, -- maximum velocity
|
||||
minacc = {x=-.05, y=.02, z=-.05}, -- minimum acceleration
|
||||
maxacc = {x=.1, y=.1, z=.1}, -- maximim acceleration
|
||||
minexptime = 3, -- minimum expiration time
|
||||
maxexptime = 6, -- maximum expiration time
|
||||
minsize = 3, -- minimum size (0.5 = half size)
|
||||
maxsize = 8, -- maximum size (1=full resolution)
|
||||
collisiondetection = false, -- do particles stop when they hit solid node
|
||||
texture = 'more_fire_smoke.png', -- image to use (e.g. 'bubble.png' )
|
||||
vertical = false, -- upright/vertical image for rain
|
||||
-- playername = 'singleplayer', -- particles only appear for this player
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 1, -- how many particles do you want
|
||||
time = 2, -- spawner stops after this time (use 0 for infinite)
|
||||
minpos = {x=pos.x, y=pos.y, z=pos.z}, -- minimum offset
|
||||
maxpos = {x=pos.x, y=pos.y, z=pos.z}, -- maximum offset
|
||||
minvel = {x=-.1, y=0, z=-.1}, -- minimum velocity
|
||||
maxvel = {x=.1, y=.4, z=.1}, -- maximum velocity
|
||||
minacc = {x=-.05, y=.02, z=-.05}, -- minimum acceleration
|
||||
maxacc = {x=.1, y=.1, z=.1}, -- maximim acceleration
|
||||
minexptime = 3, -- minimum expiration time
|
||||
maxexptime = 6, -- maximum expiration time
|
||||
minsize = 3, -- minimum size (0.5 = half size)
|
||||
maxsize = 8, -- maximum size (1=full resolution)
|
||||
collisiondetection = false, -- do particles stop when they hit solid node
|
||||
texture = 'more_fire_smoke.png', -- image to use (e.g. 'bubble.png' )
|
||||
vertical = false, -- upright/vertical image for rain
|
||||
})
|
||||
end
|
||||
|
||||
function ember_particles(pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 1,
|
||||
time = 2,
|
||||
minpos = {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},
|
||||
maxvel = {x=.1, y=.6, z=.1},
|
||||
minacc = {x=-.05, y=.02, z=-.05},
|
||||
maxacc = {x=.1, y=.3, z=.1},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 1,
|
||||
maxsize = 2,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_embers.png',
|
||||
vertical = false,
|
||||
-- playername = 'singleplayer',
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 1,
|
||||
time = 2,
|
||||
minpos = {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},
|
||||
maxvel = {x=.1, y=.6, z=.1},
|
||||
minacc = {x=-.05, y=.02, z=-.05},
|
||||
maxacc = {x=.1, y=.3, z=.1},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 1,
|
||||
maxsize = 2,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_embers.png',
|
||||
vertical = false,
|
||||
})
|
||||
end
|
||||
|
||||
function lava_particles(pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 2,
|
||||
time = 1,
|
||||
minpos = {x=pos.x, y=pos.y-.5, z=pos.z},
|
||||
maxpos = {x=pos.x, y=pos.y, z=pos.z},
|
||||
minvel = {x=-.4, y=1, z=-.4},
|
||||
maxvel = {x=.4, y=1.5, z=.4},
|
||||
minacc = {x=-.4, y=1, z=-.4},
|
||||
maxacc = {x=.4, y=1.5, z=.4},
|
||||
minexptime = 1,
|
||||
maxexptime = 1.5,
|
||||
minsize = .6,
|
||||
maxsize = 2,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_lava_blob.png',
|
||||
vertical = false,
|
||||
-- playername = 'singleplayer',
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 2,
|
||||
time = 1,
|
||||
minpos = {x=pos.x, y=pos.y-.5, z=pos.z},
|
||||
maxpos = {x=pos.x, y=pos.y, z=pos.z},
|
||||
minvel = {x=-.4, y=1, z=-.4},
|
||||
maxvel = {x=.4, y=1.5, z=.4},
|
||||
minacc = {x=-.4, y=1, z=-.4},
|
||||
maxacc = {x=.4, y=1.5, z=.4},
|
||||
minexptime = 1,
|
||||
maxexptime = 1.5,
|
||||
minsize = .6,
|
||||
maxsize = 2,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_lava_blob.png',
|
||||
vertical = false,
|
||||
})
|
||||
end
|
||||
|
|
1
init.lua
1
init.lua
|
@ -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')..'/craftitems.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
|
||||
dofile(minetest.get_modpath('more_fire')..'/molotov.lua')
|
||||
dofile(minetest.get_modpath('more_fire')..'/smokebomb.lua')
|
||||
|
|
|
@ -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.
|
3
mod.conf
3
mod.conf
|
@ -1,5 +1,6 @@
|
|||
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.
|
||||
author = Nathan, Napiophelios
|
||||
optional_depends = ethereal
|
||||
|
|
|
@ -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.
|
@ -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.
674
molotov.lua
674
molotov.lua
|
@ -1,233 +1,233 @@
|
|||
--Molotov Cocktail_[rev002]
|
||||
--base code is from throwing enhanced and potions mods
|
||||
|
||||
local MOD_NAME = minetest.get_current_modname()
|
||||
local MOD_PATH = minetest.get_modpath(MOD_NAME)
|
||||
local Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua')
|
||||
local MOD_NAME = minetest.get_current_modname()
|
||||
local MOD_PATH = minetest.get_modpath(MOD_NAME)
|
||||
local Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua')
|
||||
|
||||
minetest.register_craftitem('more_fire:molotov_cocktail', {
|
||||
description = 'Molotov Cocktail',
|
||||
inventory_image = 'more_fire_molotov_cocktail.png',
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
itemstack:take_item()
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
n = minetest.get_node(pointed_thing)
|
||||
if pointed_thing.type == 'node' then
|
||||
minetest.add_node(pointed_thing.above, {name='more_fire:napalm'})
|
||||
minetest.sound_play('more_fire_ignite', {pos,pos})
|
||||
end
|
||||
--Shattered glass Particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 40,
|
||||
time = 0.1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=2, y=0.2, z=2},
|
||||
maxvel = {x=-2, y=0.5, z=-2},
|
||||
minacc = {x=0, y=-6, z=0},
|
||||
maxacc = {x=0, y=-10, z=0},
|
||||
minexptim = 0.5,
|
||||
maxexptime = 2,
|
||||
minsize = 0.2,
|
||||
maxsize = 5,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_shatter.png'})
|
||||
--fire ember particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
time = 0.1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=-2, y=0.5, z=-2},
|
||||
maxvel = {x=2, y=0.5, z=2},
|
||||
minacc = {x=0, y=-10, z=0},
|
||||
maxacc = {x=0, y=-6, z=0},
|
||||
minexptime = 2,
|
||||
maxexptime = 3,
|
||||
minsize = 0.25,
|
||||
maxsize = 0.5,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_spark.png'})
|
||||
local dir = Vec3(user:get_look_dir()) *20
|
||||
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,
|
||||
6, false, 'more_fire_molotov_cocktail.png')
|
||||
return itemstack
|
||||
end,
|
||||
description = 'Molotov Cocktail',
|
||||
inventory_image = 'more_fire_molotov_cocktail.png',
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
itemstack:take_item()
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
n = minetest.get_node(pointed_thing)
|
||||
if pointed_thing.type == 'node' then
|
||||
minetest.add_node(pointed_thing.above, {name='more_fire:napalm'})
|
||||
minetest.sound_play('more_fire_ignite', {pos,pos})
|
||||
end
|
||||
--Shattered glass Particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 40,
|
||||
time = 0.1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=2, y=0.2, z=2},
|
||||
maxvel = {x=-2, y=0.5, z=-2},
|
||||
minacc = {x=0, y=-6, z=0},
|
||||
maxacc = {x=0, y=-10, z=0},
|
||||
minexptim = 0.5,
|
||||
maxexptime = 2,
|
||||
minsize = 0.2,
|
||||
maxsize = 5,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_shatter.png'})
|
||||
--fire ember particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
time = 0.1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=-2, y=0.5, z=-2},
|
||||
maxvel = {x=2, y=0.5, z=2},
|
||||
minacc = {x=0, y=-10, z=0},
|
||||
maxacc = {x=0, y=-6, z=0},
|
||||
minexptime = 2,
|
||||
maxexptime = 3,
|
||||
minsize = 0.25,
|
||||
maxsize = 0.5,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_spark.png'})
|
||||
local dir = Vec3(user:get_look_dir()) *20
|
||||
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,
|
||||
6, false, 'more_fire_molotov_cocktail.png')
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
local function throw_cocktail(item, player)
|
||||
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 dir = player:get_look_dir()
|
||||
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})
|
||||
if not minetest.settings:get_bool('creative_mode') then
|
||||
item:take_item()
|
||||
end
|
||||
return item
|
||||
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 dir = player:get_look_dir()
|
||||
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})
|
||||
if not minetest.settings:get_bool('creative_mode') then
|
||||
item:take_item()
|
||||
end
|
||||
return item
|
||||
end
|
||||
|
||||
local radius = 5.0
|
||||
|
||||
local function add_effects(pos, radius)
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.2,
|
||||
minpos = vector.subtract(pos, radius / 2),
|
||||
maxpos = vector.add(pos, radius / 2),
|
||||
minvel = {x=-2, y=-2, z=-2},
|
||||
maxvel = {x=2, y=-4, z=2},
|
||||
minacc = {x=0, y=-4, z=0},
|
||||
--~ maxacc = {x=-20, y=-50, z=-50},
|
||||
minexptime = 1,
|
||||
maxexptime = 1.5,
|
||||
minsize = 1,
|
||||
maxsize = 2,
|
||||
texture = 'more_fire_spark.png',
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.2,
|
||||
minpos = vector.subtract(pos, radius / 2),
|
||||
maxpos = vector.add(pos, radius / 2),
|
||||
minvel = {x=-1.25, y=-1.25, z=-1.25},
|
||||
maxvel = {x=0.5, y=-4, z=0.5},
|
||||
minacc = {x=1.25, y=-1.25, z=1.25},
|
||||
--~ maxacc = {x=-20, y=-50, z=-50},
|
||||
minexptime =1,
|
||||
maxexptime = 1.5,
|
||||
minsize = 1,
|
||||
maxsize = 2,
|
||||
texture = 'more_fire_spark.png',
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.2,
|
||||
minpos = vector.subtract(pos, radius / 2),
|
||||
maxpos = vector.add(pos, radius / 2),
|
||||
minvel = {x=-2, y=-2, z=-2},
|
||||
maxvel = {x=2, y=-4, z=2},
|
||||
minacc = {x=0, y=-4, z=0},
|
||||
--~ maxacc = {x=-20, y=-50, z=-50},
|
||||
minexptime = 1,
|
||||
maxexptime = 1.5,
|
||||
minsize = 1,
|
||||
maxsize = 2,
|
||||
texture = 'more_fire_spark.png',
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.2,
|
||||
minpos = vector.subtract(pos, radius / 2),
|
||||
maxpos = vector.add(pos, radius / 2),
|
||||
minvel = {x=-1.25, y=-1.25, z=-1.25},
|
||||
maxvel = {x=0.5, y=-4, z=0.5},
|
||||
minacc = {x=1.25, y=-1.25, z=1.25},
|
||||
--~ maxacc = {x=-20, y=-50, z=-50},
|
||||
minexptime =1,
|
||||
maxexptime = 1.5,
|
||||
minsize = 1,
|
||||
maxsize = 2,
|
||||
texture = 'more_fire_spark.png',
|
||||
})
|
||||
end
|
||||
|
||||
local function napalm(pos)
|
||||
minetest.sound_play('more_fire_ignite', {pos=pos, gain=1})
|
||||
minetest.set_node(pos, {name='more_fire:napalm'})
|
||||
minetest.get_node_timer(pos):start(5.0)
|
||||
add_effects(pos, radius)
|
||||
minetest.sound_play('more_fire_ignite', {pos=pos, gain=1})
|
||||
minetest.set_node(pos, {name='more_fire:napalm'})
|
||||
minetest.get_node_timer(pos):start(5.0)
|
||||
add_effects(pos, radius)
|
||||
end
|
||||
|
||||
local MORE_FIRE_MOLOTOV_ENTITY = {
|
||||
timer=0,
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
physical = false,
|
||||
textures = {'more_fire_molotov_cocktail.png'},
|
||||
lastpos={},
|
||||
timer=0,
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
physical = false,
|
||||
textures = {'more_fire_molotov_cocktail.png'},
|
||||
lastpos={},
|
||||
}
|
||||
|
||||
MORE_FIRE_MOLOTOV_ENTITY.on_step = function(self, dtime)
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.5,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-0, y=0, z=-0.5},
|
||||
maxvel = {x=0, y=0, z=-0.75},
|
||||
minacc = vector.new(),
|
||||
maxacc = vector.new(),
|
||||
minexptime = 0.5,
|
||||
maxexptime = 1,
|
||||
minsize = 0.25,
|
||||
maxsize = 0.5,
|
||||
texture = 'more_fire_smoke.png',
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
time = 0.25,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-0, y=0, z=-0.5},
|
||||
maxvel = {x=0, y=0, z=-0.75},
|
||||
minacc = {x=0, y=0, z=-0.75},
|
||||
maxacc = {x=-0, y=0, z=-0.5},
|
||||
minexptime = 0.25,
|
||||
maxexptime = 0.5,
|
||||
minsize = 0.5,
|
||||
maxsize = 0.75,
|
||||
texture = 'more_fire_spark.png',
|
||||
})
|
||||
if self.timer>0.2 then
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= 'more_fire:molotov_entity' and obj:get_luaentity().name ~= '__builtin:item' then
|
||||
if self.node ~= '' then
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
for dx=-3,3 do
|
||||
for dy=-3,3 do
|
||||
for dz=-3,3 do
|
||||
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.get_node(pos).name
|
||||
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='more_fire:napalm'})
|
||||
else
|
||||
--minetest.remove_node(p)
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='fire:basic_flame'})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
else
|
||||
if self.node ~= '' then
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
for dx=-2,2 do
|
||||
for dy=-2,2 do
|
||||
for dz=-2,2 do
|
||||
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.get_node(pos).name
|
||||
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='more_fire:napalm'})
|
||||
else
|
||||
--minetest.remove_node(p)
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='fire:basic_flame'})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.5,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-0, y=0, z=-0.5},
|
||||
maxvel = {x=0, y=0, z=-0.75},
|
||||
minacc = vector.new(),
|
||||
maxacc = vector.new(),
|
||||
minexptime = 0.5,
|
||||
maxexptime = 1,
|
||||
minsize = 0.25,
|
||||
maxsize = 0.5,
|
||||
texture = 'more_fire_smoke.png',
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
time = 0.25,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-0, y=0, z=-0.5},
|
||||
maxvel = {x=0, y=0, z=-0.75},
|
||||
minacc = {x=0, y=0, z=-0.75},
|
||||
maxacc = {x=-0, y=0, z=-0.5},
|
||||
minexptime = 0.25,
|
||||
maxexptime = 0.5,
|
||||
minsize = 0.5,
|
||||
maxsize = 0.75,
|
||||
texture = 'more_fire_spark.png',
|
||||
})
|
||||
if self.timer>0.2 then
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= 'more_fire:molotov_entity' and obj:get_luaentity().name ~= '__builtin:item' then
|
||||
if self.node ~= '' then
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
for dx=-3,3 do
|
||||
for dy=-3,3 do
|
||||
for dz=-3,3 do
|
||||
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.get_node(pos).name
|
||||
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='more_fire:napalm'})
|
||||
else
|
||||
--minetest.remove_node(p)
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='fire:basic_flame'})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
else
|
||||
if self.node ~= '' then
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
for dx=-2,2 do
|
||||
for dy=-2,2 do
|
||||
for dz=-2,2 do
|
||||
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.get_node(pos).name
|
||||
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='more_fire:napalm'})
|
||||
else
|
||||
--minetest.remove_node(p)
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='fire:basic_flame'})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= 'air' then
|
||||
if self.node ~= '' then
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
for dx=-1,1 do
|
||||
for dy=-1,1 do
|
||||
for dz=-1,1 do
|
||||
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.get_node(pos).name
|
||||
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='more_fire:naplam'})
|
||||
else
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='fire:basic_flame'})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
napalm(self.lastpos)
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= 'air' then
|
||||
if self.node ~= '' then
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
for dx=-1,1 do
|
||||
for dy=-1,1 do
|
||||
for dz=-1,1 do
|
||||
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.get_node(pos).name
|
||||
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='more_fire:napalm'})
|
||||
else
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.set_node(p, {name='fire:basic_flame'})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
napalm(self.lastpos)
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
|
||||
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.register_node('more_fire:napalm', {
|
||||
drawtype = 'firelike',
|
||||
tiles = {{
|
||||
name='fire_basic_flame_animated.png',
|
||||
animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1},
|
||||
}},
|
||||
inventory_image = 'fire_basic_flame.png',
|
||||
light_source = 14,
|
||||
groups = {igniter=1,dig_immediate=3, not_in_creative_inventory =1, not_in_craft_guide=1},
|
||||
drop = '',
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
damage_per_second = 4,
|
||||
drawtype = 'firelike',
|
||||
tiles = {{
|
||||
name='fire_basic_flame_animated.png',
|
||||
animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1},
|
||||
}},
|
||||
inventory_image = 'fire_basic_flame.png',
|
||||
light_source = 14,
|
||||
groups = {igniter=1,dig_immediate=3, not_in_creative_inventory =1, not_in_craft_guide=1},
|
||||
drop = '',
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
damage_per_second = 4,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames={'more_fire:napalm'},
|
||||
neighbors={'air'},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos,node,active_object_count,active_object_count_wider)
|
||||
minetest.add_particlespawner({
|
||||
amount = 200,
|
||||
time = 3,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=2, y=-0.2, z=2},
|
||||
maxvel = {x=-2, y=-0.5, z=-2},
|
||||
minacc = {x=0, y=-6, z=0},
|
||||
maxacc = {x=0, y=-10, z=0},
|
||||
minexptime = 2,
|
||||
maxexptime = 6,
|
||||
minsize = 0.05,
|
||||
maxsize = 0.5,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_spark.png'})
|
||||
minetest.add_particlespawner({
|
||||
amount = 20,
|
||||
time = 2,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-2, y=2, z=-2},
|
||||
maxvel = {x=1, y=3, z=1},
|
||||
minacc = {x=0, y=6, z=0},
|
||||
maxacc = {x=0, y=2, z=0},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 3,
|
||||
maxsize = 5,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 4,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=0, y= 3, z=0},
|
||||
maxvel = {x=0, y=5, z=0},
|
||||
minacc = {x=0.1, y=0.5, z=-0.1},
|
||||
maxacc = {x=-0.2, y=2, z=0.2},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 1,
|
||||
maxsize = 3,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
local r = 0-- Radius for destroying
|
||||
for x = pos.x-r, pos.x+r, 1 do
|
||||
for y = pos.y-r, pos.y+r, 1 do
|
||||
for z = pos.z-r, pos.z+r, 1 do
|
||||
local cpos = {x=x,y=y,z=z}
|
||||
if minetest.get_node(cpos).name == 'more_fire:napalm' then
|
||||
minetest.set_node(cpos,{name='fire:basic_flame'})
|
||||
end
|
||||
if math.random(0,1) == 1
|
||||
or minetest.get_node(cpos).name == 'more_fire:napalm'
|
||||
then
|
||||
minetest.remove_node(cpos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
nodenames={'more_fire:napalm'},
|
||||
neighbors={'air'},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos,node,active_object_count,active_object_count_wider)
|
||||
minetest.add_particlespawner({
|
||||
amount = 200,
|
||||
time = 3,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=2, y=-0.2, z=2},
|
||||
maxvel = {x=-2, y=-0.5, z=-2},
|
||||
minacc = {x=0, y=-6, z=0},
|
||||
maxacc = {x=0, y=-10, z=0},
|
||||
minexptime = 2,
|
||||
maxexptime = 6,
|
||||
minsize = 0.05,
|
||||
maxsize = 0.5,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_spark.png'})
|
||||
minetest.add_particlespawner({
|
||||
amount = 20,
|
||||
time = 2,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-2, y=2, z=-2},
|
||||
maxvel = {x=1, y=3, z=1},
|
||||
minacc = {x=0, y=6, z=0},
|
||||
maxacc = {x=0, y=2, z=0},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 3,
|
||||
maxsize = 5,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 4,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=0, y= 3, z=0},
|
||||
maxvel = {x=0, y=5, z=0},
|
||||
minacc = {x=0.1, y=0.5, z=-0.1},
|
||||
maxacc = {x=-0.2, y=2, z=0.2},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 1,
|
||||
maxsize = 3,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
local r = 0-- Radius for destroying
|
||||
for x = pos.x-r, pos.x+r, 1 do
|
||||
for y = pos.y-r, pos.y+r, 1 do
|
||||
for z = pos.z-r, pos.z+r, 1 do
|
||||
local cpos = {x=x,y=y,z=z}
|
||||
if minetest.get_node(cpos).name == 'more_fire:napalm' then
|
||||
minetest.set_node(cpos,{name='fire:basic_flame'})
|
||||
end
|
||||
if math.random(0,1) == 1
|
||||
or minetest.get_node(cpos).name == 'more_fire:napalm'
|
||||
then
|
||||
minetest.remove_node(cpos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames={'fire:basic_flame'},
|
||||
neighbors={'air'},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
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+2.0, z=pos.z}).name == 'air'
|
||||
then
|
||||
minetest.add_particlespawner({
|
||||
amount = 30,
|
||||
time = 2,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-2, y=2, z=-2},
|
||||
maxvel = {x=1, y=3, z=1},
|
||||
minacc = {x=0, y=6, z=0},
|
||||
maxacc = {x=0, y=2, z=0},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 10,
|
||||
maxsize = 20,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
minetest.add_particlespawner({
|
||||
amount = 15,
|
||||
time = 4,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=0, y= 3, z=0},
|
||||
maxvel = {x=0, y=5, z=0},
|
||||
minacc = {x=0.1, y=0.5, z=-0.1},
|
||||
maxacc = {x=-0.2, y=2, z=0.2},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 5,
|
||||
maxsize = 10,
|
||||
collisiondetection = false,
|
||||
texture ='more_fire_smoke.png'})
|
||||
end
|
||||
end
|
||||
nodenames={'fire:basic_flame'},
|
||||
neighbors={'air'},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
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+2.0, z=pos.z}).name == 'air' then
|
||||
minetest.add_particlespawner({
|
||||
amount = 30,
|
||||
time = 2,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-2, y=2, z=-2},
|
||||
maxvel = {x=1, y=3, z=1},
|
||||
minacc = {x=0, y=6, z=0},
|
||||
maxacc = {x=0, y=2, z=0},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 10,
|
||||
maxsize = 20,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
minetest.add_particlespawner({
|
||||
amount = 15,
|
||||
time = 4,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=0, y= 3, z=0},
|
||||
maxvel = {x=0, y=5, z=0},
|
||||
minacc = {x=0.1, y=0.5, z=-0.1},
|
||||
maxacc = {x=-0.2, y=2, z=0.2},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 5,
|
||||
maxsize = 10,
|
||||
collisiondetection = false,
|
||||
texture ='more_fire_smoke.png'})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
--crafting recipes
|
||||
minetest.register_craft( {
|
||||
output = 'more_fire:molotov_cocktail',
|
||||
recipe = {
|
||||
{'farming:cotton'},
|
||||
{'more_fire:oil'},
|
||||
{'vessels:glass_bottle'},
|
||||
}
|
||||
--crafting recipes
|
||||
minetest.register_craft( {
|
||||
output = 'more_fire:molotov_cocktail',
|
||||
recipe = {
|
||||
{'farming:cotton'},
|
||||
{'more_fire:oil'},
|
||||
{'vessels:glass_bottle'},
|
||||
}
|
||||
})
|
||||
|
||||
-- fuel recipes
|
||||
minetest.register_craft({
|
||||
type = 'fuel',
|
||||
recipe = 'more_fire:molotov_cocktail',
|
||||
burntime = 5,
|
||||
type = 'fuel',
|
||||
recipe = 'more_fire:molotov_cocktail',
|
||||
burntime = 5,
|
||||
})
|
||||
|
|
|
@ -223,8 +223,7 @@ minetest.register_node('more_fire:campfire', {
|
|||
description = 'Burning Campfire',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'more_fire_campfire.obj',
|
||||
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'}},
|
||||
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'}},
|
||||
inventory_image = 'more_fire_campfire.png',
|
||||
wield_image = 'more_fire_campfire.png',
|
||||
paramtype = 'light',
|
||||
|
@ -385,6 +384,7 @@ minetest.register_node('more_fire:oil_lamp_on', {
|
|||
drawtype = 'mesh',
|
||||
mesh = 'more_fire_lamp_wall.obj',
|
||||
tiles = {'more_fire_lamp.png'},
|
||||
use_alpha_texture = true,
|
||||
groups = {choppy=2, dig_immediate=2, not_in_creative_inventory=1},
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
|
|
511
smokebomb.lua
511
smokebomb.lua
|
@ -6,199 +6,197 @@
|
|||
local Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua')
|
||||
|
||||
minetest.register_craftitem('more_fire:smokebomb', {
|
||||
description = 'Smoke Bomb',
|
||||
inventory_image = 'more_fire_smokebomb.png',
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
itemstack:take_item()
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
--Shattered glass Particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 40,
|
||||
time = 0.1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=2, y=0.2, z=2},
|
||||
maxvel = {x=-2, y=0.5, z=-2},
|
||||
minacc = {x=0, y=-6, z=0},
|
||||
maxacc = {x=0, y=-10, z=0},
|
||||
minexptime = 0.5,
|
||||
maxexptime = 2,
|
||||
minsize = 0.2,
|
||||
maxsize = 5,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_shatter.png'})
|
||||
--smoke particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 400,
|
||||
time = 0.1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=2, y=0.2, z=2},
|
||||
maxvel = {x=-2, y=0.5, z=-2},
|
||||
minacc = {x=0, y=-6, z=0},
|
||||
maxacc = {x=0, y=-10, z=0},
|
||||
minexptime = 5,
|
||||
maxexptime = 2,
|
||||
minsize = 5,
|
||||
maxsize = 20,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
--more smoke particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 600,
|
||||
time = 1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=10, y= 3, z=10},
|
||||
maxvel = {x=-10, y= 3, z=-10},
|
||||
minacc = {x=2, y=2, z=2},
|
||||
maxacc = {x=-2, y=1, z=-2},
|
||||
minexptime = 2,
|
||||
maxexptime = 3,
|
||||
minsize = 2,
|
||||
maxsize = 20,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
--even more smoke particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 400,
|
||||
time = 1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=0.2, y=0.2, z=0.2},
|
||||
maxvel = {x=-0.2, y=0.5, z=-0.2},
|
||||
minacc = {x=10, y= 2, z=10},
|
||||
maxacc = {x=-10, y= 1, z=-10},
|
||||
minexptime = 2,
|
||||
maxexptime = 3,
|
||||
minsize = 20,
|
||||
maxsize = 2,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
local dir = Vec3(user:get_look_dir()) *20
|
||||
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,
|
||||
6, false, 'more_fire_smokebomb.png')
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
description = 'Smoke Bomb',
|
||||
inventory_image = 'more_fire_smokebomb.png',
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
itemstack:take_item()
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
--Shattered glass Particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 40,
|
||||
time = 0.1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=2, y=0.2, z=2},
|
||||
maxvel = {x=-2, y=0.5, z=-2},
|
||||
minacc = {x=0, y=-6, z=0},
|
||||
maxacc = {x=0, y=-10, z=0},
|
||||
minexptime = 0.5,
|
||||
maxexptime = 2,
|
||||
minsize = 0.2,
|
||||
maxsize = 5,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_shatter.png'})
|
||||
--smoke particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 400,
|
||||
time = 0.1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=2, y=0.2, z=2},
|
||||
maxvel = {x=-2, y=0.5, z=-2},
|
||||
minacc = {x=0, y=-6, z=0},
|
||||
maxacc = {x=0, y=-10, z=0},
|
||||
minexptime = 5,
|
||||
maxexptime = 2,
|
||||
minsize = 5,
|
||||
maxsize = 20,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
--more smoke particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 600,
|
||||
time = 1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=10, y= 3, z=10},
|
||||
maxvel = {x=-10, y= 3, z=-10},
|
||||
minacc = {x=2, y=2, z=2},
|
||||
maxacc = {x=-2, y=1, z=-2},
|
||||
minexptime = 2,
|
||||
maxexptime = 3,
|
||||
minsize = 2,
|
||||
maxsize = 20,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
--even more smoke particles
|
||||
minetest.add_particlespawner({
|
||||
amount = 400,
|
||||
time = 1,
|
||||
minpos = pointed_thing.above,
|
||||
maxpos = pointed_thing.above,
|
||||
minvel = {x=0.2, y=0.2, z=0.2},
|
||||
maxvel = {x=-0.2, y=0.5, z=-0.2},
|
||||
minacc = {x=10, y= 2, z=10},
|
||||
maxacc = {x=-10, y= 1, z=-10},
|
||||
minexptime = 2,
|
||||
maxexptime = 3,
|
||||
minsize = 20,
|
||||
maxsize = 2,
|
||||
collisiondetection = true,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
local dir = Vec3(user:get_look_dir()) *20
|
||||
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,
|
||||
6, false, 'more_fire_smokebomb.png')
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
local function throw_smokebomb(item, player)
|
||||
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 dir = player:get_look_dir()
|
||||
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})
|
||||
if not minetest.settings:get_bool('creative_mode') then
|
||||
item:take_item()
|
||||
end
|
||||
return item
|
||||
local function throw_smokebomb(item, player)
|
||||
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 dir = player:get_look_dir()
|
||||
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})
|
||||
if not minetest.settings:get_bool('creative_mode') then
|
||||
item:take_item()
|
||||
end
|
||||
return item
|
||||
end
|
||||
|
||||
local radius = 5
|
||||
|
||||
local function add_effects(pos, radius)
|
||||
minetest.add_particlespawner({
|
||||
amount = 200,
|
||||
time = 0.1,
|
||||
minpos = vector.subtract(pos, radius / 3),
|
||||
maxpos = vector.add(pos, radius / 3),
|
||||
minvel = {x=2, y=0.2, z=2},
|
||||
maxvel = {x=-2, y=-0.5, z=-2},
|
||||
minacc = {x=1, y=-6, z=1},
|
||||
maxacc = {x=1, y=-10, z=1},
|
||||
minexptime = 1,
|
||||
maxexptime = 5,
|
||||
minsize = 10,
|
||||
maxsize = 20,
|
||||
texture = 'more_fire_smoke.png',})
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
time = 2,
|
||||
minpos = vector.subtract(pos, radius / 2),
|
||||
maxpos = vector.add(pos, radius / 2),
|
||||
minvel = {x=0.2, y=0.2, z=0.2},
|
||||
maxvel = {x=-0.2, y=0.5, z=-0.2},
|
||||
minacc = {x=10, y= 2, z=10},
|
||||
maxacc = {x=-10, y= 1, z=-10},
|
||||
minexptime =1,
|
||||
maxexptime = 3,
|
||||
minsize = 5,
|
||||
maxsize = 15,
|
||||
texture = 'more_fire_smoke.png',})
|
||||
local function add_effects(pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 200,
|
||||
time = 0.1,
|
||||
minpos = vector.subtract(pos, 5 / 3),
|
||||
maxpos = vector.add(pos, 5 / 3),
|
||||
minvel = {x=2, y=0.2, z=2},
|
||||
maxvel = {x=-2, y=-0.5, z=-2},
|
||||
minacc = {x=1, y=-6, z=1},
|
||||
maxacc = {x=1, y=-10, z=1},
|
||||
minexptime = 1,
|
||||
maxexptime = 5,
|
||||
minsize = 10,
|
||||
maxsize = 20,
|
||||
texture = 'more_fire_smoke.png',})
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
time = 2,
|
||||
minpos = vector.subtract(pos, 5 / 2),
|
||||
maxpos = vector.add(pos, 5 / 2),
|
||||
minvel = {x=0.2, y=0.2, z=0.2},
|
||||
maxvel = {x=-0.2, y=0.5, z=-0.2},
|
||||
minacc = {x=10, y= 2, z=10},
|
||||
maxacc = {x=-10, y= 1, z=-10},
|
||||
minexptime =1,
|
||||
maxexptime = 3,
|
||||
minsize = 5,
|
||||
maxsize = 15,
|
||||
texture = 'more_fire_smoke.png',})
|
||||
end
|
||||
|
||||
local function plume(pos)
|
||||
minetest.set_node(pos, {name='more_fire:plume'})
|
||||
minetest.get_node_timer(pos):start(3.0)
|
||||
add_effects(pos, radius)
|
||||
minetest.set_node(pos, {name='more_fire:plume'})
|
||||
minetest.get_node_timer(pos):start(3.0)
|
||||
add_effects(pos)
|
||||
end
|
||||
|
||||
local MORE_FIRE_SMOKEBOMB_ENTITY = {
|
||||
timer=0,
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
physical = false,
|
||||
textures = {'more_fire_smokebomb.png'},
|
||||
lastpos={},
|
||||
timer=0,
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
physical = false,
|
||||
textures = {'more_fire_smokebomb.png'},
|
||||
lastpos={},
|
||||
}
|
||||
|
||||
MORE_FIRE_SMOKEBOMB_ENTITY.on_step = function(self, dtime)
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.5,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-0, y=0, z=-0.5},
|
||||
maxvel = {x=0, y=0, z=-0.75},
|
||||
minacc = vector.new(),
|
||||
maxacc = vector.new(),
|
||||
minexptime = 0.5,
|
||||
maxexptime = 1,
|
||||
minsize = 0.25,
|
||||
maxsize = 0.5,
|
||||
texture = 'more_fire_smoke.png',})
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.25,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-0, y=0, z=-0.5},
|
||||
maxvel = {x=0, y=0, z=-0.75},
|
||||
minacc = {x=0, y=0, z=-0.75},
|
||||
maxacc = {x=-0, y=0, z=-0.5},
|
||||
minexptime = 0.25,
|
||||
maxexptime = 0.5,
|
||||
minsize = 0.5,
|
||||
maxsize = 0.75,
|
||||
texture = 'more_fire_smoke.png',})
|
||||
if self.timer>0.2 then
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= 'more_fire:smokebomb_entity' and obj:get_luaentity().name ~= '__builtin:item' then
|
||||
if self.node ~= '' then
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
local damage = 1
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= 'air' then
|
||||
self.object:remove()
|
||||
plume(self.lastpos)
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
self.timer = self.timer + dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.5,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-0, y=0, z=-0.5},
|
||||
maxvel = {x=0, y=0, z=-0.75},
|
||||
minacc = vector.new(),
|
||||
maxacc = vector.new(),
|
||||
minexptime = 0.5,
|
||||
maxexptime = 1,
|
||||
minsize = 0.25,
|
||||
maxsize = 0.5,
|
||||
texture = 'more_fire_smoke.png',})
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.25,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-0, y=0, z=-0.5},
|
||||
maxvel = {x=0, y=0, z=-0.75},
|
||||
minacc = {x=0, y=0, z=-0.75},
|
||||
maxacc = {x=-0, y=0, z=-0.5},
|
||||
minexptime = 0.25,
|
||||
maxexptime = 0.5,
|
||||
minsize = 0.5,
|
||||
maxsize = 0.75,
|
||||
texture = 'more_fire_smoke.png',})
|
||||
if self.timer>0.2 then
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= 'more_fire:smokebomb_entity' and obj:get_luaentity().name ~= '__builtin:item' then
|
||||
if self.node ~= '' then
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
local damage = 1
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= 'air' then
|
||||
self.object:remove()
|
||||
plume(self.lastpos)
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
end
|
||||
|
||||
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', {
|
||||
drawtype = 'plantlike',
|
||||
description = 'Smoke Plume',
|
||||
tiles = {{
|
||||
name='more_fire_smoke_animated.png',
|
||||
animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1},
|
||||
}},
|
||||
inventory_image = 'more_fire_smoke.png',
|
||||
light_source = 8,
|
||||
groups = {dig_immediate=3, not_in_creative_inventory =1, not_in_craft_guide=1},
|
||||
drop = '',
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
on_timer = function(pos, elapsed)
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
damage_per_second = 1,
|
||||
tiles = {{
|
||||
name='more_fire_smoke_animated.png',
|
||||
animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1},
|
||||
}},
|
||||
inventory_image = 'more_fire_smoke.png',
|
||||
light_source = 8,
|
||||
groups = {dig_immediate=3, not_in_creative_inventory =1, not_in_craft_guide=1},
|
||||
drop = '',
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
damage_per_second = 1,
|
||||
on_timer = function(pos, elapsed)
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames={'more_fire:plume'},
|
||||
neighbors={'air'},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
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+2.0, z=pos.z}).name == 'air'
|
||||
then
|
||||
minetest.add_particlespawner({
|
||||
amount = 400,
|
||||
time = 3,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=2, y=-0.2, z=2},
|
||||
maxvel = {x=-2, y=-0.5, z=-2},
|
||||
minacc = {x=0, y=-6, z=0},
|
||||
maxacc = {x=0, y=-10, z=0},
|
||||
minexptime = 2,
|
||||
maxexptime = 6,
|
||||
minsize = 0.05,
|
||||
maxsize = 0.5,
|
||||
collisiondetection =false,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
minetest.add_particlespawner({
|
||||
amount = 50,
|
||||
time = 2,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-2, y=0.5, z=-2},
|
||||
maxvel = {x=2, y=0.5, z=2},
|
||||
minacc = {x=0, y=0.04, z=0},
|
||||
maxacc = {x=0, y=0.01, z=0},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 3,
|
||||
maxsize = 5,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
minetest.add_particlespawner({
|
||||
amount = 400,
|
||||
time = 2,
|
||||
minpos = vector.subtract(pos, radius / 2),
|
||||
maxpos = vector.add(pos, radius / 2),
|
||||
minvel = {x=0.2, y=2, z=0.2},
|
||||
maxvel = {x=-0.2, y=2, z=-0.2},
|
||||
minacc = {x=10, y= 2, z=10},
|
||||
maxacc = {x=-10, y= 1, z=-10},
|
||||
minexptime =1,
|
||||
maxexptime = 3,
|
||||
minsize = 5,
|
||||
maxsize = 15,
|
||||
texture = 'more_fire_smoke.png',})
|
||||
end
|
||||
end
|
||||
nodenames={'more_fire:plume'},
|
||||
neighbors={'air'},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
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+2.0, z=pos.z}).name == 'air' then
|
||||
minetest.add_particlespawner({
|
||||
amount = 400,
|
||||
time = 3,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=2, y=-0.2, z=2},
|
||||
maxvel = {x=-2, y=-0.5, z=-2},
|
||||
minacc = {x=0, y=-6, z=0},
|
||||
maxacc = {x=0, y=-10, z=0},
|
||||
minexptime = 2,
|
||||
maxexptime = 6,
|
||||
minsize = 0.05,
|
||||
maxsize = 0.5,
|
||||
collisiondetection =false,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
minetest.add_particlespawner({
|
||||
amount = 50,
|
||||
time = 2,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-2, y=0.5, z=-2},
|
||||
maxvel = {x=2, y=0.5, z=2},
|
||||
minacc = {x=0, y=0.04, z=0},
|
||||
maxacc = {x=0, y=0.01, z=0},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 3,
|
||||
maxsize = 5,
|
||||
collisiondetection = false,
|
||||
texture = 'more_fire_smoke.png'})
|
||||
minetest.add_particlespawner({
|
||||
amount = 400,
|
||||
time = 2,
|
||||
minpos = vector.subtract(pos, 5 / 2),
|
||||
maxpos = vector.add(pos, 5 / 2),
|
||||
minvel = {x=0.2, y=2, z=0.2},
|
||||
maxvel = {x=-0.2, y=2, z=-0.2},
|
||||
minacc = {x=10, y= 2, z=10},
|
||||
maxacc = {x=-10, y= 1, z=-10},
|
||||
minexptime =1,
|
||||
maxexptime = 3,
|
||||
minsize = 5,
|
||||
maxsize = 15,
|
||||
texture = 'more_fire_smoke.png',})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
--crafting recipes
|
||||
minetest.register_craft( {
|
||||
output = 'more_fire:smoke_bomb',
|
||||
recipe = {
|
||||
{'more_fire:flintstone'},
|
||||
{'more_fire:charcoal'},
|
||||
{'vessels:glass_bottle'},
|
||||
}
|
||||
minetest.register_craft({
|
||||
output = 'more_fire:smoke_bomb',
|
||||
recipe = {
|
||||
{'more_fire:flintstone'},
|
||||
{'more_fire:charcoal'},
|
||||
{'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 |
13
tools.lua
13
tools.lua
|
@ -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,
|
||||
})
|
Loading…
Reference in New Issue