fixed up depreciated functions.
parent
b56f40535a
commit
6449a9a9cf
8
abms.lua
8
abms.lua
|
@ -127,8 +127,8 @@ minetest.register_abm({ --smoke for embers
|
|||
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
|
||||
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
|
||||
smoke_particles(pos)
|
||||
end
|
||||
end
|
||||
|
@ -139,8 +139,8 @@ minetest.register_abm({ --embers for fire
|
|||
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
|
||||
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
|
||||
ember_particles(pos)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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:
|
||||
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.
|
||||
|
|
|
@ -3,3 +3,7 @@
|
|||
--(true/false)
|
||||
--when true torches will burn out after a day.
|
||||
finite_torches = true
|
||||
|
||||
--Do you want smoke bombs and molotov cocktails, these can be dangerous in the hands of griefers.
|
||||
--(true/false)
|
||||
pyromania = true
|
||||
|
|
|
@ -57,9 +57,9 @@ function smoke_particles(pos)
|
|||
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" )
|
||||
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
|
||||
-- playername = 'singleplayer', -- particles only appear for this player
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -80,6 +80,6 @@ function ember_particles(pos)
|
|||
collisiondetection = false,
|
||||
texture = 'more_fire_embers.png',
|
||||
vertical = false,
|
||||
-- playername = "singleplayer",
|
||||
-- playername = 'singleplayer',
|
||||
})
|
||||
end
|
||||
|
|
39
init.lua
39
init.lua
|
@ -7,39 +7,6 @@ default.gui_slots = 'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'
|
|||
|
||||
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
|
||||
more_fire.embers_formspec =
|
||||
'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')..'/crafts.lua')
|
||||
dofile(minetest.get_modpath('more_fire')..'/tools.lua')
|
||||
dofile(minetest.get_modpath('more_fire')..'/molotov.lua')
|
||||
dofile(minetest.get_modpath('more_fire')..'/smokebomb.lua')
|
||||
if pyromania then
|
||||
dofile(minetest.get_modpath('more_fire')..'/molotov.lua')
|
||||
dofile(minetest.get_modpath('more_fire')..'/smokebomb.lua')
|
||||
end
|
||||
|
|
264
molotov.lua
264
molotov.lua
|
@ -3,52 +3,68 @@
|
|||
|
||||
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 Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua')
|
||||
|
||||
more_fire = {}
|
||||
|
||||
minetest.register_craftitem("more_fire:molotov_cocktail", {
|
||||
description = "Molotov Cocktail",
|
||||
inventory_image = "more_fire_molotov_cocktail.png",
|
||||
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})
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
n = minetest.env:get_node(pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
minetest.env:add_node(pointed_thing.above, {name="more_fire:napalm"})
|
||||
minetest.sound_play("more_fire_ignite", {pos,pos})
|
||||
if pointed_thing.type == 'node' then
|
||||
minetest.env:add_node(pointed_thing.above, {name='more_fire:napalm'})
|
||||
minetest.sound_play('more_fire_ignite', {pos,pos})
|
||||
end
|
||||
--Shattered glass Particles
|
||||
minetest.add_particlespawner(40, 0.1,
|
||||
pointed_thing.above, pointed_thing.above,
|
||||
{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},
|
||||
0.5, 2,
|
||||
0.2, 5,
|
||||
true, "more_fire_shatter.png")
|
||||
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(100, 0.1,
|
||||
pointed_thing.above, pointed_thing.above,
|
||||
{x=-2, y=0.5, z=-2}, {x=2, y=0.5, z=2},
|
||||
{x=0, y=-10, z=0}, {x=0, y=-6, z=0},
|
||||
2, 3,
|
||||
0.25, 0.5,
|
||||
true, "more_fire_spark.png")
|
||||
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")
|
||||
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 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.setting_getbool("creative_mode") then
|
||||
if not minetest.setting_getbool('creative_mode') then
|
||||
item:take_item()
|
||||
end
|
||||
return item
|
||||
|
@ -70,7 +86,7 @@ local function add_effects(pos, radius)
|
|||
maxexptime = 1.5,
|
||||
minsize = 1,
|
||||
maxsize = 2,
|
||||
texture = "more_fire_spark.png",
|
||||
texture = 'more_fire_spark.png',
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
|
@ -85,13 +101,13 @@ local function add_effects(pos, radius)
|
|||
maxexptime = 1.5,
|
||||
minsize = 1,
|
||||
maxsize = 2,
|
||||
texture = "more_fire_spark.png",
|
||||
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.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
|
||||
|
@ -100,7 +116,7 @@ local MORE_FIRE_MOLOTOV_ENTITY = {
|
|||
timer=0,
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
physical = false,
|
||||
textures = {"more_fire_molotov_cocktail.png"},
|
||||
textures = {'more_fire_molotov_cocktail.png'},
|
||||
lastpos={},
|
||||
}
|
||||
|
||||
|
@ -121,7 +137,7 @@ minetest.add_particlespawner({
|
|||
maxexptime = 1,
|
||||
minsize = 0.25,
|
||||
maxsize = 0.5,
|
||||
texture = "more_fire_smoke.png",
|
||||
texture = 'more_fire_smoke.png',
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
|
@ -136,27 +152,27 @@ minetest.add_particlespawner({
|
|||
maxexptime = 0.5,
|
||||
minsize = 0.5,
|
||||
maxsize = 0.75,
|
||||
texture = "more_fire_spark.png",
|
||||
texture = 'more_fire_spark.png',
|
||||
})
|
||||
if self.timer>0.2 then
|
||||
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
|
||||
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})
|
||||
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.env: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.env:set_node(p, {name="more_fire:napalm"})
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.env:set_node(p, {name='more_fire:napalm'})
|
||||
else
|
||||
--minetest.env:remove_node(p)
|
||||
minetest.sound_play("more_fire_ignite", {pos = self.lastpos})
|
||||
minetest.env:set_node(p, {name="fire:basic_flame"})
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.env:set_node(p, {name='fire:basic_flame'})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -165,20 +181,20 @@ minetest.add_particlespawner({
|
|||
self.object:remove()
|
||||
end
|
||||
else
|
||||
if self.node ~= "" then
|
||||
minetest.sound_play("more_fire_shatter", {gain = 1.0})
|
||||
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.env: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.env:set_node(p, {name="more_fire:napalm"})
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.env:set_node(p, {name='more_fire:napalm'})
|
||||
else
|
||||
--minetest.env:remove_node(p)
|
||||
minetest.sound_play("more_fire_ignite", {pos = self.lastpos})
|
||||
minetest.env:set_node(p, {name="fire:basic_flame"})
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.env:set_node(p, {name='fire:basic_flame'})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -190,21 +206,21 @@ minetest.add_particlespawner({
|
|||
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})
|
||||
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.env: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.env:set_node(p, {name="more_fire:napalm"})
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.env:set_node(p, {name='more_fire:napalm'})
|
||||
else
|
||||
--minetest.env:remove_node(p)
|
||||
minetest.sound_play("more_fire_ignite", {pos = self.lastpos})
|
||||
minetest.env:set_node(p, {name="fire:basic_flame"})
|
||||
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
|
||||
minetest.env:set_node(p, {name='fire:basic_flame'})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -217,17 +233,17 @@ minetest.add_particlespawner({
|
|||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
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", {
|
||||
drawtype = "firelike",
|
||||
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},
|
||||
name='fire_basic_flame_animated.png',
|
||||
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,
|
||||
groups = {igniter=1,dig_immediate=3, not_in_creative_inventory =1, not_in_craft_guide=1},
|
||||
drop = '',
|
||||
|
@ -237,42 +253,66 @@ minetest.register_node("more_fire:napalm", {
|
|||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames={"more_fire:napalm"},
|
||||
neighbors={"air"},
|
||||
nodenames={'more_fire:napalm'},
|
||||
neighbors={'air'},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos,node,active_object_count,active_object_count_wider)
|
||||
minetest.add_particlespawner(200, 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_spark.png")
|
||||
minetest.add_particlespawner(20, 2,
|
||||
pos, pos,
|
||||
{x=-2, y=2, z=-2}, {x=1, y=3, z=1},
|
||||
{x=0, y=6, z=0}, {x=0, y=2, z=0},
|
||||
1, 3,
|
||||
3, 5,
|
||||
false, "more_fire_smoke.png")
|
||||
minetest.add_particlespawner(10, 4,
|
||||
pos, pos,
|
||||
{x=0, y= 3, z=0}, {x=0, y=5, z=0},
|
||||
{x=0.1, y=0.5, z=-0.1}, {x=-0.2, y=2, z=0.2},
|
||||
1, 3,
|
||||
1, 3,
|
||||
false, "more_fire_smoke.png")
|
||||
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.env:get_node(cpos).name == "more_fire:napalm" then
|
||||
minetest.env:set_node(cpos,{name="fire:basic_flame"})
|
||||
if minetest.env:get_node(cpos).name == 'more_fire:napalm' then
|
||||
minetest.env:set_node(cpos,{name='fire:basic_flame'})
|
||||
end
|
||||
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
|
||||
minetest.env:remove_node(cpos)
|
||||
end
|
||||
|
@ -283,29 +323,45 @@ local r = 0-- Radius for destroying
|
|||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames={"fire:basic_flame"},
|
||||
neighbors={"air"},
|
||||
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"
|
||||
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(30, 2,
|
||||
pos, pos,
|
||||
{x=-2, y=2, z=-2}, {x=1, y=3, z=1},
|
||||
{x=0, y=6, z=0}, {x=0, y=2, z=0},
|
||||
1, 3,
|
||||
10, 20,
|
||||
false, "more_fire_smoke.png")
|
||||
minetest.add_particlespawner(15, 4,
|
||||
pos, pos,
|
||||
{x=0, y= 3, z=0}, {x=0, y=5, z=0},
|
||||
{x=0.1, y=0.5, z=-0.1}, {x=-0.2, y=2, z=0.2},
|
||||
1, 3,
|
||||
5, 10,
|
||||
false, "more_fire_smoke.png")
|
||||
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
|
||||
})
|
||||
|
@ -325,4 +381,4 @@ minetest.register_craft({
|
|||
type = 'fuel',
|
||||
recipe = 'more_fire:molotov_cocktail',
|
||||
burntime = 5,
|
||||
})
|
||||
})
|
||||
|
|
14
readme.md
14
readme.md
|
@ -2,6 +2,7 @@ If you have any ideas for more fire related things please let me know, or consid
|
|||
|
||||
# Mod Contributors
|
||||
Nathan
|
||||
Napiophelios
|
||||
|
||||
# More_fire
|
||||
This is a Minetest mod that adds more/better fire related stuff
|
||||
|
@ -14,17 +15,22 @@ CC0
|
|||
|
||||
## Dependencies
|
||||
- default
|
||||
- farming
|
||||
- fire
|
||||
- vessels
|
||||
|
||||
|
||||
#
|
||||
Items currently included:
|
||||
- Campfires
|
||||
- Finite torches, they burn out
|
||||
- oil lanterns, use these instead of torches.
|
||||
- Finite torches, they burn out (configurable in config.txt)
|
||||
- oil lanterns, use these instead of torches
|
||||
- oil for the lanterns of course
|
||||
- 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:
|
||||
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.
|
||||
|
|
237
smokebomb.lua
237
smokebomb.lua
|
@ -3,63 +3,95 @@
|
|||
|
||||
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 Vec3 = dofile(MOD_PATH..'/lib/Vec3_1-0.lua')
|
||||
|
||||
more_fire = {}
|
||||
|
||||
minetest.register_craftitem("more_fire:smokebomb", {
|
||||
description = "Smoke Bomb",
|
||||
inventory_image = "more_fire_smokebomb.png",
|
||||
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})
|
||||
minetest.sound_play('more_fire_shatter', {gain = 1.0})
|
||||
--Shattered glass Particles
|
||||
minetest.add_particlespawner(40, 0.1,
|
||||
pointed_thing.above, pointed_thing.above,
|
||||
{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},
|
||||
0.5, 2,
|
||||
0.2, 5,
|
||||
true, "more_fire_shatter.png")
|
||||
--smoke particles
|
||||
minetest.add_particlespawner(400, 0.1,
|
||||
pointed_thing.above, pointed_thing.above,
|
||||
{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},
|
||||
5, 2,
|
||||
20, 5,
|
||||
true, "more_fire_smoke.png")
|
||||
--more smoke particles
|
||||
minetest.add_particlespawner(600, 1,
|
||||
pointed_thing.above, pointed_thing.above,
|
||||
{x=10, y= 3, z=10}, {x=-10, y= 3, z=-10},
|
||||
{x=2, y=2, z=2}, {x=-2, y=1, z=-2},
|
||||
2, 3,
|
||||
20, 2,
|
||||
true, "more_fire_smoke.png")
|
||||
--even more smoke particles
|
||||
minetest.add_particlespawner(400, 1,
|
||||
pointed_thing.above, pointed_thing.above,
|
||||
{x=0.2, y=0.2, z=0.2}, {x=-0.2, y=0.5, z=-0.2},
|
||||
{x=10, y= 2, z=10}, {x=-10, y= 1, z=-10},
|
||||
2, 3,
|
||||
20, 2,
|
||||
true, "more_fire_smoke.png")
|
||||
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")
|
||||
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 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.setting_getbool("creative_mode") then
|
||||
if not minetest.setting_getbool('creative_mode') then
|
||||
item:take_item()
|
||||
end
|
||||
return item
|
||||
|
@ -76,14 +108,13 @@ local function add_effects(pos, radius)
|
|||
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},
|
||||
maxacc = {x=1, y=-10, z=1},
|
||||
minexptime = 1,
|
||||
maxexptime = 5,
|
||||
minsize = 10,
|
||||
maxsize = 20,
|
||||
texture = "more_fire_smoke.png",
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
texture = 'more_fire_smoke.png',})
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
time = 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},
|
||||
maxvel = {x=-0.2, y=0.5, z=-0.2},
|
||||
minacc = {x=10, y= 2, z=10},
|
||||
maxacc = {x=-10, y= 1, z=-10},
|
||||
maxacc = {x=-10, y= 1, z=-10},
|
||||
minexptime =1,
|
||||
maxexptime = 3,
|
||||
minsize = 5,
|
||||
maxsize = 15,
|
||||
texture = "more_fire_smoke.png",
|
||||
})
|
||||
texture = 'more_fire_smoke.png',})
|
||||
end
|
||||
|
||||
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)
|
||||
add_effects(pos, radius)
|
||||
end
|
||||
|
@ -110,7 +140,7 @@ local MORE_FIRE_SMOKEBOMB_ENTITY = {
|
|||
timer=0,
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
physical = false,
|
||||
textures = {"more_fire_smokebomb.png"},
|
||||
textures = {'more_fire_smokebomb.png'},
|
||||
lastpos={},
|
||||
}
|
||||
|
||||
|
@ -131,8 +161,7 @@ minetest.add_particlespawner({
|
|||
maxexptime = 1,
|
||||
minsize = 0.25,
|
||||
maxsize = 0.5,
|
||||
texture = "more_fire_smoke.png",
|
||||
})
|
||||
texture = 'more_fire_smoke.png',})
|
||||
minetest.add_particlespawner({
|
||||
amount = 10,
|
||||
time = 0.25,
|
||||
|
@ -146,15 +175,14 @@ minetest.add_particlespawner({
|
|||
maxexptime = 0.5,
|
||||
minsize = 0.5,
|
||||
maxsize = 0.75,
|
||||
texture = "more_fire_smoke.png",
|
||||
})
|
||||
texture = 'more_fire_smoke.png',})
|
||||
if self.timer>0.2 then
|
||||
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
|
||||
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})
|
||||
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,
|
||||
|
@ -166,7 +194,7 @@ minetest.add_particlespawner({
|
|||
end
|
||||
end
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" then
|
||||
if node.name ~= 'air' then
|
||||
self.object:remove()
|
||||
plume(self.lastpos)
|
||||
end
|
||||
|
@ -175,18 +203,18 @@ minetest.add_particlespawner({
|
|||
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", {
|
||||
drawtype = "plantlike",
|
||||
description = "Smoke Plume",
|
||||
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},
|
||||
name='more_fire_smoke_animated.png',
|
||||
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,
|
||||
groups = {dig_immediate=3, not_in_creative_inventory =1, not_in_craft_guide=1},
|
||||
drop = '',
|
||||
|
@ -199,44 +227,59 @@ description = "Smoke Plume",
|
|||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames={"more_fire:plume"},
|
||||
neighbors={"air"},
|
||||
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"
|
||||
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(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({
|
||||
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",
|
||||
})
|
||||
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
|
||||
})
|
||||
|
@ -249,4 +292,4 @@ recipe = {
|
|||
{'more_fire:charcoal'},
|
||||
{'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 |
Loading…
Reference in New Issue