Small MC refactor (#20017)

* Small MC refactor

* Order fix

* Nabs tgstation/tgstation#27324

* Oops

* gnarg
This commit is contained in:
AffectedArc07
2023-01-18 12:06:24 -06:00
committed by GitHub
parent ea9e1969a4
commit 946fb4dff6
99 changed files with 337 additions and 465 deletions
+1 -1
View File
@@ -64,7 +64,7 @@
// As per my comment 8 or so lines above, we do NOT log failed connections here
//check if the IP address is a known proxy/vpn, and the user is not whitelisted
if(check_ipintel && GLOB.configuration.ipintel.contact_email && GLOB.configuration.ipintel.whitelist_mode && SSipintel.ipintel_is_banned(key, address))
if(check_ipintel && GLOB.configuration.ipintel.contact_email && GLOB.configuration.ipintel.whitelist_mode && GLOB.ipintel_manager.ipintel_is_banned(key, address))
log_adminwarn("Failed Login: [key] [computer_id] [address] - Proxy/VPN")
var/mistakemessage = ""
if(GLOB.configuration.url.banappeals_url)
+1 -1
View File
@@ -310,7 +310,7 @@ GLOBAL_VAR_INIT(nologevent, 0)
return
var/key = stripped_input(usr, "Enter ckey to add/remove, or leave blank to cancel:", "VPN Whitelist add/remove", max_length=32)
if(key)
SSipintel.vpn_whitelist_panel(key)
GLOB.ipintel_manager.vpn_whitelist_panel(key)
/datum/admins/proc/Game()
if(!check_rights(R_ADMIN))
+1 -1
View File
@@ -69,6 +69,7 @@ GLOBAL_LIST_INIT(admin_verbs_admin, list(
/client/proc/ccbdb_lookup_ckey,
/client/proc/view_instances,
/client/proc/start_vote,
/client/proc/toggle_mctabs,
/client/proc/ping_all_admins,
/client/proc/show_watchlist
))
@@ -163,7 +164,6 @@ GLOBAL_LIST_INIT(admin_verbs_debug, list(
/client/proc/view_runtimes,
/client/proc/admin_serialize,
/client/proc/jump_to_ruin,
/client/proc/toggle_medal_disable,
/client/proc/uid_log,
/client/proc/visualise_active_turfs,
/client/proc/reestablish_db_connection,
+1 -1
View File
@@ -178,7 +178,7 @@
message_admins("[key_name_admin(usr)] has added a [bantype_str] for [ckey] [(job)?"([job])":""] [(duration > 0)?"([duration] minutes)":""] with the reason: \"[reason]\" to the ban database.",1)
if(announce_in_discord)
SSdiscord.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "**\[Ban]** [a_ckey] applied a [bantype_str] on [ckey]")
GLOB.discord_manager.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "**\[Ban]** [a_ckey] applied a [bantype_str] on [ckey]")
if(kickbannedckey)
if(banned_mob && banned_mob.client && banned_mob.client.ckey == banckey)
+2 -2
View File
@@ -44,11 +44,11 @@ GLOBAL_LIST_INIT(adminhelp_ignored_words, list("unknown", "the", "a", "an", "of"
var/active_admins = admincount[1]
log_admin("[selected_type]: [key_name(src)]: [msg] - heard by [active_admins] non-AFK admins.")
SSdiscord.send2discord_simple_noadmins("**\[Adminhelp]** [key_name(src)]: [msg]", check_send_always = TRUE)
GLOB.discord_manager.send2discord_simple_noadmins("**\[Adminhelp]** [key_name(src)]: [msg]", check_send_always = TRUE)
if("Mentorhelp")
var/list/mentorcount = staff_countup(R_MENTOR)
var/active_mentors = mentorcount[1]
log_admin("[selected_type]: [key_name(src)]: [msg] - heard by [active_mentors] non-AFK mentors.")
SSdiscord.send2discord_simple_mentor("[key_name(src)]: [msg]")
GLOB.discord_manager.send2discord_simple_mentor("[key_name(src)]: [msg]")
+1 -1
View File
@@ -235,7 +235,7 @@
to_chat(src, "<span class='notice'>[msg]</span>")
return
SSdiscord.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "PM from [key_name(src)]: [html_decode(msg)]")
GLOB.discord_manager.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "PM from [key_name(src)]: [html_decode(msg)]")
to_chat(src, "<span class='pmsend'>PM to-<b>Discord Admins</b>: [msg]</span>")
-15
View File
@@ -906,21 +906,6 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Jump To Ruin") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/toggle_medal_disable()
set category = "Debug"
set name = "Toggle Medal Disable"
set desc = "Toggles the safety lock on trying to contact the medal hub."
if(!check_rights(R_DEBUG))
return
SSmedals.hub_enabled = !SSmedals.hub_enabled
message_admins("<span class='adminnotice'>[key_name_admin(src)] [SSmedals.hub_enabled ? "disabled" : "enabled"] the medal hub lockout.</span>")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Toggle Medal Disable") // If...
log_admin("[key_name(src)] [SSmedals.hub_enabled ? "disabled" : "enabled"] the medal hub lockout.")
/client/proc/visualise_active_turfs()
set category = "Debug"
set name = "Visualise Active Turfs"
+3 -3
View File
@@ -20,7 +20,7 @@
to_chat(usr, "Queue server is now <b>[SSqueue.queue_enabled ? "<font color='green'>Enabled</font>" : "<font color='red'>Disabled</font>"]</b>")
message_admins("[key_name_admin(usr)] has [SSqueue.queue_enabled ? "enabled" : "disabled"] the server queue.")
log_admin("[key_name(usr)] has [SSqueue.queue_enabled ? "enabled" : "disabled"] the server queue.")
SSdiscord.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "**\[Queue Server]** `[usr.ckey]` has now **[SSqueue.queue_enabled ? "enabled" : "disabled"]** the queue server.")
GLOB.discord_manager.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "**\[Queue Server]** `[usr.ckey]` has now **[SSqueue.queue_enabled ? "enabled" : "disabled"]** the queue server.")
if("Set Threshold")
var/new_threshold = input(usr, "Enter new threshold", "Queue Server Manipulation", SSqueue.queue_threshold) as num|null
if(!new_threshold)
@@ -29,13 +29,13 @@
to_chat(usr, "Queue threshold is now <b>[SSqueue.queue_threshold]</b>")
message_admins("[key_name_admin(usr)] has set the queue threshold to [SSqueue.queue_threshold].")
log_admin("[key_name(usr)] has set the queue threshold to [SSqueue.queue_threshold].")
SSdiscord.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "**\[Queue Server]** `[usr.ckey]` has set the queue threshold to **[SSqueue.queue_threshold]**.")
GLOB.discord_manager.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "**\[Queue Server]** `[usr.ckey]` has set the queue threshold to **[SSqueue.queue_threshold]**.")
if("Toggle Setting Persistence")
SSqueue.persist_queue = !SSqueue.persist_queue
to_chat(usr, "Queue server setting persistence is now <b>[SSqueue.persist_queue ? "<font color='green'>Enabled</font>" : "<font color='red'>Disabled</font>"]</b>")
message_admins("[key_name_admin(usr)] has [SSqueue.persist_queue ? "enabled" : "disabled"] the server queue settings persistence.")
log_admin("[key_name(usr)] has [SSqueue.persist_queue ? "enabled" : "disabled"] the server queue settings persistence.")
SSdiscord.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "**\[Queue Server]** `[usr.ckey]` has now **[SSqueue.persist_queue ? "enabled" : "disabled"]** server queue settings persistence.")
GLOB.discord_manager.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "**\[Queue Server]** `[usr.ckey]` has now **[SSqueue.persist_queue ? "enabled" : "disabled"]** server queue settings persistence.")
/client/proc/add_queue_server_bypass()
set name = "Add Queue Server Bypass"
+4 -4
View File
@@ -607,11 +607,11 @@
log_debug("check_ip_intel: skip check for player [key_name_admin(src)] connecting from localhost.")
return
if(SSipintel.vpn_whitelist_check(ckey))
if(GLOB.ipintel_manager.vpn_whitelist_check(ckey))
log_debug("check_ip_intel: skip check for player [key_name_admin(src)] [address] on whitelist.")
return
var/datum/ipintel/res = SSipintel.get_ip_intel(address)
var/datum/ipintel/res = GLOB.ipintel_manager.get_ip_intel(address)
ip_intel = res.intel
verify_ip_intel()
@@ -797,7 +797,7 @@
if(!cidcheck_failedckeys[ckey])
message_admins("<span class='adminnotice'>[key_name(src)] has been detected as using a CID randomizer. Connection rejected.</span>")
SSdiscord.send2discord_simple_noadmins("**\[Warning]** [key_name(src)] has been detected as using a CID randomizer. Connection rejected.")
GLOB.discord_manager.send2discord_simple_noadmins("**\[Warning]** [key_name(src)] has been detected as using a CID randomizer. Connection rejected.")
cidcheck_failedckeys[ckey] = TRUE
note_randomizer_user()
@@ -811,7 +811,7 @@
if(cidcheck_failedckeys[ckey])
// Atonement
message_admins("<span class='adminnotice'>[key_name_admin(src)] has been allowed to connect after showing they removed their cid randomizer</span>")
SSdiscord.send2discord_simple_noadmins("**\[Info]** [key_name(src)] has been allowed to connect after showing they removed their cid randomizer.")
GLOB.discord_manager.send2discord_simple_noadmins("**\[Info]** [key_name(src)] has been allowed to connect after showing they removed their cid randomizer.")
cidcheck_failedckeys -= ckey
if(cidcheck_spoofckeys[ckey])
@@ -11,5 +11,5 @@
if(Q.NextRow())
var/watchreason = Q.item[1]
message_admins("<font color='red'><B>Notice: </B></font><font color='#EB4E00'>[key_name_admin(C)] is on the watchlist and has just connected - Reason: [watchreason]</font>")
SSdiscord.send2discord_simple_noadmins("**\[Watchlist]** [key_name(C)] is on the watchlist and has just connected - Reason: [watchreason]")
GLOB.discord_manager.send2discord_simple_noadmins("**\[Watchlist]** [key_name(C)] is on the watchlist and has just connected - Reason: [watchreason]")
C.watchlisted = TRUE
@@ -357,3 +357,11 @@
client.prefs.toggles2 ^= PREFTOGGLE_2_ANON
to_chat(src, "Your key will [(client.prefs.toggles2 & PREFTOGGLE_2_ANON) ? "no longer" : "now"] be shown in certain events (end round reports, deadchat, etc).</span>")
client.prefs.save_preferences(src)
/client/proc/toggle_mctabs()
set name = "Show/Hide MC Tabs"
set category = "Preferences"
set desc = "Shows or hides the MC tabs."
prefs.toggles2 ^= PREFTOGGLE_2_MC_TABS
prefs.save_preferences(src)
to_chat(src, "You will [(prefs.toggles2 & PREFTOGGLE_2_MC_TABS) ? "now" : "no longer"] see the MC tabs on the top right.")
+1 -1
View File
@@ -271,7 +271,7 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
/mob/living/silicon/ai/proc/ai_alerts()
var/list/dat = list("<HEAD><TITLE>Current Station Alerts</TITLE><META HTTP-EQUIV='Refresh' CONTENT='10'></HEAD><BODY>\n")
dat += "<A HREF='?src=[UID()];mach_close=aialerts'>Close</A><BR><BR>"
var/list/list/temp_alarm_list = SSalarm.alarms.Copy()
var/list/list/temp_alarm_list = GLOB.alarm_manager.alarms.Copy()
for(var/cat in temp_alarm_list)
if(!(cat in alarms_listend_for))
continue
@@ -607,7 +607,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
/mob/living/silicon/robot/proc/robot_alerts()
var/list/dat = list()
var/list/list/temp_alarm_list = SSalarm.alarms.Copy()
var/list/list/temp_alarm_list = GLOB.alarm_manager.alarms.Copy()
for(var/cat in temp_alarm_list)
if(!(cat in alarms_listend_for))
continue
+2 -2
View File
@@ -46,8 +46,8 @@
..()
add_language("Galactic Common")
init_subsystems()
RegisterSignal(SSalarm, COMSIG_TRIGGERED_ALARM, PROC_REF(alarm_triggered))
RegisterSignal(SSalarm, COMSIG_CANCELLED_ALARM, PROC_REF(alarm_cancelled))
RegisterSignal(GLOB.alarm_manager, COMSIG_TRIGGERED_ALARM, PROC_REF(alarm_triggered))
RegisterSignal(GLOB.alarm_manager, COMSIG_CANCELLED_ALARM, PROC_REF(alarm_cancelled))
/mob/living/silicon/Initialize(mapload)
. = ..()
@@ -589,9 +589,6 @@ Difficulty: Medium
butcher_results = list(/obj/item/stack/ore/diamond = 5, /obj/item/stack/sheet/sinew = 5, /obj/item/stack/sheet/bone = 30)
attack_action_types = list()
/mob/living/simple_animal/hostile/megafauna/dragon/lesser/grant_achievement(medaltype,scoretype)
return
/mob/living/simple_animal/hostile/megafauna/dragon/space_dragon
name = "space dragon"
maxHealth = 250
@@ -616,9 +613,6 @@ Difficulty: Medium
deathmessage = "screeches as its wings turn to dust and it collapses on the floor, life estinguished."
attack_action_types = list()
/mob/living/simple_animal/hostile/megafauna/dragon/space_dragon/grant_achievement(medaltype, scoretype)
return
/mob/living/simple_animal/hostile/megafauna/dragon/space_dragon/Initialize(mapload)
var/obj/effect/proc_holder/spell/aoe/repulse/spacedragon/repulse_action = new /obj/effect/proc_holder/spell/aoe/repulse/spacedragon(src)
repulse_action.action.Grant(src)
@@ -71,7 +71,6 @@
if(C && crusher_loot && C.total_damage >= maxHealth * 0.6)
spawn_crusher_loot()
if(!elimination) //used so the achievment only occurs for the last legion to die.
grant_achievement(medal_type,score_type)
SSblackbox.record_feedback("tally", "megafauna_kills", 1, "[initial(name)]")
return ..()
@@ -127,20 +126,6 @@
recovery_time = world.time + buffer_time
ranged_cooldown = world.time + buffer_time
/mob/living/simple_animal/hostile/megafauna/proc/grant_achievement(medaltype, scoretype, crusher_kill)
if(!medal_type || admin_spawned || !SSmedals.hub_enabled) //Don't award medals if the medal type isn't set
return FALSE
for(var/mob/living/L in view(7,src))
if(L.stat || !L.client)
continue
var/client/C = L.client
SSmedals.UnlockMedal("Boss [BOSS_KILL_MEDAL]", C)
SSmedals.UnlockMedal("[medaltype] [BOSS_KILL_MEDAL]", C)
SSmedals.SetScore(BOSS_SCORE, C, 1)
SSmedals.SetScore(score_type, C, 1)
return TRUE
/datum/action/innate/megafauna_attack
name = "Megafauna Attack"
icon_icon = 'icons/mob/actions/actions_animal.dmi'
+2 -2
View File
@@ -12,13 +12,13 @@
if(temp_admin.rights & R_MENTOR)
var/list/mentorcounter = staff_countup(R_MENTOR)
if(mentorcounter[1] == 0) // No active mentors
SSdiscord.send2discord_simple(DISCORD_WEBHOOK_MENTOR, "[key_name(src)] logged out - 0 active mentors, [mentorcounter[2]] non-mentor staff, [mentorcounter[3]] inactive mentors.")
GLOB.discord_manager.send2discord_simple(DISCORD_WEBHOOK_MENTOR, "[key_name(src)] logged out - 0 active mentors, [mentorcounter[2]] non-mentor staff, [mentorcounter[3]] inactive mentors.")
else if(temp_admin.rights & R_BAN)
message_admins("Admin logout: [key_name_admin(src)]")
var/list/admincounter = staff_countup(R_BAN)
if(admincounter[1] == 0) // No active admins
SSdiscord.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "[key_name(src)] logged out - 0 active admins, [admincounter[2]] non-admin staff, [admincounter[3]] inactive staff.")
GLOB.discord_manager.send2discord_simple(DISCORD_WEBHOOK_ADMIN, "[key_name(src)] logged out - 0 active admins, [admincounter[2]] non-admin staff, [admincounter[3]] inactive staff.")
..()
update_morgue()
+37 -6
View File
@@ -978,8 +978,12 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
add_spell_to_statpanel(S)
// Allow admins + PR reviewers to VIEW the panel. Doesnt mean they can click things.
if(is_admin(src) || check_rights(R_VIEWRUNTIMES, FALSE))
if(statpanel("MC")) //looking at that panel
if((is_admin(src) || check_rights(R_VIEWRUNTIMES, FALSE)) && client?.prefs.toggles2 & PREFTOGGLE_2_MC_TABS)
// Below are checks to see which MC panel you are looking at
// Shows MC Metadata
if(statpanel("MC|M"))
stat("Info", "Showing MC metadata")
var/turf/T = get_turf(client.eye)
stat("Location:", COORD(T))
stat("CPU:", "[Master.formatcpu(world.cpu)]")
@@ -987,7 +991,6 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
stat("Instances:", "[num2text(world.contents.len, 10)]")
GLOB.stat_entry()
stat("Server Time:", time_stamp())
stat(null)
if(Master)
Master.stat_entry()
else
@@ -996,10 +999,38 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
Failsafe.stat_entry()
else
stat("Failsafe Controller:", "ERROR")
// Shows subsystems with SS_NO_FIRE
if(statpanel("MC|N"))
stat("Info", "Showing subsystems that do not fire")
if(Master)
stat(null)
for(var/datum/controller/subsystem/SS in Master.subsystems)
SS.stat_entry()
for(var/datum/controller/subsystem/SS as anything in Master.subsystems)
if(SS.flags & SS_NO_FIRE)
SS.stat_entry()
// Shows subsystems with the SS_CPUDISPLAY_LOW flag
if(statpanel("MC|L"))
stat("Info", "Showing subsystems marked as low intensity")
if(Master)
for(var/datum/controller/subsystem/SS as anything in Master.subsystems)
if((SS.cpu_display == SS_CPUDISPLAY_LOW) && !(SS.flags & SS_NO_FIRE))
SS.stat_entry()
// Shows subsystems with the SS_CPUDISPLAY_DEFAULT flag
if(statpanel("MC|D"))
stat("Info", "Showing subsystems marked as default intensity")
if(Master)
for(var/datum/controller/subsystem/SS as anything in Master.subsystems)
if((SS.cpu_display == SS_CPUDISPLAY_DEFAULT) && !(SS.flags & SS_NO_FIRE))
SS.stat_entry()
// Shows subsystems with the SS_CPUDISPLAY_HIGH flag
if(statpanel("MC|H"))
stat("Info", "Showing subsystems marked as high intensity")
if(Master)
for(var/datum/controller/subsystem/SS as anything in Master.subsystems)
if((SS.cpu_display == SS_CPUDISPLAY_HIGH) && !(SS.flags & SS_NO_FIRE))
SS.stat_entry()
statpanel("Status") // Switch to the Status panel again, for the sake of the lazy Stat procs
+8 -6
View File
@@ -1,7 +1,9 @@
/datum/unit_test/subsystem_init/Run()
for(var/i in Master.subsystems)
var/datum/controller/subsystem/ss = i
if(ss.flags & SS_NO_INIT)
continue
if(!ss.initialized)
Fail("[ss]([ss.type]) is a subsystem meant to initialize but doesn't get set as initialized.")
var/datum/controller/subsystem/base_ss
var/default_offline_implications = initial(base_ss.offline_implications)
for(var/datum/controller/subsystem/SS as anything in Master.subsystems)
if((SS.flags & SS_NO_INIT) && (SS.flags & SS_NO_FIRE))
Fail("[SS]([SS.type]) is a subsystem which is set to not initialize or fire. Use a global datum instead an SS.")
if(!(SS.flags & SS_NO_FIRE) && SS.offline_implications == default_offline_implications)
Fail("[SS]([SS.type]) is a subsystem which fires but has no offline implications set.")
@@ -2,7 +2,7 @@
/datum/unit_test/subsystem_metric_sanity/Run()
for(var/datum/controller/subsystem/SS in Master.subsystems)
var/list/data = SS.get_metrics()
if(length(data) != 3)
if(length(data) != 4)
Fail("SS[SS.ss_id] has invalid metrics data!")
continue
if(isnull(data["cost"]))
@@ -17,3 +17,6 @@
if(!islist(data["custom"]))
Fail("SS[SS.ss_id] has invalid metrics data! 'custom' is not a list in [json_encode(data)]")
continue
if(isnull(data["sleep_count"]))
Fail("SS[SS.ss_id] has invalid metrics data! No 'sleep_count' found in [json_encode(data)]")
continue