fixed up depreciated functions.

master
NathanSalapat 2015-05-30 20:49:05 -05:00
parent b56f40535a
commit 6449a9a9cf
15 changed files with 328 additions and 247 deletions

View File

@ -127,8 +127,8 @@ minetest.register_abm({ --smoke for embers
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" 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 and minetest.get_node({x=pos.x, y=pos.y+2.0, z=pos.z}).name == 'air' then
smoke_particles(pos) smoke_particles(pos)
end end
end end
@ -139,8 +139,8 @@ minetest.register_abm({ --embers for fire
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" 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 and minetest.get_node({x=pos.x, y=pos.y+2.0, z=pos.z}).name == 'air' then
ember_particles(pos) ember_particles(pos)
end end
end end

View File

@ -1,3 +1,6 @@
5-30-15:
Napiophelios put together some nice smoke bombs and molotov cocktails for this mod, I(Nathan) did a few tweaks, changed some alignment and took care of some depreciated functions to stop debug spamming.
5-12-15: 5-12-15:
Lanterns are here, both wall mounted a table top. Craft with a piece of glass above a string above a lump of iron. Yields one lantern, craft the lantern to change between wall mounted and table top. Lanterns are here, both wall mounted a table top. Craft with a piece of glass above a string above a lump of iron. Yields one lantern, craft the lantern to change between wall mounted and table top.
Lanterns burn oil, twelve minutes of light for one bottle of oil. Put six leaves above a glass vessel to create lantern oil. Lanterns burn oil, twelve minutes of light for one bottle of oil. Put six leaves above a glass vessel to create lantern oil.

View File

@ -3,3 +3,7 @@
--(true/false) --(true/false)
--when true torches will burn out after a day. --when true torches will burn out after a day.
finite_torches = true finite_torches = true
--Do you want smoke bombs and molotov cocktails, these can be dangerous in the hands of griefers.
--(true/false)
pyromania = true

View File

@ -57,9 +57,9 @@ function smoke_particles(pos)
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 -- playername = 'singleplayer', -- particles only appear for this player
}) })
end end
@ -80,6 +80,6 @@ function ember_particles(pos)
collisiondetection = false, collisiondetection = false,
texture = 'more_fire_embers.png', texture = 'more_fire_embers.png',
vertical = false, vertical = false,
-- playername = "singleplayer", -- playername = 'singleplayer',
}) })
end end

View File

@ -7,39 +7,6 @@ default.gui_slots = 'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'
more_fire = {} more_fire = {}
--[[local function start_embers(pos)
local this_spawner_meta = minetest.get_meta(pos)
id = minetest.add_particlespawner({
amount = 1, time = 0,
minpos = { x = pos.x - 0.4, y = pos.y - 0.4, z = pos.z - 0.4 },
maxpos = { x = pos.x + 0.4, y = pos.y - 0.4, z = pos.z + 0.4 },
minvel = { x = 0, y = 0, z = 0 },
maxvel = { x = 0, y = .3, z = 0 },
minacc = { x = 0, y = .1, z = 0 },
maxacc = { x = 0, y = .25, z = 0 },
minexptime = 3, maxexptime = 5,
size = 8,
collisiondetection = false,
vertical = false,
texture = 'more_fire_embers.png',
})
this_spawner_meta:set_int(id)
end
smoke_particles = {
amount = 1, time = 0,
minpos = { x = pos.x - 0.4, y = pos.y - 0.4, z = pos.z - 0.4 },
maxpos = { x = pos.x + 0.4, y = pos.y - 0.4, z = pos.z + 0.4 },
minvel = { x = 0, y = 0, z = 0 },
maxvel = { x = 0, y = .2, z = 0 },
minacc = { x = 0, y = .05, z = 0 },
maxacc = { x = 0, y = .1, z = 0 },
minexptime = 3, maxexptime = 5,
size = 2,
collisiondetection = false,
vertical = false,
texture = 'more_fire_smoke.png',}--]]
-- formspecs -- formspecs
more_fire.embers_formspec = more_fire.embers_formspec =
'size[8,6.75]'.. 'size[8,6.75]'..
@ -60,5 +27,7 @@ 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') dofile(minetest.get_modpath('more_fire')..'/tools.lua')
dofile(minetest.get_modpath('more_fire')..'/molotov.lua') if pyromania then
dofile(minetest.get_modpath('more_fire')..'/smokebomb.lua') dofile(minetest.get_modpath('more_fire')..'/molotov.lua')
dofile(minetest.get_modpath('more_fire')..'/smokebomb.lua')
end

View File

@ -3,52 +3,68 @@
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')
more_fire = {} more_fire = {}
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.env:get_node(pointed_thing) n = minetest.env:get_node(pointed_thing)
if pointed_thing.type == "node" then if pointed_thing.type == 'node' then
minetest.env:add_node(pointed_thing.above, {name="more_fire:napalm"}) minetest.env: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(40, 0.1, minetest.add_particlespawner({
pointed_thing.above, pointed_thing.above, amount = 40,
{x=2, y=0.2, z=2}, {x=-2, y=0.5, z=-2}, time = 0.1,
{x=0, y=-6, z=0}, {x=0, y=-10, z=0}, minpos = pointed_thing.above,
0.5, 2, maxpos = pointed_thing.above,
0.2, 5, minvel = {x=2, y=0.2, z=2},
true, "more_fire_shatter.png") 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 --fire ember particles
minetest.add_particlespawner(100, 0.1, minetest.add_particlespawner({
pointed_thing.above, pointed_thing.above, amount = 100,
{x=-2, y=0.5, z=-2}, {x=2, y=0.5, z=2}, time = 0.1,
{x=0, y=-10, z=0}, {x=0, y=-6, z=0}, minpos = pointed_thing.above,
2, 3, maxpos = pointed_thing.above,
0.25, 0.5, minvel = {x=-2, y=0.5, z=-2},
true, "more_fire_spark.png") 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 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.setting_getbool("creative_mode") then if not minetest.setting_getbool('creative_mode') then
item:take_item() item:take_item()
end end
return item return item
@ -70,7 +86,7 @@ local function add_effects(pos, radius)
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,
@ -85,13 +101,13 @@ local function add_effects(pos, radius)
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
@ -100,7 +116,7 @@ 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={},
} }
@ -121,7 +137,7 @@ minetest.add_particlespawner({
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,
@ -136,27 +152,27 @@ minetest.add_particlespawner({
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.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) local objs = minetest.env: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.env:get_node(pos).name local n = minetest.env: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.env:set_node(p, {name="more_fire:napalm"}) minetest.env:set_node(p, {name='more_fire:napalm'})
else else
--minetest.env:remove_node(p) --minetest.env:remove_node(p)
minetest.sound_play("more_fire_ignite", {pos = self.lastpos}) minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.env:set_node(p, {name="fire:basic_flame"}) minetest.env:set_node(p, {name='fire:basic_flame'})
end end
end end
end end
@ -165,20 +181,20 @@ minetest.add_particlespawner({
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.env:get_node(pos).name local n = minetest.env: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.env:set_node(p, {name="more_fire:napalm"}) minetest.env:set_node(p, {name='more_fire:napalm'})
else else
--minetest.env:remove_node(p) --minetest.env:remove_node(p)
minetest.sound_play("more_fire_ignite", {pos = self.lastpos}) minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.env:set_node(p, {name="fire:basic_flame"}) minetest.env:set_node(p, {name='fire:basic_flame'})
end end
end end
end end
@ -190,21 +206,21 @@ minetest.add_particlespawner({
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.env:get_node(pos).name local n = minetest.env: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.env:set_node(p, {name="more_fire:napalm"}) minetest.env:set_node(p, {name='more_fire:napalm'})
else else
--minetest.env:remove_node(p) --minetest.env:remove_node(p)
minetest.sound_play("more_fire_ignite", {pos = self.lastpos}) minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.env:set_node(p, {name="fire:basic_flame"}) minetest.env:set_node(p, {name='fire:basic_flame'})
end end
end end
end end
@ -217,17 +233,17 @@ minetest.add_particlespawner({
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)
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 = '',
@ -237,42 +253,66 @@ minetest.register_node("more_fire:napalm", {
}) })
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(200, 3, minetest.add_particlespawner({
pos, pos, amount = 200,
{x=2, y=-0.2, z=2}, {x=-2, y=-0.5, z=-2}, time = 3,
{x=0, y=-6, z=0}, {x=0, y=-10, z=0}, minpos = pos,
2, 6, maxpos = pos,
0.05, 0.5, minvel = {x=2, y=-0.2, z=2},
false, "more_fire_spark.png") maxvel = {x=-2, y=-0.5, z=-2},
minetest.add_particlespawner(20, 2, minacc = {x=0, y=-6, z=0},
pos, pos, maxacc = {x=0, y=-10, z=0},
{x=-2, y=2, z=-2}, {x=1, y=3, z=1}, minexptime = 2,
{x=0, y=6, z=0}, {x=0, y=2, z=0}, maxexptime = 6,
1, 3, minsize = 0.05,
3, 5, maxsize = 0.5,
false, "more_fire_smoke.png") collisiondetection = false,
minetest.add_particlespawner(10, 4, texture = 'more_fire_spark.png'})
pos, pos, minetest.add_particlespawner({
{x=0, y= 3, z=0}, {x=0, y=5, z=0}, amount = 20,
{x=0.1, y=0.5, z=-0.1}, {x=-0.2, y=2, z=0.2}, time = 2,
1, 3, minpos = pos,
1, 3, maxpos = pos,
false, "more_fire_smoke.png") 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 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.env:get_node(cpos).name == "more_fire:napalm" then if minetest.env:get_node(cpos).name == 'more_fire:napalm' then
minetest.env:set_node(cpos,{name="fire:basic_flame"}) minetest.env:set_node(cpos,{name='fire:basic_flame'})
end end
if math.random(0,1) == 1 if math.random(0,1) == 1
or minetest.env:get_node(cpos).name == "more_fire:napalm" or minetest.env:get_node(cpos).name == 'more_fire:napalm'
then then
minetest.env:remove_node(cpos) minetest.env:remove_node(cpos)
end end
@ -283,29 +323,45 @@ local r = 0-- Radius for destroying
}) })
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" minetest.get_node({x=pos.x, y=pos.y+2.0, z=pos.z}).name == 'air'
then then
minetest.add_particlespawner(30, 2, minetest.add_particlespawner({
pos, pos, amount = 30,
{x=-2, y=2, z=-2}, {x=1, y=3, z=1}, time = 2,
{x=0, y=6, z=0}, {x=0, y=2, z=0}, minpos = pos,
1, 3, maxpos = pos,
10, 20, minvel = {x=-2, y=2, z=-2},
false, "more_fire_smoke.png") maxvel = {x=1, y=3, z=1},
minetest.add_particlespawner(15, 4, minacc = {x=0, y=6, z=0},
pos, pos, maxacc = {x=0, y=2, z=0},
{x=0, y= 3, z=0}, {x=0, y=5, z=0}, minexptime = 1,
{x=0.1, y=0.5, z=-0.1}, {x=-0.2, y=2, z=0.2}, maxexptime = 3,
1, 3, minsize = 10,
5, 10, maxsize = 20,
false, "more_fire_smoke.png") 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
end end
}) })
@ -325,4 +381,4 @@ minetest.register_craft({
type = 'fuel', type = 'fuel',
recipe = 'more_fire:molotov_cocktail', recipe = 'more_fire:molotov_cocktail',
burntime = 5, burntime = 5,
}) })

View File

@ -2,6 +2,7 @@ If you have any ideas for more fire related things please let me know, or consid
# Mod Contributors # Mod Contributors
Nathan Nathan
Napiophelios
# More_fire # More_fire
This is a Minetest mod that adds more/better fire related stuff This is a Minetest mod that adds more/better fire related stuff
@ -14,17 +15,22 @@ CC0
## Dependencies ## Dependencies
- default - default
- farming
- fire
- vessels - vessels
# #
Items currently included: Items currently included:
- Campfires - Campfires
- Finite torches, they burn out - Finite torches, they burn out (configurable in config.txt)
- oil lanterns, use these instead of torches. - oil lanterns, use these instead of torches
- oil for the lanterns of course
- a lighter, for starting the campfires. - a lighter, for starting the campfires.
- charcoal, much like coal, but made by cooking wood. - charcoal, much like coal, but made by cooking wood
- a smoke bomb
- molotov cocktail
# #
Planned: Planned:
Cooking capabilities in the campfires. Cooking capabilities in the campfires.
The ability to light a campfire by putting a torch in it's fuel slot, and then adding other wood.

View File

@ -3,63 +3,95 @@
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')
more_fire = {} more_fire = {}
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(40, 0.1, minetest.add_particlespawner({
pointed_thing.above, pointed_thing.above, amount = 40,
{x=2, y=0.2, z=2}, {x=-2, y=0.5, z=-2}, time = 0.1,
{x=0, y=-6, z=0}, {x=0, y=-10, z=0}, minpos = pointed_thing.above,
0.5, 2, maxpos = pointed_thing.above,
0.2, 5, minvel = {x=2, y=0.2, z=2},
true, "more_fire_shatter.png") maxvel = {x=-2, y=0.5, z=-2},
--smoke particles minacc = {x=0, y=-6, z=0},
minetest.add_particlespawner(400, 0.1, maxacc = {x=0, y=-10, z=0},
pointed_thing.above, pointed_thing.above, minexptime = 0.5,
{x=2, y=0.2, z=2}, {x=-2, y=0.5, z=-2}, maxexptime = 2,
{x=0, y=-6, z=0}, {x=0, y=-10, z=0}, minsize = 0.2,
5, 2, maxsize = 5,
20, 5, collisiondetection = true,
true, "more_fire_smoke.png") texture = 'more_fire_shatter.png'})
--more smoke particles --smoke particles
minetest.add_particlespawner(600, 1, minetest.add_particlespawner({
pointed_thing.above, pointed_thing.above, amount = 400,
{x=10, y= 3, z=10}, {x=-10, y= 3, z=-10}, time = 0.1,
{x=2, y=2, z=2}, {x=-2, y=1, z=-2}, minpos = pointed_thing.above,
2, 3, maxpos = pointed_thing.above,
20, 2, minvel = {x=2, y=0.2, z=2},
true, "more_fire_smoke.png") maxvel = {x=-2, y=0.5, z=-2},
--even more smoke particles minacc = {x=0, y=-6, z=0},
minetest.add_particlespawner(400, 1, maxacc = {x=0, y=-10, z=0},
pointed_thing.above, pointed_thing.above, minexptime = 5,
{x=0.2, y=0.2, z=0.2}, {x=-0.2, y=0.5, z=-0.2}, maxexptime = 2,
{x=10, y= 2, z=10}, {x=-10, y= 1, z=-10}, minsize = 5,
2, 3, maxsize = 20,
20, 2, collisiondetection = true,
true, "more_fire_smoke.png") 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 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.setting_getbool("creative_mode") then if not minetest.setting_getbool('creative_mode') then
item:take_item() item:take_item()
end end
return item return item
@ -76,14 +108,13 @@ local function add_effects(pos, radius)
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=1, y=-6, z=1}, minacc = {x=1, y=-6, z=1},
maxacc = {x=1, y=-10, z=1}, maxacc = {x=1, y=-10, z=1},
minexptime = 1, minexptime = 1,
maxexptime = 5, maxexptime = 5,
minsize = 10, minsize = 10,
maxsize = 20, maxsize = 20,
texture = "more_fire_smoke.png", texture = 'more_fire_smoke.png',})
}) minetest.add_particlespawner({
minetest.add_particlespawner({
amount = 100, amount = 100,
time = 2, time = 2,
minpos = vector.subtract(pos, radius / 2), minpos = vector.subtract(pos, radius / 2),
@ -91,17 +122,16 @@ local function add_effects(pos, radius)
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 =1, minexptime =1,
maxexptime = 3, maxexptime = 3,
minsize = 5, minsize = 5,
maxsize = 15, maxsize = 15,
texture = "more_fire_smoke.png", 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, radius)
end end
@ -110,7 +140,7 @@ 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={},
} }
@ -131,8 +161,7 @@ minetest.add_particlespawner({
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,
@ -146,15 +175,14 @@ minetest.add_particlespawner({
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.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) local objs = minetest.env: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,
@ -166,7 +194,7 @@ minetest.add_particlespawner({
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
@ -175,18 +203,18 @@ minetest.add_particlespawner({
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)
minetest.override_item("more_fire:smokebomb", {on_use = throw_smokebomb}) 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 = '',
@ -199,44 +227,59 @@ description = "Smoke Plume",
}) })
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" minetest.get_node({x=pos.x, y=pos.y+2.0, z=pos.z}).name == 'air'
then then
minetest.add_particlespawner(400, 3,
pos, pos,
{x=2, y=-0.2, z=2}, {x=-2, y=-0.5, z=-2},
{x=0, y=-6, z=0}, {x=0, y=-10, z=0},
2, 6,
0.05, 0.5,
false, "more_fire_smoke.png")
minetest.add_particlespawner(50, 2,
pos, pos,
{x=-2, y=0.5, z=-2}, {x=2, y=0.5, z=2},
{x=0, y=0.04, z=0}, {x=0, y=0.01, z=0},
1, 3,
3, 5,
false, "more_fire_smoke.png")
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 400, amount = 400,
time = 2, time = 3,
minpos = vector.subtract(pos, radius / 2), minpos = pos,
maxpos = vector.add(pos, radius / 2), maxpos = pos,
minvel = {x=0.2, y=2, z=0.2}, minvel = {x=2, y=-0.2, z=2},
maxvel = {x=-0.2, y=2, z=-0.2}, maxvel = {x=-2, y=-0.5, z=-2},
minacc = {x=10, y= 2, z=10}, minacc = {x=0, y=-6, z=0},
maxacc = {x=-10, y= 1, z=-10}, maxacc = {x=0, y=-10, z=0},
minexptime =1, minexptime = 2,
maxexptime = 3, maxexptime = 6,
minsize = 5, minsize = 0.05,
maxsize = 15, maxsize = 0.5,
texture = "more_fire_smoke.png", 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
end end
}) })
@ -249,4 +292,4 @@ recipe = {
{'more_fire:charcoal'}, {'more_fire:charcoal'},
{'vessels:glass_bottle'}, {'vessels:glass_bottle'},
} }
}) })

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 311 B