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

@ -143,7 +143,7 @@ awards.register_achievement("dfcaverns_plant_all_farmables", {
.."^[combine:32x32:16,0=dfcaverns_dimple_cup_4.png"
.."^[combine:32x32:8,8=dfcaverns_plump_helmet_achievement.png"
.."^[combine:32x32:0,16=dfcaverns_sweet_pod_6.png"
.."^[combine:32x32:16,16=dfcaverns_quarry_bush_5.png"
.."^[combine:32x32:16,16=dfcaverns_quarry_bush_5.png"
.."^[combine:32x32:16,15="..hoe_texture.."^dfcaverns_awards_foregroundx32.png",
difficulty = 1 / df_achievements.get_child_achievement_count("dfcaverns_plant_all_farmables"),
trigger = {

View File

@ -6,7 +6,7 @@ for itemname, def in pairs(minetest.registered_items) do
local meal_name = string.sub(itemname, 12, -1)
local meal_desc = def.description
local image = string.sub(def.inventory_image, 1, -7) .. "32.png"
awards.register_achievement("dfcaverns_meal_"..meal_name, {
title = S("Eat @1", meal_desc),
description = S("One of the many delights that can be crafted only from fungal growths found deep underground."),

View File

@ -14,7 +14,7 @@ if awards.run_trigger_callbacks then
-- this "run_trigger_callbacks" API call is present in those older versions, so using that
-- as a fingerprint to discover them
old_awards_version = true
minetest.register_on_dignode(function(pos, oldnode, digger)
-- the old version of awards doesn't handle groups when triggering dug nodes, use this to hack around that
local node_name = oldnode.name
@ -23,7 +23,7 @@ if awards.run_trigger_callbacks then
elseif minetest.get_item_group(node_name, "dfcaverns_cave_coral") > 0 then
awards.unlock(digger:get_player_name(), "dfcaverns_cave_coral")
end
end)
end)
else
-- used to track the progress of achievements that are based off of other achievements
awards.register_trigger("dfcaverns_achievements", {
@ -69,10 +69,10 @@ awards.register_on_unlock(function(player_name, def)
local def_dfcaverns_achievements = def._dfcaverns_achievements
if not def_dfcaverns_achievements then return end
local player_awards = awards.player(player_name)
if not player_awards then return end
if not player_awards then return end
local unlocked = player_awards.unlocked
if not unlocked then return end
-- the achievement that just got unlocked had one or more "parent" achievements associated with it.
for _, achievement_parent in pairs(def_dfcaverns_achievements) do
player_awards.dfcaverns_achievements = player_awards.dfcaverns_achievements or {}
@ -86,7 +86,7 @@ awards.register_on_unlock(function(player_name, def)
awards.save()
if count >= total then
minetest.after(4, awards.unlock, player_name, achievement_parent)
end
end
end
end)

View File

@ -44,14 +44,14 @@ if minetest.get_modpath("df_underworld_items") then
df_underworld_items.puzzle_seal_solved = function(pos, player)
if player == nil then return end
awards.unlock(player:get_player_name(), "dfcaverns_solved_puzzle_seal")
end
end
awards.register_achievement("dfcaverns_solved_puzzle_seal", {
title = S("Solve a Puzzle Seal"),
difficulty = 4,
description = S("Decipher the code of the ancients. Do you dare turn the key?"),
icon = "dfcaverns_puzzle_seal_solvedx32.png^dfcaverns_awards_foregroundx32.png",
})
df_underworld_items.slade_breacher_triggered = function(pos, player)
awards.unlock(player:get_player_name(), "dfcaverns_triggered_slade_breacher")
end
@ -62,7 +62,7 @@ if minetest.get_modpath("df_underworld_items") then
icon = "dfcaverns_puzzle_seal_activex32.png^dfcaverns_awards_foregroundx32.png",
secret=true,
})
df_underworld_items.ancient_lantern_fixed = function(pos, player)
awards.unlock(player:get_player_name(), "dfcaverns_repaired_lantern")
end
@ -85,7 +85,7 @@ end
if minetest.get_modpath("df_lorebooks") then
collectible_lore.register_on_collected(function(player_name, id, state, collected)
local count = 0
for id, val in pairs(collected) do
for _id, val in pairs(collected) do
if val then count = count + 1 end
end
if count >= #(collectible_lore.lorebooks) then

View File

@ -29,12 +29,12 @@ local get_player_data = function(player)
-- get head level node at player position
local pos = player:get_pos()
if not pos then return end
-- get all set nodes around player
local ps, cn = minetest.find_nodes_in_area(
{x = pos.x - radius, y = pos.y - radius, z = pos.z - radius},
{x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, all_nodes)
return {
pos = pos,
biome = df_caverns.get_biome(pos) or "",
@ -69,7 +69,7 @@ minetest.register_globalstep(function(dtime)
player_name = player:get_player_name()
player_awards = awards.player(player_name)
unlocked = player_awards.unlocked or {}
if unlocked["dfcaverns_visit_all_caverns"] ~= "dfcaverns_visit_all_caverns" or
unlocked["dfcaverns_visit_glowing_pit"] ~= "dfcaverns_visit_glowing_pit" then
player_data = get_player_data(player)
@ -95,7 +95,7 @@ minetest.register_globalstep(function(dtime)
(biome == "fungispore" and (
check_nodes(node_types.fungiwood, totals) or
check_nodes(node_types.sporetree, totals)))
or
or
(biome == "towergoblin" and (
check_nodes(node_types.towercap, totals) or
check_nodes(node_types.goblincap, totals)))
@ -104,7 +104,7 @@ minetest.register_globalstep(function(dtime)
then
awards.unlock(player_name, "dfcaverns_visit_sunless_sea")
elseif biome == "oil_sea" and (totals["oil:oil_source"] or 0) > 1 then
awards.unlock(player_name, "dfcaverns_visit_oil_sea")
awards.unlock(player_name, "dfcaverns_visit_oil_sea")
elseif biome == "underworld" then
if (totals["df_underworld_items:slade"] or 0) > 1 then
awards.unlock(player_name, "dfcaverns_visit_underworld")
@ -116,10 +116,10 @@ minetest.register_globalstep(function(dtime)
pit.location.y = player_pos.y
if vector.distance(player_pos, pit.location) <= pit.radius+10 then
awards.unlock(player_name, "dfcaverns_visit_glowing_pit")
end
end
end
elseif biome == "lava_sea" and (totals[lava_node] or 0) > 1 then
awards.unlock(player_name, "dfcaverns_visit_lava_sea")
awards.unlock(player_name, "dfcaverns_visit_lava_sea")
elseif biome == "primordial fungus" and check_nodes(node_types.primordial_fungus, totals) then
awards.unlock(player_name, "dfcaverns_visit_primordial_fungal")
elseif biome == "primordial jungle" and check_nodes(node_types.primordial_jungle, totals) then
@ -138,7 +138,7 @@ minetest.register_globalstep(function(dtime)
if pos_y >= nearest_pit.depth and pos_y <= nearest_pit.top and vector.distance(pos, nearest_pit.location) <= 20 then
awards.unlock(player_name, "dfcaverns_visit_pit")
end
end
end
end
end
end)