From 9ebc01bf29eafb3fafc8f39fc7a8adca001a56c3 Mon Sep 17 00:00:00 2001 From: a-bad-dev <244852891+a-bad-dev@users.noreply.github.com> Date: Thu, 22 Jan 2026 20:21:43 -0400 Subject: [PATCH] Fix a bunch of deprecation warnings --- game.conf | 2 +- mods/game/functions/init.lua | 2 +- .../ctf_guns/ctf_ranged/custom_controls.lua | 2 +- mods/misc/playertag/init.lua | 46 ++++++++++--------- mods/misc/sprint/depends.txt | 1 - mods/misc/sprint/esprint.lua | 8 ++-- mods/misc/sprint/mod.conf | 2 + 7 files changed, 33 insertions(+), 30 deletions(-) delete mode 100644 mods/misc/sprint/depends.txt create mode 100644 mods/misc/sprint/mod.conf diff --git a/game.conf b/game.conf index 845d60f..a4bda63 100644 --- a/game.conf +++ b/game.conf @@ -1,3 +1,3 @@ min_minetest_version = 5.9.0 -name = Simple Shooter Game +title = Simple Shooter Game allowed_mapgens = singlenode diff --git a/mods/game/functions/init.lua b/mods/game/functions/init.lua index 0c5113a..dc426f7 100644 --- a/mods/game/functions/init.lua +++ b/mods/game/functions/init.lua @@ -148,7 +148,7 @@ function start_match(map) -- Start the match for _, player in pairs(core.get_connected_players()) do local player_name = player:get_player_name() - inv = player:get_inventory() + local inv = player:get_inventory() inv:set_list("main", {}) diff --git a/mods/misc/ctf_guns/ctf_ranged/custom_controls.lua b/mods/misc/ctf_guns/ctf_ranged/custom_controls.lua index 2b0d71c..5f7be02 100644 --- a/mods/misc/ctf_guns/ctf_ranged/custom_controls.lua +++ b/mods/misc/ctf_guns/ctf_ranged/custom_controls.lua @@ -50,7 +50,7 @@ end) minetest.register_on_joinplayer(function(player) player_scope_huds[player:get_player_name()] = player:hud_add({ - hud_elem_type = "image", + type = "image", alignment = { x=0.0, y=0.0 }, position = {x = 0.5, y = 0.5}, scale = { x=2, y=2 }, diff --git a/mods/misc/playertag/init.lua b/mods/misc/playertag/init.lua index 3c06f3c..829d0cc 100644 --- a/mods/misc/playertag/init.lua +++ b/mods/misc/playertag/init.lua @@ -130,7 +130,7 @@ local function update(player, settings) if settings.type == TYPE_BUILTIN then player:set_nametag_attributes({ - color = settings.color or {a=255, r=255, g=255, b=255}, + color = {a=settings.color.a or 255, r=settings.color.r or 255, g=settings.color.g or 255, b=settings.color.b or 255}, bgcolor = {a=0, r=0, g=0, b=0}, }) elseif settings.type == TYPE_ENTITY then @@ -162,30 +162,32 @@ function playertag.get_all() end minetest.register_entity("playertag:tag", { - visual = "sprite", - visual_size = {x=2.16, y=0.18, z=2.16}, --{x=1.44, y=0.12, z=1.44}, - textures = {"blank.png"}, - collisionbox = { 0, -0.2, 0, 0, -0.2, 0 }, - physical = false, - makes_footstep_sound = false, - backface_culling = false, - static_save = false, - pointable = false, - on_punch = function() return true end, - on_deactivate = function(self, removal) - if not removal then - local attachmentInfo = self.object:get_attach() - local player = nil - if attachmentInfo then - player = attachmentInfo.parent - end + initial_properties = { + visual = "sprite", + visual_size = {x=2.16, y=0.18, z=2.16}, --{x=1.44, y=0.12, z=1.44}, + textures = {"blank.png"}, + collisionbox = { 0, -0.2, 0, 0, -0.2, 0 }, + physical = false, + makes_footstep_sound = false, + backface_culling = false, + static_save = false, + pointable = false, + on_punch = function() return true end, + on_deactivate = function(self, removal) + if not removal then + local attachmentInfo = self.object:get_attach() + local player = nil + if attachmentInfo then + player = attachmentInfo.parent + end - if player and player:is_player() then - minetest.log("action", "Playertag for player "..player:get_player_name().." unloaded. Re-adding...") - update(player, players[player:get_player_name()]) + if player and player:is_player() then + minetest.log("action", "Playertag for player "..player:get_player_name().." unloaded. Re-adding...") + update(player, players[player:get_player_name()]) + end end end - end + } }) minetest.register_on_joinplayer(function(player) diff --git a/mods/misc/sprint/depends.txt b/mods/misc/sprint/depends.txt deleted file mode 100644 index 3e1d5c2..0000000 --- a/mods/misc/sprint/depends.txt +++ /dev/null @@ -1 +0,0 @@ -hudbars? diff --git a/mods/misc/sprint/esprint.lua b/mods/misc/sprint/esprint.lua index 87797ec..861b9c1 100644 --- a/mods/misc/sprint/esprint.lua +++ b/mods/misc/sprint/esprint.lua @@ -37,7 +37,7 @@ minetest.register_on_joinplayer(function(player) hb.init_hudbar(player, "sprint") else players[playerName].hud = player:hud_add({ - hud_elem_type = "statbar", + type = "statbar", position = {x=0.5,y=1}, size = {x=24, y=24}, text = "sprint_stamina_icon.png", @@ -70,14 +70,14 @@ minetest.register_globalstep(function(dtime) --If the player is sprinting, create particles behind him/her if playerInfo["sprinting"] == true and gameTime % 0.1 == 0 then local numParticles = math.random(1, 2) - local playerPos = player:getpos() + local playerPos = player:get_pos() local playerNode = minetest.get_node({x=playerPos["x"], y=playerPos["y"]-1, z=playerPos["z"]}) if playerNode["name"] ~= "air" then for i=1, numParticles, 1 do minetest.add_particle({ pos = {x=playerPos["x"]+math.random(-1,1)*math.random()/2,y=playerPos["y"]+0.1,z=playerPos["z"]+math.random(-1,1)*math.random()/2}, - vel = {x=0, y=5, z=0}, - acc = {x=0, y=-13, z=0}, + velocity = {x=0, y=5, z=0}, + acceleration = {x=0, y=-13, z=0}, expirationtime = math.random(), size = math.random()+0.5, collisiondetection = true, diff --git a/mods/misc/sprint/mod.conf b/mods/misc/sprint/mod.conf new file mode 100644 index 0000000..3e3c1a2 --- /dev/null +++ b/mods/misc/sprint/mod.conf @@ -0,0 +1,2 @@ +name = sprint +description = Slightly improved version of GunshipPenguin's sprint mod \ No newline at end of file