Skip to content

Commit

Permalink
Admins Can Toggle Factions (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurrain authored Apr 20, 2024
1 parent 7564651 commit 139a55f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -381,3 +381,5 @@

#define JOB_DISPLAY_ORDER_F13SMUTANTLEADER 134
#define JOB_DISPLAY_ORDER_F13SMUTANT 135

GLOBAL_LIST_INIT(faction_list, list(FACTION_NCR, FACTION_LEGION, FACTION_BROTHERHOOD, FACTION_EASTWOOD, FACTION_ENCLAVE, FACTION_WASTELAND, FACTION_RAIDERS, FACTION_SMUTANT))
2 changes: 2 additions & 0 deletions code/controllers/subsystem/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ SUBSYSTEM_DEF(job)

var/list/level_order = list(JP_HIGH,JP_MEDIUM,JP_LOW)

var/list/disabled_factions = list()

/datum/controller/subsystem/job/Initialize(timeofday)
SSmapping.HACK_LoadMapConfig()
if(!occupations.len)
Expand Down
19 changes: 19 additions & 0 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ GLOBAL_PROTECT(admin_verbs_admin)
/datum/admins/proc/open_borgopanel,
/datum/admins/proc/toggle_sleep,
/datum/admins/proc/toggle_sleep_area,
/datum/admins/proc/toggle_faction_join
)
GLOBAL_LIST_INIT(admin_verbs_ban, list(/client/proc/unban_panel, /client/proc/DB_ban_panel, /client/proc/stickybanpanel))
GLOBAL_PROTECT(admin_verbs_ban)
Expand Down Expand Up @@ -836,3 +837,21 @@ GLOBAL_PROTECT(admin_verbs_hideable)
perp.SetAdminSleep(remove = TRUE)
log_admin("[key_name(usr)] has unslept everyone in view.")
message_admins("[ADMIN_TPMONTY(usr)] has unslept everyone in view.")

/datum/admins/proc/toggle_faction_join()
set category = "Admin.Game"
set name = "Toggle Faction Join"

if(!check_rights(R_ADMIN))
message_admins("[ADMIN_TPMONTY(usr)] tried to use toggle_faction_join() without admin perms.")
log_admin("INVALID ADMIN PROC ACCESS: [key_name(usr)] tried to use toggle_faction_join() without admin perms.")
return

var/disable_faction = input(usr, "Which faction do you want to toggle?", "Toggle") as null | anything in GLOB.faction_list
if(LAZYISIN(SSjob.disabled_factions, disable_faction))
LAZYREMOVE(SSjob.disabled_factions, disable_faction)
else
LAZYADD(SSjob.disabled_factions, disable_faction)

log_admin("[key_name(usr)] has toggled joining for the [disable_faction] faction.")
message_admins("[ADMIN_TPMONTY(usr)] toggled joining for the [disable_faction] faction!")
7 changes: 5 additions & 2 deletions code/modules/mob/dead/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,11 @@
alert(src, get_job_unavailable_error_message(error, rank))
return FALSE

var/datum/job/job = SSjob.GetJob(rank)
if(job.faction && (job.faction in SSjob.disabled_factions))
alert(src, "An administrator has disabled spawning as the [job.faction] faction!")
return FALSE

if(SSticker.late_join_disabled)
alert(src, "An administrator has disabled late join spawning.")
return FALSE
Expand All @@ -476,8 +481,6 @@
if(isliving(equip)) //Borgs get borged in the equip, so we need to make sure we handle the new mob.
character = equip

var/datum/job/job = SSjob.GetJob(rank)

if(job && !job.override_latejoin_spawn(character))
SSjob.SendToLateJoin(character)
if(!arrivals_docked)
Expand Down

0 comments on commit 139a55f

Please sign in to comment.