Merge branch 'main' into main

This commit is contained in:
IonicCheese 2026-02-19 20:09:06 -08:00 committed by GitHub
commit cdeeca752a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 37 additions and 36 deletions

View file

@ -12,7 +12,7 @@ core.register_chatcommand("start", {
if match_state == "pre_match" or match_state == "post_match" or match_state == "in_progress" then if match_state == "pre_match" or match_state == "post_match" or match_state == "in_progress" then
return false, "-!- Match is already in progress!" return false, "-!- Match is already in progress!"
end end
local sucess = start_match(param) local sucess = start_match(param)
if not map_data then if not map_data then

View file

@ -39,7 +39,7 @@ function give_player_items(player) -- Give the player their initial stuff
for i = 1, #map_data.classes.class_2.initial_items do for i = 1, #map_data.classes.class_2.initial_items do
inv:add_item("main", map_data.classes.class_2.initial_items[i]) inv:add_item("main", map_data.classes.class_2.initial_items[i])
end end
elseif class == "3" then elseif class == "3" then
for i = 1, #map_data.classes.class_3.initial_items do for i = 1, #map_data.classes.class_3.initial_items do
inv:add_item("main", map_data.classes.class_3.initial_items[i]) inv:add_item("main", map_data.classes.class_3.initial_items[i])
@ -64,17 +64,18 @@ function set_player_mode(player, mode) -- Set player mode (spectator, pre-match,
playertag.set(player, playertag.TYPE_ENTITY, {a = 255, r = 255, g = 255, b = 255}) playertag.set(player, playertag.TYPE_ENTITY, {a = 255, r = 255, g = 255, b = 255})
player:set_inventory_formspec([[ player:set_inventory_formspec([[
size[8,4] size[8,4]
list[current_player;main;0,0;8,1;] list[current_player;main;0,0;8,1;]
list[current_player;main;0,1.25;8,3;8] list[current_player;main;0,1.25;8,3;8]
listring[current_player;main] listring[current_player;main]
]]) ]])
player:hud_set_flags({ player:hud_set_flags({
hotbar = true, hotbar = true,
healthbar = true, healthbar = true,
breathbar = true, breathbar = true,
}) })
elseif mode == "spectator" then elseif mode == "spectator" then
privs.noclip, privs.fast, privs.fly, privs.interact, privs.debug = true, true, true, false, true privs.noclip, privs.fast, privs.fly, privs.interact, privs.debug = true, true, true, false, true
@ -83,10 +84,10 @@ function set_player_mode(player, mode) -- Set player mode (spectator, pre-match,
core.chat_send_player(player_name, core.colorize("#0574fc", "You are now a spectator.")) core.chat_send_player(player_name, core.colorize("#0574fc", "You are now a spectator."))
player:set_inventory_formspec([[ player:set_inventory_formspec([[
size[8,4] size[8,4]
list[current_player;main;0,0;8,1;] list[current_player;main;0,0;8,1;]
list[current_player;main;0,1.25;8,3;8] list[current_player;main;0,1.25;8,3;8]
listring[current_player;main] listring[current_player;main]
]]) ]])
player:hud_set_flags({ player:hud_set_flags({
@ -101,17 +102,17 @@ function set_player_mode(player, mode) -- Set player mode (spectator, pre-match,
make_player_invisible(player) make_player_invisible(player)
player:set_inventory_formspec([[ player:set_inventory_formspec([[
size[8,6] size[8,6]
label[3,0.1;Change class:] label[3,0.1;Change class:]
button[0.3,1;2.5,1;class_sniper;]] .. map_data.classes.class_1.name .. [[] button[0.3,1;2.5,1;class_sniper;]] .. map_data.classes.class_1.name .. [[]
button[2.8,1;2.5,1;class_assault;]] .. map_data.classes.class_2.name .. [[] button[2.8,1;2.5,1;class_assault;]] .. map_data.classes.class_2.name .. [[]
button[5.3,1;2.5,1;class_shotgun;]] .. map_data.classes.class_3.name .. [[] button[5.3,1;2.5,1;class_shotgun;]] .. map_data.classes.class_3.name .. [[]
list[current_player;main;0,2;8,1;] list[current_player;main;0,2;8,1;]
list[current_player;main;0,3.25;8,3;8] list[current_player;main;0,3.25;8,3;8]
listring[current_player;main] listring[current_player;main]
]]) ]])
player:hud_set_flags({ player:hud_set_flags({
@ -164,7 +165,7 @@ function start_match(map) -- Start the match
player:set_hp(20) player:set_hp(20)
end end
core.after(3, function() core.after(3, function()
set_match_state("pre_match") set_match_state("pre_match")
@ -193,7 +194,7 @@ function start_match(map) -- Start the match
match_start_jobs = nil match_start_jobs = nil
set_match_state("in_progress") set_match_state("in_progress")
core.chat_send_all(core.colorize("green", "Match started!")) core.chat_send_all(core.colorize("green", "Match started!"))
remove_barrier() remove_barrier()
alive_players = {} alive_players = {}
@ -239,13 +240,12 @@ function end_match() -- End the match
player:get_inventory():set_list("main", {}) player:get_inventory():set_list("main", {})
player:set_inventory_formspec([[ player:set_inventory_formspec([[
size[8,4] size[8,4]
list[current_player;main;0,0;8,1;] list[current_player;main;0,0;8,1;]
list[current_player;main;0,1.25;8,3;8] list[current_player;main;0,1.25;8,3;8]
listring[current_player;main] listring[current_player;main]
]]) ]])
player:set_properties({pointable = false}) player:set_properties({pointable = false})
set_player_mode(player, "normal") set_player_mode(player, "normal")
@ -265,11 +265,11 @@ function save_player_data(player) -- Save the player's skin storing it in their
if skins[1] == "blank.png" then if skins[1] == "blank.png" then
return return
end end
player:get_meta():set_string("skin", core.serialize(skins)) player:get_meta():set_string("skin", core.serialize(skins))
end end
function load_player_data(player) -- Load the player's skin stored in their metadata function load_player_data(player) -- Load the player's skin stored in their metadata
local skins = core.deserialize(player:get_meta():get_string("skin")) local skins = core.deserialize(player:get_meta():get_string("skin"))
player:set_properties({ player:set_properties({

View file

@ -38,11 +38,12 @@ core.register_on_joinplayer(function(player)
player:get_inventory():set_list("main", {}) player:get_inventory():set_list("main", {})
player:set_inventory_formspec([[ player:set_inventory_formspec([[
size[8,4] size[8,4]
list[current_player;main;0,0;8,1;] list[current_player;main;0,0;8,1;]
list[current_player;main;0,1.25;8,3;8] list[current_player;main;0,1.25;8,3;8]
listring[current_player;main] listring[current_player;main]
]]) ]])
player:set_properties({pointable = false}) player:set_properties({pointable = false})
player:hud_set_flags({ player:hud_set_flags({
@ -59,13 +60,13 @@ end)
core.register_on_leaveplayer(function(player) core.register_on_leaveplayer(function(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
kill_player(player, "left the game") kill_player(player, "left the game")
end) end)
core.register_on_dieplayer(function(player) core.register_on_dieplayer(function(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
kill_player(player, "died") kill_player(player, "died")
end) end)
@ -77,7 +78,7 @@ core.register_on_respawnplayer(function(player)
player:set_pos(map_data.spawn) player:set_pos(map_data.spawn)
player:get_inventory():set_list("main", {}) player:get_inventory():set_list("main", {})
player:set_properties({pointable = false}) player:set_properties({pointable = false})
end end

View file

@ -27,7 +27,7 @@ function place_map(map)
else else
map_data.spawn = map_data.spawn + map_pos map_data.spawn = map_data.spawn + map_pos
end end
if map_data.start_time == nil or map_data.start_time <= 0 then if map_data.start_time == nil or map_data.start_time <= 0 then
map_data.start_time = 30 map_data.start_time = 30
end end
@ -38,7 +38,7 @@ function place_map(map)
map_data.classes.class_2 = {} map_data.classes.class_2 = {}
map_data.classes.class_3 = {} map_data.classes.class_3 = {}
end end
if map_data.classes.class_1.initial_items == nil or map_data.classes.class_1.name == nil then if map_data.classes.class_1.initial_items == nil or map_data.classes.class_1.name == nil then
map_data.classes.class_1.initial_items = {"ctf_ranged:m200_loaded", "default:sword_stone", "ctf_ranged:ammo 99"} map_data.classes.class_1.initial_items = {"ctf_ranged:m200_loaded", "default:sword_stone", "ctf_ranged:ammo 99"}
map_data.classes.class_1.name = "Long-range" map_data.classes.class_1.name = "Long-range"

View file

@ -14,7 +14,7 @@ return {
classes = { classes = {
class_1 = { class_1 = {
name = "Long-range", name = "Long-range",
initial_items = {"ctf_ranged:m200_loaded", "default:sword_stone", "ctf_ranged:ammo 99", "default:torch 1"} initial_items = {"ctf_ranged:m200_loaded", "default:sword_stone", "ctf_ranged:ammo 99", "default:torch 1"}
}, },

View file

@ -14,7 +14,7 @@ return {
classes = { classes = {
class_1 = { class_1 = {
name = "Long-range", name = "Long-range",
initial_items = {"ctf_ranged:m200_loaded", "default:sword_stone", "ctf_ranged:ammo 99", "default:torch 1"} initial_items = {"ctf_ranged:m200_loaded", "default:sword_stone", "ctf_ranged:ammo 99", "default:torch 1"}
}, },