Skip to content

Commit

Permalink
Play w/ stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklp09 committed May 9, 2024
1 parent 8679617 commit 60aa85e
Show file tree
Hide file tree
Showing 78 changed files with 1,711 additions and 679 deletions.
1 change: 1 addition & 0 deletions archtec/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ dofile(path .. "perf_logging.lua")
dofile(path .. "playtime.lua")
dofile(path .. "msg_offline.lua")
dofile(path .. "mailbox.lua")
dofile(path .. "creative_inv.lua")

local http = minetest.request_http_api()
if http then
Expand Down
2 changes: 1 addition & 1 deletion archtec/scripts/aliases.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ minetest.register_alias("feldweg:feldweg_t_junction", "cottages:feldweg_t_juncti
minetest.register_alias("rhotator:screwdriver", "omnidriver:omnidriver")
minetest.register_alias("rhotator:screwdriver_alt", "omnidriver:omnidriver")
minetest.register_alias("rhotator:screwdriver_multi", "omnidriver:omnidriver")
minetest.register_alias("rhotator:memory", "omnidriver:omnidriver")
minetest.register_alias("rhotator:memory", "omnidriver:omnidriver")
16 changes: 13 additions & 3 deletions archtec/scripts/buckets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ local function try_grant_priv(name)
local playtime = archtec_playerdata.get(name, "playtime")
if playtime > archtec.adv_buckets_playtime then
archtec.priv_grant(name, "adv_buckets")
minetest.chat_send_player(name, minetest.colorize("#00BD00", S("Congratulations! You have been granted the '@1' privilege.", "adv_buckets")))
minetest.chat_send_player(
name,
minetest.colorize("#00BD00", S("Congratulations! You have been granted the '@1' privilege.", "adv_buckets"))
)
archtec.notify_team("[adv_buckets] Granted '" .. name .. "' the 'adv_buckets' priv")
return true
else
minetest.chat_send_player(name, minetest.colorize("#FF0000", S("You don't have @1 hours (or more) playtime.", archtec.adv_buckets_playtime)))
minetest.chat_send_player(
name,
minetest.colorize("#FF0000", S("You don't have @1 hours (or more) playtime.", archtec.adv_buckets_playtime))
)
return false
end
end
Expand Down Expand Up @@ -46,7 +52,11 @@ end

minetest.register_on_mods_loaded(function()
for name, def in pairs(minetest.registered_nodes) do
if def.drawtype and (def.drawtype == "liquid" or def.drawtype == "flowingliquid") and minetest.get_item_group(name, "liquid_blacklist") == 0 then
if
def.drawtype
and (def.drawtype == "liquid" or def.drawtype == "flowingliquid")
and minetest.get_item_group(name, "liquid_blacklist") == 0
then
table.insert(liquid_list, name)
end
end
Expand Down
40 changes: 30 additions & 10 deletions archtec/scripts/chainsaw.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
if not minetest.get_modpath("choppy") then return end
if not minetest.get_modpath("choppy") then
return
end

local S = archtec.S
local api = choppy.api
Expand All @@ -8,7 +10,9 @@ local days_played = archtec.time.days(7)
minetest.register_privilege("archtec_chainsaw", S("Allows you to use the chainsaw"))

-- disable is_enabled() since we don't use the initialized function
choppy.api.is_enabled = function(...) return true end
choppy.api.is_enabled = function(...)
return true
end

local function conditions(name)
local playtime = archtec_playerdata.get(name, "playtime")
Expand All @@ -25,7 +29,13 @@ archtec.chainsaw_conditions = conditions

local function grant_priv(name, priv)
archtec.priv_grant(name, priv)
minetest.chat_send_player(name, minetest.colorize("#00BD00", S("Congratulations! You have been granted the '@1' privilege.", "archtec_chainsaw")))
minetest.chat_send_player(
name,
minetest.colorize(
"#00BD00",
S("Congratulations! You have been granted the '@1' privilege.", "archtec_chainsaw")
)
)
archtec.notify_team("[chainsaw] Granted '" .. name .. "' the 'archtec_chainsaw' priv")
end

Expand All @@ -47,7 +57,15 @@ minetest.register_tool(":technic:chainsaw", {
if conditions(name) then
grant_priv(name, "archtec_chainsaw")
else
minetest.chat_send_player(name, minetest.colorize("#FF0000", S("[chainsaw] You don't satisfy all conditions to use a chainsaw. Needed conditions: 20k nodes dug, 10k nodes placed, 24h playtime, 7 days or older account!")))
minetest.chat_send_player(
name,
minetest.colorize(
"#FF0000",
S(
"[chainsaw] You don't satisfy all conditions to use a chainsaw. Needed conditions: 20k nodes dug, 10k nodes placed, 24h playtime, 7 days or older account!"
)
)
)
return
end
end
Expand Down Expand Up @@ -90,22 +108,24 @@ minetest.register_craft({
{"default:steel_ingot", "default:mese_crystal_fragment", "default:diamond"},
{"basic_materials:copper_wire", "basic_materials:motor", "default:diamond"},
{"", "dye:red", "default:steel_ingot"},
}
},
})

minetest.register_craft({
output = "technic:chainsaw",
recipe = {
{"techage:ta3_canister_gasoline", "technic:chainsaw"}
{"techage:ta3_canister_gasoline", "technic:chainsaw"},
},
replacements = {{"techage:ta3_canister_gasoline", "techage:ta3_canister_empty"}}
replacements = {{"techage:ta3_canister_gasoline", "techage:ta3_canister_empty"}},
})

minetest.register_craft({
type = "shapeless",
output = "technic:chainsaw",
recipe = {
"biofuel:fuel_can", "technic:chainsaw",
"biofuel:fuel_can", "biofuel:fuel_can",
}
"biofuel:fuel_can",
"technic:chainsaw",
"biofuel:fuel_can",
"biofuel:fuel_can",
},
})
33 changes: 28 additions & 5 deletions archtec/scripts/cheat_log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ end

-- https://stackoverflow.com/a/50082540
local function short(number, decimals)
local power = 10^decimals
local power = 10 ^ decimals
return math.floor(number * power) / power
end

Expand Down Expand Up @@ -35,16 +35,39 @@ local function handle_cheat(player, cheat)
pos[i] = round(x)
end
local info = get_pd(name)
archtec.notify_team("[archtec] Anticheat: player '" .. name .. "' ('" .. cheat.type .. "') speed: " .. tostring(speed) .. " pos: " .. tostring(pos) .. " lag: " .. lag .. " jitter: " .. short(info.avg_jitter, 7) .. " rtt: " .. short(info.avg_rtt, 5), false)
archtec.notify_team(
"[archtec] Anticheat: player '"
.. name
.. "' ('"
.. cheat.type
.. "') speed: "
.. tostring(speed)
.. " pos: "
.. tostring(pos)
.. " lag: "
.. lag
.. " jitter: "
.. short(info.avg_jitter, 7)
.. " rtt: "
.. short(info.avg_rtt, 5),
false
)
end

minetest.register_on_cheat(function(player, cheat)
if not player:is_player() then return end
if cheat.type == "dug_unbreakable" or cheat.type == "finished_unknown_dig" then return end
if not player:is_player() then
return
end
if cheat.type == "dug_unbreakable" or cheat.type == "finished_unknown_dig" then
return
end
if cheat.type == "moved_too_fast" then
handle_cheat(player, cheat)
else
archtec.notify_team("[archtec] Anticheat: player '" .. player:get_player_name() .. "' ('" .. cheat.type .. "')", false)
archtec.notify_team(
"[archtec] Anticheat: player '" .. player:get_player_name() .. "' ('" .. cheat.type .. "')",
false
)
end
end)

Expand Down
6 changes: 3 additions & 3 deletions archtec/scripts/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ end
local f = math.floor

function archtec.get_block_bounds(pos)
local p1 = vector.new((f(pos.x/16))*16,(f(pos.y/16))*16,(f(pos.z/16))*16)
local p2 = vector.new((f(pos.x/16))*16+15,(f(pos.y/16))*16+15,(f(pos.z/16))*16+15)
local p1 = vector.new((f(pos.x / 16)) * 16, (f(pos.y / 16)) * 16, (f(pos.z / 16)) * 16)
local p2 = vector.new((f(pos.x / 16)) * 16 + 15, (f(pos.y / 16)) * 16 + 15, (f(pos.z / 16)) * 16 + 15)
return p1, p2
end

Expand Down Expand Up @@ -141,4 +141,4 @@ function archtec.physics_locked(player)
return true
end
return false
end
end
2 changes: 1 addition & 1 deletion archtec/scripts/count_objects.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ minetest.register_chatcommand("count_objects", {
func = function(name)
minetest.log("action", "[/count_objects] executed by '" .. name .. "'")
minetest.chat_send_player(name, count_object())
end
end,
})
46 changes: 23 additions & 23 deletions archtec/scripts/crafting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ local function fix_craft(node, recipedef, amount)
end

minetest.clear_craft({
output = node
output = node,
})

minetest.register_craft({
output = node .. " " .. amount,
recipe = recipedef
recipe = recipedef,
})

minetest.log("action", "[archtec] changed recipe of '" .. node .. "'")
Expand All @@ -28,67 +28,67 @@ end
fix_craft("pride_flags:lower_mast", {
{"default:steel_ingot", "farming:string"},
{"default:steel_ingot", "farming:string"},
{"default:steel_ingot", "farming:string"}
{"default:steel_ingot", "farming:string"},
})

-- homedecor:table/ts_furniture:default_WOODTYPE_small_table
fix_craft("homedecor:table", {
{ "group:wood","group:wood", "group:wood" },
{ "group:stick", "", "group:stick" },
{ "", "group:stick", "" }
{"group:wood", "group:wood", "group:wood"},
{"group:stick", "", "group:stick"},
{"", "group:stick", ""},
})

-- jonez palace windows had the same recipe
fix_craft("xpanes:palace_window_top_flat", {
{"xpanes:pane_flat", "xpanes:pane_flat", "xpanes:pane_flat"},
{"xpanes:pane_flat", "", "xpanes:pane_flat"}
{"xpanes:pane_flat", "", "xpanes:pane_flat"},
})

-- jonez palace windows had the same recipe
fix_craft("xpanes:palace_window_bottom_flat", {
{"xpanes:pane_flat", "", "xpanes:pane_flat"},
{"xpanes:pane_flat", "xpanes:pane_flat", "xpanes:pane_flat"}
{"xpanes:pane_flat", "xpanes:pane_flat", "xpanes:pane_flat"},
})

-- xdecor:pressure_stone_off/mesecons_pressureplates:pressure_plate_stone_off
fix_craft("xdecor:pressure_stone_off", {
{"xdecor:stone_tile", "xdecor:stone_tile"}
{"xdecor:stone_tile", "xdecor:stone_tile"},
})

-- xdecor:pressure_wood_off/mesecons_pressureplates:pressure_plate_wood_off
fix_craft("xdecor:pressure_wood_off", {
{"xdecor:wood_tile", "xdecor:wood_tile"}
{"xdecor:wood_tile", "xdecor:wood_tile"},
})

-- xdecor:tatami/homedecor:tatami_mat
fix_craft("xdecor:tatami", {
{"farming:wheat", "farming:wheat", "farming:wheat"},
{"", "farming:wheat", ""}
{"", "farming:wheat", ""},
})

-- xdecor:bowl/farming:bowl
fix_craft("xdecor:bowl", {
{"xdecor:wood_tile", "", "xdecor:wood_tile"},
{"", "xdecor:wood_tile", ""}
{"", "xdecor:wood_tile", ""},
})

-- xpanes:wrought_lattice_bottom_flat/jonez:wrought_lattice_top (https://github.com/Archtec-io/bugtracker/issues/166)
fix_craft("jonez:wrought_lattice_top", {
{"", "default:tin_ingot", ""},
{"default:steel_ingot", "default:tin_ingot", "default:steel_ingot"}
{"default:steel_ingot", "default:tin_ingot", "default:steel_ingot"},
}, 16)

if minetest.get_modpath("ethereal") then
minetest.register_craft({
output = "ethereal:bowl",
type = "shapeless",
recipe = {"farming:bowl"}
recipe = {"farming:bowl"},
})

minetest.register_craft({
output = "farming:bowl",
type = "shapeless",
recipe = {"ethereal:bowl"}
recipe = {"ethereal:bowl"},
})
end

Expand All @@ -110,8 +110,8 @@ if minetest.get_modpath("homedecor_lighting") then
neutral_node = "homedecor:table_lamp_14",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
"MAIN_DYE",
},
})

minetest.register_craft({
Expand All @@ -130,21 +130,21 @@ if minetest.get_modpath("homedecor_lighting") then
neutral_node = "homedecor:standing_lamp_14",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
"MAIN_DYE",
},
})
end

-- https://github.com/Archtec-io/bugtracker/issues/58 (small hack)
minetest.register_craft({
output = "farming:wheat 3",
recipe = {{"farming:straw"}}
recipe = {{"farming:straw"}},
})

-- https://github.com/Archtec-io/bugtracker/issues/181 (next straw hack)
minetest.register_craft({
output = "farming:straw",
recipe = {{"castle_farming:bound_straw"}}
recipe = {{"castle_farming:bound_straw"}},
})

-- default:dry_dirt + group:water_bucket -> default:dirt (https://github.com/Archtec-io/bugtracker/issues/139)
Expand All @@ -155,5 +155,5 @@ minetest.register_craft({
"group:water_bucket",
"default:dry_dirt",
},
replacements = {{"group:water_bucket", "bucket:bucket_empty"}}
})
replacements = {{"group:water_bucket", "bucket:bucket_empty"}},
})
Loading

0 comments on commit 60aa85e

Please sign in to comment.