Add luacheck and fix warnings

This commit is contained in:
Niklp 2023-11-26 17:58:57 +01:00 committed by SmallJoker
parent 53669f6fad
commit 5480f4c9df
5 changed files with 86 additions and 76 deletions

10
.github/workflows/luacheck.yml vendored Normal file
View File

@ -0,0 +1,10 @@
name: luacheck
on: [push, pull_request]
jobs:
luacheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Luacheck
uses: lunarmodules/luacheck@master

12
.luacheckrc Normal file
View File

@ -0,0 +1,12 @@
unused_args = false
max_line_length = 150
read_globals = {
"minetest",
"vector",
"ItemStack",
"default",
"tnt",
"mcl_sounds",
"mcl_explosions"
}

View File

@ -2,7 +2,7 @@
-- demand a "Player" object as a parameter and hopefully prevent the mods that have -- demand a "Player" object as a parameter and hopefully prevent the mods that have
-- registered with those callbacks from crashing on a nil dereference or bad function -- registered with those callbacks from crashing on a nil dereference or bad function
-- call. This is not supposed to be a remotely functional thing, it's just supposed -- call. This is not supposed to be a remotely functional thing, it's just supposed
-- to provide dummy methods and return values of the correct data type for anything that -- to provide dummy methods and return values of the correct data type for anything that
-- might ignore the false "is_player()" return and go ahead and try to use this thing -- might ignore the false "is_player()" return and go ahead and try to use this thing
-- anyway. -- anyway.
@ -40,10 +40,10 @@ end
function FakePlayer.create(pos, player_name) function FakePlayer.create(pos, player_name)
local self = {} local self = {}
setmetatable(self, FakePlayer) setmetatable(self, FakePlayer)
self.is_fake_player = player_name self.is_fake_player = player_name
-- ObjectRef -- ObjectRef
self.get_pos = return_value(pos) self.get_pos = return_value(pos)
self.set_pos = return_nil self.set_pos = return_nil
self.move_to = return_nil self.move_to = return_nil
@ -87,7 +87,7 @@ function FakePlayer.create(pos, player_name)
self.get_luaentity = return_nil self.get_luaentity = return_nil
-- Player object -- Player object
self.get_player_name = return_empty_string self.get_player_name = return_empty_string
self.get_player_velocity = return_nil self.get_player_velocity = return_nil
self.get_look_dir = return_value({x=0,y=1,z=0}) self.get_look_dir = return_value({x=0,y=1,z=0})
@ -112,13 +112,13 @@ function FakePlayer.create(pos, player_name)
self.set_physics_override = return_nil self.set_physics_override = return_nil
self.get_physics_override = return_value({speed = 1, jump = 1, gravity = 1, sneak = true, sneak_glitch = false, new_move = true,}) self.get_physics_override = return_value({speed = 1, jump = 1, gravity = 1, sneak = true, sneak_glitch = false, new_move = true,})
self.hud_add = return_nil self.hud_add = return_nil
self.hud_remove = return_nil self.hud_remove = return_nil
self.hud_change = return_nil self.hud_change = return_nil
self.hud_get = return_nil -- possibly important return value? self.hud_get = return_nil -- possibly important return value?
self.hud_set_flags = return_nil self.hud_set_flags = return_nil
self.hud_get_flags = return_value({ hotbar=true, healthbar=true, crosshair=true, wielditem=true, breathbar=true, minimap=true }) self.hud_get_flags = return_value({ hotbar=true, healthbar=true, crosshair=true, wielditem=true, breathbar=true, minimap=true })
self.hud_set_hotbar_itemcount = return_nil self.hud_set_hotbar_itemcount = return_nil
self.hud_get_hotbar_itemcount = return_zero self.hud_get_hotbar_itemcount = return_zero
@ -128,19 +128,19 @@ function FakePlayer.create(pos, player_name)
self.hud_get_hotbar_selected_image = return_empty_string self.hud_get_hotbar_selected_image = return_empty_string
self.set_sky = return_nil self.set_sky = return_nil
self.get_sky = return_empty_table -- may need members on this table self.get_sky = return_empty_table -- may need members on this table
self.set_clouds = return_nil self.set_clouds = return_nil
self.get_clouds = return_value({density = 0, color = "#fff0f0e5", ambient = "#000000", height = 120, thickness = 16, speed = {x=0, y=-2}}) self.get_clouds = return_value({density = 0, color = "#fff0f0e5", ambient = "#000000", height = 120, thickness = 16, speed = {x=0, y=-2}})
self.override_day_night_ratio = return_nil self.override_day_night_ratio = return_nil
self.get_day_night_ratio = return_nil self.get_day_night_ratio = return_nil
self.set_local_animation = return_nil self.set_local_animation = return_nil
self.get_local_animation = return_empty_table self.get_local_animation = return_empty_table
self.set_eye_offset = return_nil self.set_eye_offset = return_nil
self.get_eye_offset = return_value({x=0,y=0,z=0},{x=0,y=0,z=0}) self.get_eye_offset = return_value({x=0,y=0,z=0},{x=0,y=0,z=0})
return self return self
end end

112
init.lua
View File

@ -56,12 +56,6 @@ local crossbow_range = tonumber(minetest.settings:get("torch_bomb_base_crossbow_
local enable_crossbows = minetest.settings:get_bool("torch_bomb_enable_crossbows", true) local enable_crossbows = minetest.settings:get_bool("torch_bomb_enable_crossbows", true)
local torch_bow_uses = tonumber(minetest.settings:get("torch_bomb_base_crossbow_uses")) or 30 local torch_bow_uses = tonumber(minetest.settings:get("torch_bomb_base_crossbow_uses")) or 30
-- Detect creative mod
local creative_mod = minetest.get_modpath("creative")
-- Cache creative mode setting as fallback if creative mod not present
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
-- 12 torches grenade -- 12 torches grenade
local ico1 = { local ico1 = {
vector.new(0.000000, -1.000000, 0.000000), vector.new(0.000000, -1.000000, 0.000000),
@ -134,7 +128,7 @@ end
-- 162 torches, 3* bomb_range -- 162 torches, 3* bomb_range
local ico3 = { local ico3 = {
vector.new(0.000000, -1.000000, 0.000000), vector.new(0.000000, -1.000000, 0.000000),
vector.new(0.723607, -0.447220, 0.525725), vector.new(0.723607, -0.447220, 0.525725),
vector.new(-0.276388, -0.447220, 0.850649), vector.new(-0.276388, -0.447220, 0.850649),
vector.new(-0.894426, -0.447216, 0.000000), vector.new(-0.894426, -0.447216, 0.000000),
@ -315,7 +309,7 @@ local function find_target(raycast)
if above_def.buildable_to and ((under_def and not under_def.buildable_to) or not under_def) then if above_def.buildable_to and ((under_def and not under_def.buildable_to) or not under_def) then
return next_pointed return next_pointed
end end
next_pointed = raycast:next(next_pointed) next_pointed = raycast:next(next_pointed)
end end
end end
@ -336,7 +330,6 @@ local function embed_torch(target, placer, pos)
torch_def_on_place(ItemStack(torch_item), placer, target) torch_def_on_place(ItemStack(torch_item), placer, target)
local target_pos = target.above local target_pos = target.above
local dir_back = vector.normalize(vector.subtract(pos, target_pos)) local dir_back = vector.normalize(vector.subtract(pos, target_pos))
local vel_back = vector.multiply(dir_back, 10)
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = math.random(1,6), amount = math.random(1,6),
time = 0.1, time = 0.1,
@ -374,13 +367,13 @@ local function kerblam(pos, placer, dirs, min_range)
placer = fakeplayer placer = fakeplayer
fakeplayer:update(pos, "torch_bomb") fakeplayer:update(pos, "torch_bomb")
end end
minetest.log("action", placer:get_player_name() .. " detonated a torch bomb at " .. minetest.log("action", placer:get_player_name() .. " detonated a torch bomb at " ..
minetest.pos_to_string(pos) .. " and placed " .. #targets .. " torches.") minetest.pos_to_string(pos) .. " and placed " .. #targets .. " torches.")
for _, target in ipairs(targets) do for _, target in ipairs(targets) do
embed_torch(target, placer, pos) embed_torch(target, placer, pos)
end end
end end
local player_setting_fuse_at = {} local player_setting_fuse_at = {}
@ -421,7 +414,7 @@ if enable_rockets then
local player_name = player:get_player_name() local player_name = player:get_player_name()
local pos = player_setting_fuse_at[player_name] local pos = player_setting_fuse_at[player_name]
local seconds = tonumber(fields.seconds or "") local seconds = tonumber(fields.seconds or "")
if not pos or not seconds then if not pos or not seconds then
player_setting_fuse_at[player_name] = nil player_setting_fuse_at[player_name] = nil
return return
@ -445,7 +438,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
minetest.register_node("torch_bomb:" .. name, { minetest.register_node("torch_bomb:" .. name, {
description = desc, description = desc,
drawtype = "normal", drawtype = "normal",
tiles = {"torch_bomb_top.png", "torch_bomb_bottom.png", side_texture}, tiles = {"torch_bomb_top.png", "torch_bomb_bottom.png", side_texture},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
@ -453,7 +446,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
groups = {tnt = 1, oddly_breakable_by_hand = 1, handy = 1, axey = 1}, groups = {tnt = 1, oddly_breakable_by_hand = 1, handy = 1, axey = 1},
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
_mcl_hardness = 0.8, _mcl_hardness = 0.8,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == torch_item then if puncher:get_wielded_item():get_name() == torch_item then
minetest.set_node(pos, {name = "torch_bomb:"..name.."_burning"}) minetest.set_node(pos, {name = "torch_bomb:"..name.."_burning"})
@ -462,12 +455,12 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
minetest.pos_to_string(pos)) minetest.pos_to_string(pos))
end end
end, end,
on_ignite = function(pos) -- used by TNT mod on_ignite = function(pos) -- used by TNT mod
minetest.set_node(pos, {name = "torch_bomb:"..name.."_burning"}) minetest.set_node(pos, {name = "torch_bomb:"..name.."_burning"})
end, end,
}) })
minetest.register_node("torch_bomb:"..name.."_burning", { minetest.register_node("torch_bomb:"..name.."_burning", {
description = desc, description = desc,
drawtype = "normal", -- See "Node drawtypes" drawtype = "normal", -- See "Node drawtypes"
@ -487,7 +480,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
paramtype2 = "facedir", paramtype2 = "facedir",
light_source = 6, light_source = 6,
drop = "torch_bomb:" .. name, drop = "torch_bomb:" .. name,
on_construct = function(pos) on_construct = function(pos)
if tnt_modpath or mcl_tnt_modpath then if tnt_modpath or mcl_tnt_modpath then
minetest.sound_play({name="tnt_ignite", gain=1}, {pos = pos, max_hear_distance=16}, true) minetest.sound_play({name="tnt_ignite", gain=1}, {pos = pos, max_hear_distance=16}, true)
@ -495,7 +488,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
minetest.get_node_timer(pos):start(3) minetest.get_node_timer(pos):start(3)
minetest.check_for_falling(pos) minetest.check_for_falling(pos)
end, end,
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local ignitor_name = minetest.get_meta(pos):get("torch_bomb_ignitor") local ignitor_name = minetest.get_meta(pos):get("torch_bomb_ignitor")
local puncher local puncher
@ -512,14 +505,14 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
kerblam(pos, puncher, dirs, min_range) kerblam(pos, puncher, dirs, min_range)
end, end,
}) })
if not enable_rockets then if not enable_rockets then
return return
end end
local rocket_bottom_texture = "torch_bomb_bottom.png^torch_bomb_rocket_bottom.png" local rocket_bottom_texture = "torch_bomb_bottom.png^torch_bomb_rocket_bottom.png"
local rocket_side_texture = side_texture .. "^torch_bomb_rocket_side.png" local rocket_side_texture = side_texture .. "^torch_bomb_rocket_side.png"
local function entity_detonate(player_name, target) local function entity_detonate(player_name, target)
--minetest.chat_send_all("entity detonate " .. (player_name or "") .. " " .. minetest.pos_to_string(target)) --minetest.chat_send_all("entity detonate " .. (player_name or "") .. " " .. minetest.pos_to_string(target))
local player local player
@ -534,7 +527,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
end end
kerblam(target, player, dirs, min_range) kerblam(target, player, dirs, min_range)
end end
minetest.register_entity("torch_bomb:"..name.."_rocket_entity", { minetest.register_entity("torch_bomb:"..name.."_rocket_entity", {
initial_properties = { initial_properties = {
physical = false, physical = false,
@ -551,7 +544,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
self.object:remove() self.object:remove()
end end
end, end,
get_staticdata = function(self) get_staticdata = function(self)
local target = self.target local target = self.target
if target then if target then
@ -566,11 +559,11 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
return "detonated" return "detonated"
end end
end, end,
on_step = function(self, dtime) on_step = function(self, dtime)
local object = self.object local object = self.object
local lastpos = self.lastpos local lastpos = self.lastpos
local pos = object:get_pos() local pos = object:get_pos()
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local luaentity = object:get_luaentity() local luaentity = object:get_luaentity()
@ -585,7 +578,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
max_hear_distance = 32, max_hear_distance = 32,
}) })
end end
if lastpos and (node.name ~= "air" or luaentity.fuse < 0) then if lastpos and (node.name ~= "air" or luaentity.fuse < 0) then
lastpos = vector.round(lastpos) lastpos = vector.round(lastpos)
local player_name = luaentity.player_name local player_name = luaentity.player_name
@ -598,7 +591,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
minetest.register_node("torch_bomb:"..name.."_rocket", { minetest.register_node("torch_bomb:"..name.."_rocket", {
description = S("@1 Rocket", desc), description = S("@1 Rocket", desc),
drawtype = "normal", drawtype = "normal",
tiles = {"torch_bomb_top.png", rocket_bottom_texture, rocket_side_texture}, tiles = {"torch_bomb_top.png", rocket_bottom_texture, rocket_side_texture},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
@ -606,7 +599,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
groups = {tnt = 1, oddly_breakable_by_hand = 1, torch_bomb_rocket = 1, handy = 1, axey = 1}, groups = {tnt = 1, oddly_breakable_by_hand = 1, torch_bomb_rocket = 1, handy = 1, axey = 1},
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
_mcl_hardness = 0.8, _mcl_hardness = 0.8,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == torch_item then if puncher:get_wielded_item():get_name() == torch_item then
local fuse = minetest.get_meta(pos):get("fuse") local fuse = minetest.get_meta(pos):get("fuse")
@ -618,7 +611,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
minetest.pos_to_string(pos)) minetest.pos_to_string(pos))
end end
end, end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local fuse_length = tonumber(meta:get_string("fuse")) or default_fuse local fuse_length = tonumber(meta:get_string("fuse")) or default_fuse
@ -633,7 +626,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
minetest.get_meta(pos):set_string("fuse", fuse) minetest.get_meta(pos):set_string("fuse", fuse)
end, end,
}) })
minetest.register_node("torch_bomb:"..name.."_rocket_burning", { minetest.register_node("torch_bomb:"..name.."_rocket_burning", {
description = S("@1 Rocket", desc), description = S("@1 Rocket", desc),
drawtype = "normal", drawtype = "normal",
@ -653,7 +646,7 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
paramtype2 = "facedir", paramtype2 = "facedir",
light_source = 6, light_source = 6,
drop = "torch_bomb:"..name.."_rocket", drop = "torch_bomb:"..name.."_rocket",
on_construct = function(pos) on_construct = function(pos)
if tnt_modpath then if tnt_modpath then
minetest.sound_play("tnt_ignite", {pos = pos, max_hear_distance=16}, true) minetest.sound_play("tnt_ignite", {pos = pos, max_hear_distance=16}, true)
@ -661,19 +654,19 @@ local function register_torch_bomb(name, desc, dirs, min_range, blast_radius, te
minetest.get_node_timer(pos):start(3) minetest.get_node_timer(pos):start(3)
minetest.check_for_falling(pos) minetest.check_for_falling(pos)
end, end,
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local ignitor_name = meta:get("torch_bomb_ignitor") local ignitor_name = meta:get("torch_bomb_ignitor")
local fuse = tonumber(meta:get_string("fuse")) or default_fuse local fuse = tonumber(meta:get_string("fuse")) or default_fuse
minetest.set_node(pos, {name="air"}) minetest.set_node(pos, {name="air"})
local obj = minetest.add_entity(pos, "torch_bomb:"..name.."_rocket_entity") local obj = minetest.add_entity(pos, "torch_bomb:"..name.."_rocket_entity")
obj:set_acceleration({x=0, y=1, z=0}) obj:set_acceleration({x=0, y=1, z=0})
local lua_entity = obj:get_luaentity() local lua_entity = obj:get_luaentity()
lua_entity.player_name = ignitor_name lua_entity.player_name = ignitor_name
lua_entity.fuse = fuse lua_entity.fuse = fuse
local range = 0.5 * fuse * fuse -- s = vi * t + (1/2)*a*t*t local range = 0.5 * fuse * fuse -- s = vi * t + (1/2)*a*t*t
pos.y = pos.y + range pos.y = pos.y + range
lua_entity.target = pos lua_entity.target = pos
@ -692,7 +685,7 @@ if enable_grenade then
local throw_velocity = 20 local throw_velocity = 20
local gravity = {x=0, y=-9.81, z=0} local gravity = {x=0, y=-9.81, z=0}
minetest.register_craftitem("torch_bomb:torch_grenade", { minetest.register_craftitem("torch_bomb:torch_grenade", {
description = S("Torch Grenade"), description = S("Torch Grenade"),
inventory_image = "torch_bomb_torch_grenade.png", inventory_image = "torch_bomb_torch_grenade.png",
@ -705,25 +698,21 @@ if enable_grenade then
obj:set_yaw(user:get_look_horizontal()+math.pi) obj:set_yaw(user:get_look_horizontal()+math.pi)
local lua_entity = obj:get_luaentity() local lua_entity = obj:get_luaentity()
lua_entity.player_name = user:get_player_name() lua_entity.player_name = user:get_player_name()
minetest.sound_play({name="tnt_ignite"}, minetest.sound_play({name="tnt_ignite"}, {
{ pos = player_pos,
pos=player_pos,
object = object,
gain = 1.0, gain = 1.0,
max_hear_distance = 32, max_hear_distance = 32,
}, }, true)
true)
if not minetest.is_creative_enabled(user:get_player_name()) then
if not ((creative_mod and creative.is_enabled_for(user:get_player_name())) or
creative_mode_cache) then
itemstack:set_count(itemstack:get_count() - 1) itemstack:set_count(itemstack:get_count() - 1)
end end
return itemstack return itemstack
end end
}) })
minetest.register_entity("torch_bomb:torch_grenade_entity", { minetest.register_entity("torch_bomb:torch_grenade_entity", {
initial_properties = { initial_properties = {
physical = false, physical = false,
@ -733,21 +722,21 @@ if enable_grenade then
collisionbox = {0,0,0,0,0,0}, collisionbox = {0,0,0,0,0,0},
glow = 8, glow = 8,
}, },
on_activate = function(self, staticdata, dtime_s) on_activate = function(self, staticdata, dtime_s)
self.player_name = staticdata self.player_name = staticdata
end, end,
get_staticdata = function(self) get_staticdata = function(self)
return self.player_name return self.player_name
end, end,
on_step = function(self, dtime) on_step = function(self, dtime)
local object = self.object local object = self.object
local lastpos = self.lastpos local lastpos = self.lastpos
local pos = object:get_pos() local pos = object:get_pos()
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if lastpos ~= nil and node.name ~= "air" then if lastpos ~= nil and node.name ~= "air" then
lastpos = vector.round(lastpos) lastpos = vector.round(lastpos)
local luaentity = object:get_luaentity() local luaentity = object:get_luaentity()
@ -773,7 +762,7 @@ end
---------------------------------------------------------------------- ----------------------------------------------------------------------
-- Torch crossbows -- Torch crossbows
local function register_torch_bow(name, desc, material, image, torch_bow_range, torch_bow_uses) local function register_torch_bow(name, desc, material, image, torch_bow_range, local_torch_bow_uses)
minetest.register_tool("torch_bomb:torch_crossbow_" .. name, { minetest.register_tool("torch_bomb:torch_crossbow_" .. name, {
description = S("@1 Torch Crossbow", desc), description = S("@1 Torch Crossbow", desc),
inventory_image = image, inventory_image = image,
@ -794,16 +783,15 @@ local function register_torch_bow(name, desc, material, image, torch_bow_range,
return return
end end
if not ((creative_mod and creative.is_enabled_for(user:get_player_name())) or if not minetest.is_creative_enabled(user:get_player_name()) then
creative_mode_cache) then
inv:remove_item("main", {name=torch_item, count=1}) inv:remove_item("main", {name=torch_item, count=1})
itemstack:add_wear(65535/(torch_bow_uses-1)) itemstack:add_wear(65535/(local_torch_bow_uses-1))
end end
local dir = user:get_look_dir() local dir = user:get_look_dir()
local target = vector.add(playerpos, vector.multiply(dir, torch_bow_range)) local target = vector.add(playerpos, vector.multiply(dir, torch_bow_range))
local raycast = minetest.raycast(playerpos, target, false, true) local raycast = minetest.raycast(playerpos, target, false, true)
local target_pointed = find_target(raycast) local target_pointed = find_target(raycast)
if target_pointed then if target_pointed then
@ -871,19 +859,19 @@ if enable_tnt and tnt_modpath then
{'tnt:tnt_stick', 'tnt:tnt_stick', 'tnt:tnt_stick'}, {'tnt:tnt_stick', 'tnt:tnt_stick', 'tnt:tnt_stick'},
}, },
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "torch_bomb:mega_torch_bomb", output = "torch_bomb:mega_torch_bomb",
recipe = {"torch_bomb:torch_bomb", "torch_bomb:torch_bomb", "torch_bomb:torch_bomb"}, recipe = {"torch_bomb:torch_bomb", "torch_bomb:torch_bomb", "torch_bomb:torch_bomb"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "torch_bomb:torch_bomb 3", output = "torch_bomb:torch_bomb 3",
recipe = {"torch_bomb:mega_torch_bomb"}, recipe = {"torch_bomb:mega_torch_bomb"},
}) })
if enable_grenade then if enable_grenade then
minetest.register_craft({ minetest.register_craft({
@ -891,14 +879,14 @@ if enable_tnt and tnt_modpath then
output = "torch_bomb:torch_bomb", output = "torch_bomb:torch_bomb",
recipe = {"torch_bomb:torch_grenade", "torch_bomb:torch_grenade", "torch_bomb:torch_grenade"}, recipe = {"torch_bomb:torch_grenade", "torch_bomb:torch_grenade", "torch_bomb:torch_grenade"},
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "torch_bomb:torch_grenade 3", output = "torch_bomb:torch_grenade 3",
recipe = {"torch_bomb:torch_bomb"}, recipe = {"torch_bomb:torch_bomb"},
}) })
end end
if enable_rockets then if enable_rockets then
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
@ -910,7 +898,7 @@ if enable_tnt and tnt_modpath then
type = "shapeless", type = "shapeless",
output = "torch_bomb:mega_torch_bomb_rocket", output = "torch_bomb:mega_torch_bomb_rocket",
recipe = {"torch_bomb:mega_torch_bomb", "tnt:tnt"}, recipe = {"torch_bomb:mega_torch_bomb", "tnt:tnt"},
}) })
end end
end end

View File

@ -1,4 +1,4 @@
name = torch_bomb name = torch_bomb
description = Place torches throughout your entire surroundings with a torch bomb description = Place torches throughout your entire surroundings with a torch bomb
depends = optional_depends = mcl_core, mcl_sounds, mcl_explosions, mcl_tnt, default, tnt, creative, farming
optional_depends = mcl_core, mcl_sounds, mcl_explosions, mcl_tnt, default, tnt, creative, farming min_minetest_version = 5.3.0