From 6449a9a9cf81c793a1e645317210b01dcd9e45b1 Mon Sep 17 00:00:00 2001 From: NathanSalapat Date: Sat, 30 May 2015 20:49:05 -0500 Subject: [PATCH] fixed up depreciated functions. --- abms.lua | 8 +- changelog.txt | 3 + config.txt | 4 + functions.lua | 6 +- init.lua | 39 +-- molotov.lua | 264 +++++++++++------- readme.md | 14 +- smokebomb.lua | 237 +++++++++------- ...ns_ignite.0.ogg => more_fire_ignite.0.ogg} | Bin ..._shatter.0.ogg => more_fire_shatter.0.ogg} | Bin ..._shatter.1.ogg => more_fire_shatter.1.ogg} | Bin textures/more_fire_glass.png | Bin 117 -> 0 bytes textures/more_fire_molotov_cocktail.png | Bin 1275 -> 454 bytes textures/more_fire_smoke_old.png | Bin 419 -> 0 bytes textures/more_fire_smokebomb.png | Bin 1518 -> 311 bytes 15 files changed, 328 insertions(+), 247 deletions(-) rename sounds/{potions_ignite.0.ogg => more_fire_ignite.0.ogg} (100%) rename sounds/{potions_shatter.0.ogg => more_fire_shatter.0.ogg} (100%) rename sounds/{potions_shatter.1.ogg => more_fire_shatter.1.ogg} (100%) delete mode 100644 textures/more_fire_glass.png delete mode 100644 textures/more_fire_smoke_old.png diff --git a/abms.lua b/abms.lua index 619d04b..19e0f3d 100644 --- a/abms.lua +++ b/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 diff --git a/changelog.txt b/changelog.txt index 4af1b63..e86a9f9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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. diff --git a/config.txt b/config.txt index cd1f1b5..2b72292 100644 --- a/config.txt +++ b/config.txt @@ -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 diff --git a/functions.lua b/functions.lua index 73412fc..ef88456 100644 --- a/functions.lua +++ b/functions.lua @@ -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 diff --git a/init.lua b/init.lua index 4a6ee21..554e328 100644 --- a/init.lua +++ b/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 diff --git a/molotov.lua b/molotov.lua index f265eab..30d410d 100644 --- a/molotov.lua +++ b/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, -}) \ No newline at end of file +}) diff --git a/readme.md b/readme.md index 6159bba..5db7f10 100644 --- a/readme.md +++ b/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. diff --git a/smokebomb.lua b/smokebomb.lua index 1ce7eee..e380389 100644 --- a/smokebomb.lua +++ b/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'}, } -}) \ No newline at end of file +}) diff --git a/sounds/potions_ignite.0.ogg b/sounds/more_fire_ignite.0.ogg similarity index 100% rename from sounds/potions_ignite.0.ogg rename to sounds/more_fire_ignite.0.ogg diff --git a/sounds/potions_shatter.0.ogg b/sounds/more_fire_shatter.0.ogg similarity index 100% rename from sounds/potions_shatter.0.ogg rename to sounds/more_fire_shatter.0.ogg diff --git a/sounds/potions_shatter.1.ogg b/sounds/more_fire_shatter.1.ogg similarity index 100% rename from sounds/potions_shatter.1.ogg rename to sounds/more_fire_shatter.1.ogg diff --git a/textures/more_fire_glass.png b/textures/more_fire_glass.png deleted file mode 100644 index a80b8fc8014cbffee4286ddd9274c002e1fff36c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqHl8kyAr-fhHE!3vwP)sQ@aMBW z5mWlD{_#Tg8>L(2sz2H19BcfqknEVVW|!k61y=<#zu*EdqX~~iC&(}~rs(%CI6mbH P&>RL&S3j3^P66yYrJ zh%9Dc;1&j9Muu5)B!GhKC7!;n?Dtva8P)XLUQ4V53Q3l@MwB?`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AxW4r$+CpG^V@#x z<|m645J`xSTuvSp6-~5v_FBhho()YuwZS^$fSm!_JFea$iS$spTz;)YmBydDMp{-2i9Mk2{~9Y9Iu!fF+U0P87+@!=A$ec`LAk&%EFi{)MJm$-U1_IG>@ z_0SwZRaI$CB9Yj20Fg)uv-zuXmQ5lUCRoq1Teu|KW(7Rg))(WgTx9||Ptc8yie+_m zmGt3+Bd!CaWs1;znd}A>w8NonWf%n~c`M5*Ui8UXe?E3H%2}VBmectqI!nmzQ1{#k z*>V-E)5SC(q!~uSIWb34PGXwn;w+QR^|NX7AE)VrlpJgh42p9LfTC2_s?}t`@~DZP zv6s?TYYsgzDW<2ane@QJTDr&FPCHnVp0IyS_YE58GELR*kx|jZ8v{0ZxdlLycVvZ% zl-(-UHlV2H#6ZKT)n2EtO338}P?9Q6a)@%J;3Xts_ntlT|2P#01V(`%)hI|!F(#*^82NGW l#<1{6Yq28rYk;+bokjgQ->_HfQJRQh#et|1%4jo@P{uXgPd zwR}Dy$jOUSk)=gIVUdQ%u``~N6nuj{e(s99E_!-X!o26wDqJT%%cMpsoi<`PVB#xr zT<~7C#q&oDYfBs6{hlZ4TIevhc*b+dd(}C&#hA8SOIgc%!uPU_L$>bYIr7ebf3zk7 zy&M|)kSD}Tkf9{@_`Y)wcy=ASwQcEXKLa-x_dlCIu3EJ!&vfaP{3i9{H+AfviWRRt zjhU-6^G#A@H2Y+%?ic)I$z JtaD0e0sz2$pl$#F diff --git a/textures/more_fire_smokebomb.png b/textures/more_fire_smokebomb.png index fca43e1a0580801a31307ce574b0234ac3052d00..ff6db3261b5912fd5d491e895d7c266d3020505e 100644 GIT binary patch literal 311 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4$}o-v5DOk$Y>6yYrJ zh%9Dc;1&j9Muu5)B!GhKC7!;n?Dtva8I?3@9((Wsg(OQ{BTAg}b8}PkN*J7rQWHy3 zQxwWGOEMJPJ$(bh8~Mb6ispN|IEGl9UK)H*@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