Fix a bunch of deprecation warnings

This commit is contained in:
a-bad-dev 2026-01-22 20:21:43 -04:00
commit 9ebc01bf29
7 changed files with 34 additions and 31 deletions

View file

@ -1,3 +1,3 @@
min_minetest_version = 5.9.0
name = Simple Shooter Game
title = Simple Shooter Game
allowed_mapgens = singlenode

View file

@ -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", {})

View file

@ -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 },

View file

@ -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)

View file

@ -1 +0,0 @@
hudbars?

View file

@ -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,

View file

@ -0,0 +1,2 @@
name = sprint
description = Slightly improved version of GunshipPenguin's sprint mod