updated depreciated calls.

master
NathanSalapat 2019-02-02 15:33:48 -06:00
parent bf8d6ba18e
commit 25cf56720a
9 changed files with 103 additions and 137 deletions

View File

@ -1,9 +0,0 @@
--config file.
--Change the following line if you want torches to burn infinitly.
--(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

View File

@ -123,15 +123,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'more_fire:lighter',
recipe = {
{'','','group:wood'},
{'','default:flint',''},
{'default:steel_ingot','',''},
}
})
-- cooking recipes
if not minetest.get_modpath("ethereal") then
minetest.register_craft({

View File

@ -40,20 +40,6 @@ default.gui_slots..
'list[current_player;main;0,4;8,3;8]'..
default.get_hotbar_bg(0,2.75)
function burn(pointed_thing) --kindling doesn't always start from the first spark
local ignite_chance = math.random(5)
if ignite_chance == 1
and string.find(minetest.get_node(pointed_thing.under).name, 'more_fire:kindling_contained')
then
minetest.set_node(pointed_thing.under, {name = 'more_fire:embers_contained'})
elseif ignite_chance == 1
and string.find(minetest.get_node(pointed_thing.under).name, 'more_fire:kindling')
then
minetest.set_node(pointed_thing.under, {name = 'more_fire:embers'})
else --Do nothing
end
end
function smoke_particles(pos)
minetest.add_particlespawner({
amount = 1, -- how many particles do you want

View File

@ -7,7 +7,6 @@ default.gui_slots = 'listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]'
more_fire = {}
dofile(minetest.get_modpath('more_fire')..'/config.txt')
dofile(minetest.get_modpath('more_fire')..'/functions.lua')
dofile(minetest.get_modpath('more_fire')..'/abms.lua')
dofile(minetest.get_modpath('more_fire')..'/nodes.lua')

View File

@ -11,9 +11,9 @@ minetest.register_craftitem('more_fire:molotov_cocktail', {
on_place = function(itemstack, user, pointed_thing)
itemstack:take_item()
minetest.sound_play('more_fire_shatter', {gain = 1.0})
n = minetest.env:get_node(pointed_thing)
n = minetest.get_node(pointed_thing)
if pointed_thing.type == 'node' then
minetest.env:add_node(pointed_thing.above, {name='more_fire:napalm'})
minetest.add_node(pointed_thing.above, {name='more_fire:napalm'})
minetest.sound_play('more_fire_ignite', {pos,pos})
end
--Shattered glass Particles
@ -62,7 +62,7 @@ local function throw_cocktail(item, player)
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.settings:get_bool('creative_mode') then
item:take_item()
end
return item
@ -153,7 +153,7 @@ minetest.add_particlespawner({
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)
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= 'more_fire:molotov_entity' and obj:get_luaentity().name ~= '__builtin:item' then
@ -163,14 +163,14 @@ minetest.add_particlespawner({
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
local n = minetest.get_node(pos).name
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.env:set_node(p, {name='more_fire:napalm'})
minetest.set_node(p, {name='more_fire:napalm'})
else
--minetest.env:remove_node(p)
--minetest.remove_node(p)
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.env:set_node(p, {name='fire:basic_flame'})
minetest.set_node(p, {name='fire:basic_flame'})
end
end
end
@ -185,14 +185,14 @@ minetest.add_particlespawner({
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
local n = minetest.get_node(pos).name
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.env:set_node(p, {name='more_fire:napalm'})
minetest.set_node(p, {name='more_fire:napalm'})
else
--minetest.env:remove_node(p)
--minetest.remove_node(p)
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.env:set_node(p, {name='fire:basic_flame'})
minetest.set_node(p, {name='fire:basic_flame'})
end
end
end
@ -211,14 +211,13 @@ minetest.add_particlespawner({
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
local n = minetest.get_node(pos).name
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 20 then
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.env:set_node(p, {name='more_fire:napalm'})
minetest.sound_play('more_fire_ignite', {pos = self.lastpos})
minetest.set_node(p, {name='more_fire:naplam'})
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.set_node(p, {name='fire:basic_flame'})
end
end
end
@ -306,13 +305,13 @@ local r = 0-- Radius for destroying
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.get_node(cpos).name == 'more_fire:napalm' then
minetest.set_node(cpos,{name='fire:basic_flame'})
end
if math.random(0,1) == 1
or minetest.env:get_node(cpos).name == 'more_fire:napalm'
or minetest.get_node(cpos).name == 'more_fire:napalm'
then
minetest.env:remove_node(cpos)
minetest.remove_node(cpos)
end
end
end

133
nodes.lua
View File

@ -146,6 +146,13 @@ minetest.register_node('more_fire:kindling', {
inv:set_size("src", 1)
inv:set_size("dst", 2)
end,
on_ignite = function(pos, igniter)
local chance = math.random(3)
local node = minetest.get_node(pos)
if chance == 2 then
minetest.swap_node(pos, {name = 'more_fire:embers', param2 = node.param2})
end
end,
})
minetest.register_node('more_fire:embers', {
@ -188,6 +195,8 @@ minetest.register_node('more_fire:embers', {
end
return true
end,
on_ignite = function(pos, igniter)
end,
on_timer = function(pos, elapsed)
local timer = minetest.get_node_timer(pos)
timer:stop()
@ -230,19 +239,17 @@ minetest.register_node('more_fire:campfire', {
fixed = { -0.48, -0.5, -0.48, 0.48, 0.0, 0.48 },
},
can_dig = function(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
get_staticdata = function(self)
end,
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
})
minetest.register_node('more_fire:kindling_contained', {
@ -267,6 +274,13 @@ minetest.register_node('more_fire:kindling_contained', {
inv:set_size("src", 1)
inv:set_size("dst", 2)
end,
on_ignite = function(pos, igniter)
local chance = math.random(3)
local node = minetest.get_node(pos)
if chance == 2 then
minetest.swap_node(pos, {name = 'more_fire:embers_contained', param2 = node.param2})
end
end,
})
minetest.register_node('more_fire:embers_contained', {
@ -298,17 +312,19 @@ minetest.register_node('more_fire:embers_contained', {
timer:start(190)
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
on_ignite = function(pos, igniter)
end,
on_timer = function(pos, elapsed)
local timer = minetest.get_node_timer(pos)
timer:stop()
@ -319,15 +335,15 @@ minetest.register_node('more_fire:embers_contained', {
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local fuel = nil
local fuellist = inv:get_list('fuel')
if fuellist then
fuel = minetest.get_craft_result({method = 'fuel', width = 1, items = fuellist})
end
local fuellist = inv:get_list('fuel')
if fuellist then
fuel = minetest.get_craft_result({method = 'fuel', width = 1, items = fuellist})
end
if fuel.time <= 0 then
if inv:is_empty('fuel') then
timer:start(190)
end
end
end
end,
})
@ -346,23 +362,21 @@ minetest.register_node('more_fire:campfire_contained', {
light_source = 14,
is_ground_content = true,
groups = {cracky=2,hot=2,attached_node=1,dig_immediate=3,not_in_creative_inventory=1},
selection_box = {
type = 'fixed',
fixed = { -0.48, -0.5, -0.48, 0.48, 0.0, 0.48 },
},
selection_box = {
type = 'fixed',
fixed = { -0.48, -0.5, -0.48, 0.48, 0.0, 0.48 },
},
can_dig = function(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
get_staticdata = function(self)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
})
@ -428,14 +442,15 @@ minetest.register_node('more_fire:oil_lamp_off', {
local inv = meta:get_inventory()
inv:set_size('main', 8*4)
inv:set_size('fuel', 1)
meta:set_string('infotext', 'Oil Lantern')
meta:set_string('formspec',
'size[8,6]'..
'label[2,.75;Add lantern oil for a bright flame.]' ..
'list[current_name;fuel;1,.5;1,1]'..
'list[current_player;main;0,2;8,4;]')
meta:set_string('infotext', 'Oil Lantern')
'list[current_name;fuel;1,.5;1,1]'..
'list[current_player;main;0,2;8,4;]')
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local timer = minetest.get_node_timer(pos)
@ -447,8 +462,8 @@ minetest.register_node('more_fire:oil_lamp_off', {
meta:set_string('formspec',
'size[8,6]'..
'label[2,.75;keep filled with lantern oil for a bright flame.]' ..
'list[current_name;fuel;1,.5;1,1]'..
'list[current_player;main;0,2;8,4;]')
'list[current_name;fuel;1,.5;1,1]'..
'list[current_player;main;0,2;8,4;]')
end
end,
can_dig = function(pos, player)
@ -477,6 +492,7 @@ minetest.register_node('more_fire:oil_lamp_table_on', {
fixed = {-.2, -.5, -0.2, 0.2, .25, .2},
},
on_timer = function(pos, itemstack)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local timer = minetest.get_node_timer(pos)
@ -486,11 +502,11 @@ minetest.register_node('more_fire:oil_lamp_table_on', {
fuelstack:take_item()
inv:set_stack('fuel', 1, fuelstack)
if inv:is_empty('fuel') then
minetest.set_node(pos, {name = 'more_fire:oil_lamp_table_off'})
minetest.set_node(pos, {name = 'more_fire:oil_lamp_table_off', param2=node.param2})
end
timer:stop()
elseif inv:is_empty('fuel') then
minetest.set_node(pos, {name = 'more_fire:oil_lamp_table_off'})
minetest.set_node(pos, {name = 'more_fire:oil_lamp_table_off', param2=node.param2})
timer:stop()
end
end,
@ -522,26 +538,27 @@ minetest.register_node('more_fire:oil_lamp_table_off', {
local inv = meta:get_inventory()
inv:set_size('main', 8*4)
inv:set_size('fuel', 1)
meta:set_string('infotext', 'Oil Lantern')
meta:set_string('formspec',
'size[8,6]'..
'label[2,.75;Add lantern oil for a bright flame.]' ..
'list[current_name;fuel;1,.5;1,1]'..
'list[current_player;main;0,2;8,4;]')
meta:set_string('infotext', 'Oil Lantern')
'list[current_name;fuel;1,.5;1,1]'..
'list[current_player;main;0,2;8,4;]')
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local timer = minetest.get_node_timer(pos)
if inv:contains_item('fuel', 'more_fire:oil') then
minetest.swap_node(pos, {name = 'more_fire:oil_lamp_table_on'})
minetest.swap_node(pos, {name = 'more_fire:oil_lamp_table_on', param2=node.param2})
timer:start(12*60) --one oil unit will burn for 12 minutes
meta:set_string('infotext', 'Burning Oil Lamp')
meta:set_string('formspec',
'size[8,6]'..
'label[2,.75;keep filled with lantern oil for a bright flame.]' ..
'list[current_name;fuel;1,.5;1,1]'..
'list[current_player;main;0,2;8,4;]')
'list[current_name;fuel;1,.5;1,1]'..
'list[current_player;main;0,2;8,4;]')
end
end,
can_dig = function(pos, player)

View File

@ -1,4 +1,8 @@
more_fire.torch_burn_time (Burn time of new torches) int 960 100 10000
more_fire.oillamp_burn_time (Burn time of oil lamp) int 720 100 10000
#How long in seconds a torch will burn.
#Default is 960 seconds (16 minutes)
more_fire.torch_burn_time (Burn time of new torches) int 960
#How long in seconds a bottle of lamp oil will burn.
#Default is 720 seconds (12 minutes)
more_fire.oillamp_burn_time (Burn time of oil lamp) int 720
more_fire.finite_torches (Should torches burn out?) bool true
more_fire.pyromania (Enable molotov cocktails?) bool false

View File

@ -89,7 +89,7 @@ on_place = function(itemstack, user, pointed_thing)
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.settings:get_bool('creative_mode') then
item:take_item()
end
return item
@ -175,7 +175,7 @@ minetest.add_particlespawner({
maxsize = 0.75,
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)
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= 'more_fire:smokebomb_entity' and obj:get_luaentity().name ~= '__builtin:item' then

View File

@ -1,24 +1,3 @@
minetest.register_tool('more_fire:lighter', {
description = 'Lighter',
inventory_image = 'more_fire_lighter.png',
stack_max = 1,
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level = 0,
groupcaps = {
flammable = {uses = 200, maxlevel = 1},
}
},
on_use = function(itemstack, user, pointed_thing)
minetest.sound_play("spark", {gain = 1.0, max_hear_distance = 32, loop = false })
if pointed_thing.type == 'node' then
burn(pointed_thing)
itemstack:add_wear(65535/200)
return itemstack
end
end,
})
local USES = 20
minetest.register_tool('more_fire:marker', {
description = 'chard stick',