From ba559e80974a1e4423ce8318a577c2fa16816aba Mon Sep 17 00:00:00 2001 From: Aurallianz Date: Sat, 29 Mar 2025 11:25:04 -0500 Subject: [PATCH] added a new admin verb that changes the gamemode, then allows you to change the map and then restarts the world. fixed UPP access for IDs not returning properly. fixed the UPP ship loading everytime. --- code/__DEFINES/__game.dm | 1 + code/controllers/subsystem/mapping.dm | 5 +- code/modules/admin/admin_verbs.dm | 1 + code/modules/admin/server_verbs.dm | 75 +++++++++++++++++++ code/modules/gear_presets/upp.dm | 101 ++++++++++++++++++++------ 5 files changed, 161 insertions(+), 22 deletions(-) diff --git a/code/__DEFINES/__game.dm b/code/__DEFINES/__game.dm index f3e40ce3a1f8..a38d52b1d196 100644 --- a/code/__DEFINES/__game.dm +++ b/code/__DEFINES/__game.dm @@ -39,6 +39,7 @@ #define GAMEMODE_WHISKEY_OUTPOST "Whiskey Outpost" #define GAMEMODE_HIVE_WARS "Hive Wars" +#define GAMEMODE_FACTION_CLASH_UPP_CM "Faction Clash UPP CM" /// Number of players before we switch to lowpop maps only (LV, BR, Prison). #define PLAYERCOUNT_LOWPOP_MAP_LIMIT 130 diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index e2f305598bba..5d7b8ec32bf0 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -234,7 +234,10 @@ SUBSYSTEM_DEF(mapping) INIT_ANNOUNCE("Loading [ship_map.map_name]...") Loadship(FailedZs, ship_map.map_name, ship_map.map_path, ship_map.map_file, ship_map.traits, ZTRAITS_MAIN_SHIP, override_map_path = ship_base_path) - Loadship(FailedZs, "ssv_rostock", "templates/", list("ssv_rostock.dmm") , list(),ZTRAITS_MAIN_SHIP , override_map_path = "maps/") + // loads the UPP ship if the game mode is faction clash (Generally run by the Prepare event under prep event verb) + if(trim(file2text("data/mode.txt")) == GAMEMODE_FACTION_CLASH_UPP_CM) + Loadship(FailedZs, "ssv_rostock", "templates/", list("ssv_rostock.dmm") , list(),ZTRAITS_MAIN_SHIP , override_map_path = "maps/") + if(LAZYLEN(FailedZs)) //but seriously, unless the server's filesystem is messed up this will never happen var/msg = "RED ALERT! The following map files failed to load: [FailedZs[1]]" if(length(FailedZs) > 1) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 0fca565923f9..b4027137bbd8 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -169,6 +169,7 @@ GLOBAL_LIST_INIT(admin_verbs_server, list( /datum/admins/proc/toggleaban, /datum/admins/proc/end_round, /datum/admins/proc/change_ground_map, + /datum/admins/proc/prep_events, /datum/admins/proc/change_ship_map, /datum/admins/proc/vote_ground_map, /datum/admins/proc/override_ground_map, diff --git a/code/modules/admin/server_verbs.dm b/code/modules/admin/server_verbs.dm index 47a60c043741..2a26683bd24c 100644 --- a/code/modules/admin/server_verbs.dm +++ b/code/modules/admin/server_verbs.dm @@ -126,3 +126,78 @@ log_admin("[key_name(usr)] changed the ship map to [VM.map_name].") message_admins("[key_name_admin(usr)] changed the ship map to [VM.map_name].") + +/datum/admins/proc/prep_events() + set category = "Server" + set name = "M: Prepare Events" + + var/list/maprotatechoices = list() + var/datum/map_config/VM + var/chosenmap + var/list/mode_list + + if(!check_rights(R_SERVER)) + return + + message_admins("[key_name_admin(usr)] has run the prep_events verb.") +// + var/accept = tgui_alert(usr, "Are you sure you want to prepare events? This will restart the server!!!! additionally it will change the current master mode!!!!", "Prepare Events", list("Yes", "No")) + if(accept != "Yes") + return +// + mode_list = config.modes + mode_list += "Cancel" + var/modeset = tgui_input_list(usr, "current mode: [GLOB.master_mode]", "Mode Selection", mode_list) + +// Override ground map + var/accept_mapchange = tgui_alert(usr, "Do you wish to change the next ground map?", "Prepare Events", list("Yes", "No")) + if(accept_mapchange == "Yes") + for(var/map in config.maplist[GROUND_MAP]) + VM = config.maplist[GROUND_MAP][map] + var/mapname = VM.map_name + if(VM == config.defaultmaps[GROUND_MAP]) + mapname += " (Default)" + + if(VM.config_min_users > 0 || VM.config_max_users > 0) + mapname += " \[" + if(VM.config_min_users > 0) + mapname += "[VM.config_min_users]" + else + mapname += "0" + mapname += "-" + if(VM.config_max_users > 0) + mapname += "[VM.config_max_users]" + else + mapname += "inf" + mapname += "\]" + + maprotatechoices[mapname] = VM + + chosenmap = tgui_input_list(usr, "Choose a ground map to change to", "Change Ground Map", maprotatechoices) + + if(!chosenmap) + to_chat(usr, SPAN_WARNING("Failed to select a ground map, aborting changes and restart.")) + return + +// All changes should happen here incase of failure + //Change gamemode + if(modeset != "Cancel" && !!modeset) + GLOB.master_mode = modeset + message_admins("[key_name_admin(usr)] set the mode as [GLOB.master_mode] via event prep.") + to_world(SPAN_NOTICE("The mode for next round is: [GLOB.master_mode]!")) + SSticker.save_mode(GLOB.master_mode) + + //Change map + if(chosenmap) + VM = maprotatechoices[chosenmap] + log_admin("[key_name(usr)] changed the map to [VM.map_name].") + message_admins("[key_name_admin(usr)] changed the map to [VM.map_name].") + + if(!SSmapping.changemap(VM, GROUND_MAP)) + to_chat(usr, SPAN_WARNING("Failed to change the ground map, aborting changes and restart.")) + return + +// Restarts the world provided no issues occur above. + log_admin("[key_name(usr)] initiated a reboot.") + sleep(100) + world.Reboot() diff --git a/code/modules/gear_presets/upp.dm b/code/modules/gear_presets/upp.dm index 86433bb81f45..37f27cc5b71b 100644 --- a/code/modules/gear_presets/upp.dm +++ b/code/modules/gear_presets/upp.dm @@ -110,7 +110,10 @@ name = "UPP Soldier" flags = EQUIPMENT_PRESET_EXTRA skills = /datum/skills/upp - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/soldier/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/soldier/dressed/load_gear(mob/living/carbon/human/new_human) //face @@ -341,7 +344,10 @@ skills = /datum/skills/upp/combat_medic flags = EQUIPMENT_PRESET_EXTRA - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/medic/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/medic/dressed/load_gear(mob/living/carbon/human/new_human) //back @@ -547,7 +553,10 @@ skills = /datum/skills/upp/combat_engineer flags = EQUIPMENT_PRESET_EXTRA - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/sapper/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/sapper/dressed/load_gear(mob/living/carbon/human/new_human) //Sappers should have lots of gear and whatnot that helps them attack or siege marines @@ -713,8 +722,10 @@ /datum/equipment_preset/upp/specialist/dressed name = "UPP Specialist" flags = EQUIPMENT_PRESET_EXTRA - access = ACCESS_LIST_UPP_ALL +/datum/equipment_preset/upp/specialist/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/specialist/dressed/load_gear(mob/living/carbon/human/new_human) //back @@ -855,8 +866,10 @@ /datum/equipment_preset/upp/machinegunner/dressed name = "UPP Machinegunner" flags = EQUIPMENT_PRESET_EXTRA - access = ACCESS_LIST_UPP_ALL +/datum/equipment_preset/upp/machinegunner/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/machinegunner/dressed/load_gear(mob/living/carbon/human/new_human) //back @@ -1014,7 +1027,10 @@ skills = /datum/skills/upp/SL flags = EQUIPMENT_PRESET_EXTRA - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/leader/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/leader/dressed/load_gear(mob/living/carbon/human/new_human) var/UPPleadsidearm = rand(1,4) @@ -1234,7 +1250,10 @@ /datum/equipment_preset/upp/military_police/dressed name = "UPP Military Police" flags = EQUIPMENT_PRESET_EXTRA - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/military_police/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/military_police/dressed/load_gear(mob/living/carbon/human/new_human) //back @@ -1423,7 +1442,10 @@ /datum/equipment_preset/upp/doctor/dressed name = "UPP Doctor" flags = EQUIPMENT_PRESET_EXTRA - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/doctor/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/doctor/dressed/load_gear(mob/living/carbon/human/new_human) //back @@ -1598,7 +1620,10 @@ /datum/equipment_preset/upp/supply/dressed name = "UPP Logistics Technician" flags = EQUIPMENT_PRESET_EXTRA - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/supply/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/supply/dressed/load_gear(mob/living/carbon/human/new_human) //back @@ -1714,8 +1739,10 @@ /datum/equipment_preset/upp/officer/dressed name = "UPP Lieutenant" flags = EQUIPMENT_PRESET_EXTRA - access = ACCESS_LIST_UPP_ALL +/datum/equipment_preset/upp/officer/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/officer/dressed/load_gear(mob/living/carbon/human/new_human) //back @@ -1900,7 +1927,10 @@ /datum/equipment_preset/upp/officer/senior/dressed name = "UPP Senior Lieutenant" - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/officer/senior/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/officer/senior/dressed/load_gear(mob/living/carbon/human/new_human) //back @@ -2062,7 +2092,10 @@ /datum/equipment_preset/upp/officer/kapitan/dressed name = "UPP Kapitan" - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/officer/kapitan/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/officer/kapitan/load_gear(mob/living/carbon/human/new_human) //back @@ -2257,7 +2290,10 @@ /datum/equipment_preset/upp/officer/major/dressed name = "UPP Major" - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/officer/major/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/officer/major/dressed/load_gear(mob/living/carbon/human/new_human) //back @@ -2446,7 +2482,10 @@ role_comm_title = "Lt. Kol." minimap_icon = "upp_co" paygrades = list(PAY_SHORT_UO5 = JOB_PLAYTIME_TIER_0) - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/officer/flag/dressed/podpolkovnik/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) //*****************************************************************************************************/ /datum/equipment_preset/upp/officer/flag @@ -2675,7 +2714,10 @@ role_comm_title = "Ley. Gen." minimap_icon = "upp_co" paygrades = list(PAY_SHORT_UO8 = JOB_PLAYTIME_TIER_0) - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/officer/flag/may_gen/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) //*****************************************************************************************************/ /datum/job/antag/upp/officer/ley_gen @@ -2698,7 +2740,10 @@ rank = JOB_UPP_LT_GENERAL role_comm_title = "Lt. Gen." minimap_icon = "upp_co" - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/officer/flag/ley_gen/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) //*****************************************************************************************************/ /datum/job/antag/upp/officer/gen @@ -2713,8 +2758,10 @@ minimap_icon = "upp_co" paygrades = list(PAY_SHORT_UO10 = JOB_PLAYTIME_TIER_0) skills = /datum/skills/upp/commander - access = ACCESS_LIST_UPP_ALL +/datum/equipment_preset/upp/officer/flag/gen/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) //*****************************************************************************************************/ /datum/equipment_preset/upp/sapper/survivor @@ -2793,7 +2840,10 @@ /datum/equipment_preset/upp/synth/dressed name = "UPP Synthetic" - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/synth/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/synth/load_gear(mob/living/carbon/human/new_human) . = ..() @@ -3024,7 +3074,10 @@ /datum/equipment_preset/upp/synth/combat/dressed name = "UPP Combat Synthetic" flags = EQUIPMENT_PRESET_EXTRA - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/synth/combat/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/synth/combat/load_skills(mob/living/carbon/human/new_human) @@ -3673,7 +3726,10 @@ /datum/equipment_preset/upp/tank/dressed name = "UPP Vehicle Crewman (TANK)" - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/tank/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/tank/dressed/load_gear(mob/living/carbon/human/new_human) @@ -3882,7 +3938,10 @@ /datum/equipment_preset/upp/commissar/dressed name = "UPP Political Commissar" flags = EQUIPMENT_PRESET_EXTRA - access = ACCESS_LIST_UPP_ALL + +/datum/equipment_preset/upp/commissar/dressed/New() + .=..() + access = get_access(ACCESS_LIST_UPP_ALL) /datum/equipment_preset/upp/commissar/load_gear(mob/living/carbon/human/new_human) . = ..()