cleaning up some stuff with luacheck.

This commit is contained in:
FaceDeer
2023-09-29 16:09:25 -06:00
parent c9dedef095
commit f537af33bc
88 changed files with 1695 additions and 1644 deletions

View File

@ -17,10 +17,10 @@ local function setting(stype, name, default, description)
value = default
end
df_underworld_items.config[name] = value
if print_settingtypes then
minetest.debug(CONFIG_FILE_PREFIX..name.." ("..description..") "..stype.." "..tostring(default))
end
end
end
setting("bool", "invulnerable_slade", true, "Slade is invulnerable to players")

View File

@ -35,7 +35,7 @@ df_underworld_items.underworld_shard = function(data, area, vi, x_slant, z_slant
if z_slant == nil then z_slant = math.random(-1,1) end
if rotated == nil then rotated = math.random() > 0.5 end
if length == nil then length = math.random(4, 12) end
length = math.ceil(length/2) * 2 -- make it an even multiple of 2
local xstride, ystride, zstride
@ -47,16 +47,16 @@ df_underworld_items.underworld_shard = function(data, area, vi, x_slant, z_slant
xstride = 1
zstride = area.zstride
end
-- bottom end
safe_write(data, area, vi, c_amethyst)
safe_write(data, area, vi+xstride, c_amethyst)
for i = 1, length do
vi = vi + ystride
safe_write(data, area, vi-xstride, c_amethyst)
safe_write(data, area, vi+zstride, c_amethyst)
safe_write(data, area, vi, c_amethyst)
safe_write(data, area, vi-zstride, c_amethyst)
@ -73,7 +73,7 @@ df_underworld_items.underworld_shard = function(data, area, vi, x_slant, z_slant
end
vi = vi + ystride
safe_write(data, area, vi, c_amethyst)
safe_write(data, area, vi+xstride, c_amethyst)
end

View File

@ -32,7 +32,7 @@ if tnt_boom then
glowstone_def.on_dig = function(pos, node, digger)
if minetest.node_dig(pos, node, digger) then
tnt_boom(pos, {radius=3})
end
end
end
end
minetest.register_node("df_underworld_items:glowstone", glowstone_def)

View File

@ -18,7 +18,7 @@ minetest.register_node("df_underworld_items:pit_plasma", {
},
},
},
groups={pit_plasma=1, pit_plasma_resistant=1,destroys_items=1, set_on_fire=15, fire_damage=1, liquid=1},
walkable = false,
pointable = false,
@ -161,7 +161,7 @@ if df_underworld_items.config.destructive_pit_plasma then
end
if sparkle_pos then
sparkle(sparkle_pos)
end
end
end,
})
end

View File

@ -7,7 +7,7 @@ end
local initialize = function(pos, meta)
if not meta:contains("key") then
local inv = meta:get_inventory()
inv:set_size("main", 8)
inv:set_size("main", 8)
local next_seed = math.random() * 2^21
math.randomseed(pos.x + pos.y^8 + pos.z^16)
-- Key is consistent with location
@ -66,9 +66,9 @@ local show_formspec = function(pos, node, clicker, itemstack, pointed_thing)
.. "container[3,0]" .. formspec_dial("dial2", state[2]) .. "container_end[]"
.. "container[0,1.5]" .. formspec_dial("dial3", state[3]) .. "container_end[]"
.. "container[3,1.5]" .. formspec_dial("dial4", state[4]) .. "container_end[]"
.. "container[6.1,0]" .. formspec_bar(true, state_sum[1], key_sum[1]) .. "container_end[]"
.. "container[6.1,1.5]" .. formspec_bar(true, state_sum[2], key_sum[2]) .. "container_end[]"
.. "container[1,2.75]" .. formspec_bar(false, state_sum[3], key_sum[3]) .. "container_end[]"
.. "container[6.1,0]" .. formspec_bar(true, state_sum[1], key_sum[1]) .. "container_end[]"
.. "container[6.1,1.5]" .. formspec_bar(true, state_sum[2], key_sum[2]) .. "container_end[]"
.. "container[1,2.75]" .. formspec_bar(false, state_sum[3], key_sum[3]) .. "container_end[]"
.. "container[4,2.75]" .. formspec_bar(false, state_sum[4], key_sum[4]) .. "container_end[]"
.. "container_end[]"
.. itemslot_bg(0.6,6.7,8,4,0.25)
@ -139,7 +139,7 @@ minetest.register_node("df_underworld_items:puzzle_chest_closed", {
sounds = df_dependencies.sound_stone({ footstep = { name = "bedrock2_step", gain = 1 } }),
_mcl_blast_resistance = 1200,
_mcl_hardness = 50,
on_rightclick = show_formspec,
can_dig = puzzle_chest_can_dig,
})
@ -166,7 +166,7 @@ minetest.register_node("df_underworld_items:puzzle_chest_opened", {
sounds = df_dependencies.sound_stone({ footstep = { name = "bedrock2_step", gain = 1 } }),
_mcl_blast_resistance = 1200,
_mcl_hardness = 50,
on_rightclick = show_formspec,
can_dig = puzzle_chest_can_dig,
})

View File

@ -40,7 +40,7 @@ local ensure_meta = function(pos)
meta:set_string("key", minetest.serialize(key))
meta:mark_as_private("key")
end
local timer = minetest.get_node_timer(pos)
if not timer:is_started() then
timer:start(4)
@ -76,7 +76,7 @@ local cull_colour_groups = function()
table.insert(culled_colour_groups, new_set)
end
colour_groups = culled_colour_groups
-- collect a list of all items with useful colour groups
-- to be used for treasure generation
local colour_item_set = {}
@ -109,7 +109,7 @@ local test_key = function(pos, player)
if not meta:contains("key") then
return false
end
local keystring = meta:get_string("key")
local key = minetest.deserialize(keystring)
local inv = meta:get_inventory()
@ -150,7 +150,7 @@ end
local formspec_prefix = "df_underworld_items_puzzle_seal:"
local itemslot_bg = df_dependencies.get_itemslot_bg
local get_formspec = function(pos, unlocked)
local formspec =
local formspec =
"size[8,8]"
.."image[0,0;2.5,4;dfcaverns_puzzle_inscription_background.png^dfcaverns_puzzle_inscription_1.png]"
.."image[5.8,0;2.5,4;dfcaverns_puzzle_inscription_background.png^[transformR180^dfcaverns_puzzle_inscription_2.png]"
@ -176,7 +176,7 @@ local get_formspec = function(pos, unlocked)
else
formspec = formspec .. "image[1.25,1.25;1,1;dfcaverns_seal.png]"
end
formspec = formspec
.."container_end[]"
-- .."container[5,0.5]"
@ -277,7 +277,7 @@ local puzzle_seal_def = {
ensure_meta(pos)
refresh_formspec(pos, clicker)
end,
on_timer = function(pos, elapsed)
on_timer = function(pos, elapsed)
local meta = minetest.get_meta(pos)
local unlocked = meta:get_int("unlocked")
if unlocked > 0 then
@ -352,7 +352,7 @@ local digging_seal_def = {
gain = 1.0,
max_hear_distance = 32,
})
local minpos = vector.add(pos, {x=0, y=-1, z=0})
minetest.add_particlespawner({
amount = 100,
@ -372,7 +372,7 @@ local digging_seal_def = {
collision_removal = true,
glow = 15,
})
if minetest.get_item_group(below_node.name, "slade") == 0 then
if df_underworld_items.config.enable_slade_drill then
minetest.set_node(pos, {name="air"})
@ -385,7 +385,7 @@ local digging_seal_def = {
end
return
end
local rot = node.param2
if rot == 0 then
minetest.place_schematic({x=pos.x-3, y=pos.y-2, z=pos.z-3}, df_underworld_items.seal_stair_schem, 0, {}, true)
@ -420,7 +420,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname:sub(1,prefix_len) ~= formspec_prefix or not fields.open then
return
end
local pos_string = formname:sub(prefix_len+1)
local pos_string = formname:sub(prefix_len+1)
local pos = minetest.string_to_pos(pos_string)
if test_key(pos) then
if named_waypoints_path then
@ -525,7 +525,7 @@ df_dependencies.register_stairs("slade_block")
if invulnerable then
for name, def in pairs(minetest.registered_nodes) do
if (name:sub(1,7) == "stairs:" and name:sub(-11) == "slade_block") or
if (name:sub(1,7) == "stairs:" and name:sub(-11) == "slade_block") or
name:sub(1,11) == "mcl_stairs:" and name:sub(-11) == "slade_block" then
minetest.override_item(name, {can_dig = can_dig})
end
@ -540,7 +540,7 @@ if df_dependencies.node_name_stair_slade_block then
n11 = { name = df_dependencies.node_name_slab_slade_block, param2 = 1 }
n10 = { name = df_dependencies.node_name_slab_slade_block, param2 = 21 }
if df_dependencies.node_name_slab_slade_block_top then
if df_dependencies.node_name_slab_slade_block_top then
-- Mineclone slabs don't support full rotation, this is how to flip them over
n10.name = df_dependencies.node_name_slab_slade_block_top
n10.param2 = 1
@ -551,35 +551,35 @@ end
df_underworld_items.seal_temple_schem = {
size = {y = 6, x = 7, z = 7},
data = {
n15, n2, n3, n3, n3, n4, n14, n14, n3, n3, n3, n3, n3, n15, n13, n3, n3,
n3, n3, n3, n13, n16, n3, n3, n3, n3, n3, n16, n6, n6, n6, n6, n6, n6,
n6, n6, n6, n6, n6, n6, n6, n6, n7, n3, n3, n3, n3, n3, n7, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n3, n6, n3, n3, n3, n3, n3, n6, n6, n6, n6, n6, n6, n6, n6, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n6, n3, n3, n3, n3, n3, n6,
n6, n6, n3, n3, n3, n6, n6, n3, n3, n3, n8, n3, n3, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n6, n3, n3, n3, n3, n3, n6, n6, n6, n3, n3, n3, n6, n6, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n6, n3, n3, n3, n3, n3, n6, n6,
n6, n3, n3, n3, n6, n6, n9, n3, n3, n3, n3, n3, n9, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n6, n3, n3, n3, n3, n3, n6, n6, n6, n6, n6, n6, n6, n6, n12, n2, n3,
n3, n3, n4, n12, n14, n3, n3, n3, n3, n3, n15, n13, n3, n3, n3, n3, n3,
n12, n16, n3, n3, n3, n3, n3, n16, n6, n6, n6, n6, n6, n6, n6, n6, n6,
n6, n6, n6, n6, n6,
n15, n2, n3, n3, n3, n4, n14, n14, n3, n3, n3, n3, n3, n15, n13, n3, n3,
n3, n3, n3, n13, n16, n3, n3, n3, n3, n3, n16, n6, n6, n6, n6, n6, n6,
n6, n6, n6, n6, n6, n6, n6, n6, n7, n3, n3, n3, n3, n3, n7, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n3, n6, n3, n3, n3, n3, n3, n6, n6, n6, n6, n6, n6, n6, n6, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n6, n3, n3, n3, n3, n3, n6,
n6, n6, n3, n3, n3, n6, n6, n3, n3, n3, n8, n3, n3, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n6, n3, n3, n3, n3, n3, n6, n6, n6, n3, n3, n3, n6, n6, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n6, n3, n3, n3, n3, n3, n6, n6,
n6, n3, n3, n3, n6, n6, n9, n3, n3, n3, n3, n3, n9, n3, n3, n3, n3,
n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3, n3,
n6, n3, n3, n3, n3, n3, n6, n6, n6, n6, n6, n6, n6, n6, n12, n2, n3,
n3, n3, n4, n12, n14, n3, n3, n3, n3, n3, n15, n13, n3, n3, n3, n3, n3,
n12, n16, n3, n3, n3, n3, n3, n16, n6, n6, n6, n6, n6, n6, n6, n6, n6,
n6, n6, n6, n6, n6,
}
}
df_underworld_items.seal_stair_schem = {
size = {y = 2, x = 7, z = 7},
data = {
n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n10,
n3, n3, n3, n1, n1, n3, n11, n1, n10, n3, n1, n1, n11, n3, n3, n3, n3,
n1, n1, n3, n3, n3, n3, n3, n1, n1, n3, n3, n3, n3, n3, n1, n1, n3,
n3, n3, n3, n3, n1, n1, n3, n3, n3, n3, n3, n1, n1, n3, n3, n3, n3,
n3, n1, n1, n3, n3, n3, n3, n3, n1, n1, n3, n3, n3, n3, n3, n1, n1,
n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1,
n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n10,
n3, n3, n3, n1, n1, n3, n11, n1, n10, n3, n1, n1, n11, n3, n3, n3, n3,
n1, n1, n3, n3, n3, n3, n3, n1, n1, n3, n3, n3, n3, n3, n1, n1, n3,
n3, n3, n3, n3, n1, n1, n3, n3, n3, n3, n3, n1, n1, n3, n3, n3, n3,
n3, n1, n1, n3, n3, n3, n3, n3, n1, n1, n3, n3, n3, n3, n3, n1, n1,
n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1,
}
}

View File

@ -171,9 +171,9 @@ df_dependencies.register_stairs("slade_brick")
if invulnerable then
for name, def in pairs(minetest.registered_nodes) do
if (name:sub(1,7) == "stairs:" and name:sub(-11) == "slade_block") or
if (name:sub(1,7) == "stairs:" and name:sub(-11) == "slade_block") or
name:sub(1,11) == "mcl_stairs:" and name:sub(-11) == "slade_brick" then
minetest.override_item(name, {can_dig = server_diggable_only})
minetest.override_item(name, {can_dig = server_diggable_only})
end
end
end

View File

@ -57,7 +57,7 @@ local slade_drill_def = {
drill_particles(pointed_thing.above)
return itemstack
end
end
end
end,
}