diff --git a/baystation12.dme b/baystation12.dme index 113bcecab76..3af9c26aa58 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -770,7 +770,6 @@ #include "code\modules\admin\holder2.dm" #include "code\modules\admin\IsBanned.dm" #include "code\modules\admin\NewBan.dm" -#include "code\modules\admin\newbanjob.dm" #include "code\modules\admin\player_notes.dm" #include "code\modules\admin\player_panel.dm" #include "code\modules\admin\secrets.dm" diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index f1c3afd8ef4..1cb2e944bb0 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -51,7 +51,7 @@ var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel", "Satchel Al /////Initial Building///// ////////////////////////// -/proc/make_datum_references_lists() +/hook/startup/proc/makeDatumRefLists() var/list/paths //Hair - Initialise all /datum/sprite_accessory/hair into an list indexed by hair-style name @@ -114,6 +114,8 @@ var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel", "Satchel Al if(S.flags & IS_WHITELISTED) whitelisted_species += S.name + return 1 + /* // Uncomment to debug chemical reaction list. /client/verb/debug_chemical_list() diff --git a/code/datums/sun.dm b/code/datums/sun.dm index 1748ea158e7..1379a7b9d87 100644 --- a/code/datums/sun.dm +++ b/code/datums/sun.dm @@ -17,6 +17,10 @@ solar_next_update = world.time // init the timer angle = rand (0,360) // the station position to the sun is randomised at round start +/hook/startup/proc/createSun() + sun = new /datum/sun() + return 1 + // calculate the sun's position given the time of day // at the standard rate (100%) the angle is increase/decreased by 6 degrees every minute. // a full rotation thus take a game hour in that case diff --git a/code/game/area/Space Station 13 areas.dm b/code/game/area/Space Station 13 areas.dm index 2db557e1343..a2f2e34afc7 100644 --- a/code/game/area/Space Station 13 areas.dm +++ b/code/game/area/Space Station 13 areas.dm @@ -60,7 +60,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station /*I am far too lazy to make it a proper list of areas so I'll just make it run the usual telepot routine at the start of the game*/ var/list/teleportlocs = list() -proc/process_teleport_locs() +/hook/startup/proc/setupTeleportLocs() for(var/area/AR in world) if(istype(AR, /area/shuttle) || istype(AR, /area/syndicate_station) || istype(AR, /area/wizard_station)) continue if(teleportlocs.Find(AR.name)) continue @@ -69,20 +69,13 @@ proc/process_teleport_locs() teleportlocs += AR.name teleportlocs[AR.name] = AR - var/not_in_order = 0 - do - not_in_order = 0 - if(teleportlocs.len <= 1) - break - for(var/i = 1, i <= (teleportlocs.len - 1), i++) - if(sorttext(teleportlocs[i], teleportlocs[i+1]) == -1) - teleportlocs.Swap(i, i+1) - not_in_order = 1 - while(not_in_order) + teleportlocs = sortAssoc(teleportlocs) + + return 1 var/list/ghostteleportlocs = list() -proc/process_ghost_teleport_locs() +/hook/startup/proc/setupGhostTeleportLocs() for(var/area/AR in world) if(ghostteleportlocs.Find(AR.name)) continue if(istype(AR, /area/turret_protected/aisat) || istype(AR, /area/derelict) || istype(AR, /area/tdome)) @@ -93,17 +86,9 @@ proc/process_ghost_teleport_locs() ghostteleportlocs += AR.name ghostteleportlocs[AR.name] = AR - var/not_in_order = 0 - do - not_in_order = 0 - if(ghostteleportlocs.len <= 1) - break - for(var/i = 1, i <= (ghostteleportlocs.len - 1), i++) - if(sorttext(ghostteleportlocs[i], ghostteleportlocs[i+1]) == -1) - ghostteleportlocs.Swap(i, i+1) - not_in_order = 1 - while(not_in_order) + ghostteleportlocs = sortAssoc(ghostteleportlocs) + return 1 /*-----------------------------------------------------------------------------*/ diff --git a/code/game/communications.dm b/code/game/communications.dm index 32d8ca69348..3bc3ee70092 100644 --- a/code/game/communications.dm +++ b/code/game/communications.dm @@ -140,6 +140,10 @@ var/const/RADIO_MAGNETS = "9" var/global/datum/controller/radio/radio_controller +/hook/startup/proc/createRadioController() + radio_controller = new /datum/controller/radio() + return 1 + datum/controller/radio var/list/datum/radio_frequency/frequencies = list() diff --git a/code/game/gamemodes/events/holidays/Holidays.dm b/code/game/gamemodes/events/holidays/Holidays.dm index d2481eae441..2cd06199bd8 100644 --- a/code/game/gamemodes/events/holidays/Holidays.dm +++ b/code/game/gamemodes/events/holidays/Holidays.dm @@ -12,6 +12,10 @@ var/global/Holiday = null ////////////////////////////////////////////////////////////////////////////////////////////////////////// // ~Carn +/hook/startup/proc/updateHoliday() + Get_Holiday() + return 1 + //sets up the Holiday global variable. Shouldbe called on game configuration or something. /proc/Get_Holiday() if(!Holiday) return // Holiday stuff was not enabled in the config! diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 3dbdd7c4e19..e974172eb85 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -128,6 +128,8 @@ var/global/datum/controller/gameticker/ticker data_core.manifest() current_state = GAME_STATE_PLAYING + callHook("roundstart") + //here to initialize the random events nicely at round start setup_economy() @@ -375,6 +377,8 @@ var/global/datum/controller/gameticker/ticker declare_completion() spawn(50) + callHook("roundend") + if (mode.station_was_nuked) feedback_set_details("end_proper","nuke") if(!delay_end) diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm index b7e76239428..ec1dd4491d2 100644 --- a/code/game/jobs/whitelist.dm +++ b/code/game/jobs/whitelist.dm @@ -2,6 +2,11 @@ var/list/whitelist = list() +/hook/startup/proc/loadWhitelist() + if(config.usewhitelist) + load_whitelist() + return 1 + /proc/load_whitelist() whitelist = file2list(WHITELISTFILE) if(!whitelist.len) whitelist = null @@ -39,9 +44,14 @@ var/list/whitelist = list() -var/list/alien_whitelist = list() +/var/list/alien_whitelist = list() -proc/load_alienwhitelist() +/hook/startup/proc/loadAlienWhitelist() + if(config.usealienwhitelist) + load_alienwhitelist() + return 1 + +/proc/load_alienwhitelist() var/text = file2text("config/alienwhitelist.txt") if (!text) diary << "Failed to load config/alienwhitelist.txt\n" diff --git a/code/modules/admin/NewBan.dm b/code/modules/admin/NewBan.dm index 83447d1a239..035b2d23096 100644 --- a/code/modules/admin/NewBan.dm +++ b/code/modules/admin/NewBan.dm @@ -58,6 +58,9 @@ var/savefile/Banlist CMinutes = (world.realtime / 10) / 60 return 1 +/hook/startup/proc/loadBans() + return LoadBans() + /proc/LoadBans() Banlist = new("data/banlist.bdb") diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index eb0841c1eea..a96adec4793 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -927,14 +927,6 @@ var/global/floorIsLava = 0 message_admins("\blue [key_name_admin(usr)] toggled guests game entering [guests_allowed?"":"dis"]allowed.", 1) feedback_add_details("admin_verb","TGU") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! -/client/proc/unjobban_panel() - set name = "Unjobban Panel" - set category = "Admin" - if (src.holder) - src.holder.unjobbanpanel() - feedback_add_details("admin_verb","UJBP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - return - /datum/admins/proc/output_ai_laws() var/ai_number = 0 for(var/mob/living/silicon/S in mob_list) diff --git a/code/modules/admin/admin_investigate.dm b/code/modules/admin/admin_investigate.dm index e601f069c68..a0627884385 100644 --- a/code/modules/admin/admin_investigate.dm +++ b/code/modules/admin/admin_investigate.dm @@ -11,6 +11,10 @@ /proc/investigate_subject2file(var/subject) return file("[INVESTIGATE_DIR][subject].html") +/hook/startup/proc/resetInvestigate() + investigate_reset() + return 1 + /proc/investigate_reset() if(fdel(INVESTIGATE_DIR)) return 1 return 0 diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 6b58909621b..22d32755e6d 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -75,9 +75,7 @@ var/list/admin_verbs_admin = list( ) var/list/admin_verbs_ban = list( /client/proc/unban_panel, - /client/proc/jobbans, - // /client/proc/unjobban_panel, - // /client/proc/DB_ban_panel + /client/proc/jobbans ) var/list/admin_verbs_sounds = list( /client/proc/play_local_sound, diff --git a/code/modules/admin/banjob.dm b/code/modules/admin/banjob.dm index dff676bfbf8..3ae14b22a31 100644 --- a/code/modules/admin/banjob.dm +++ b/code/modules/admin/banjob.dm @@ -48,6 +48,10 @@ DEBUG jobban_loadbanfile() */ +/hook/startup/proc/loadJobBans() + jobban_loadbanfile() + return 1 + /proc/jobban_loadbanfile() if(config.ban_legacy_system) var/savefile/S=new("data/job_full.ban") @@ -99,15 +103,6 @@ DEBUG text2file(formatted_log,"data/ban_unban_log.txt") -/proc/jobban_updatelegacybans() - if(!jobban_runonce) - log_admin("Updating jobbanfile!") - // Updates bans.. Or fixes them. Either way. - for(var/T in jobban_keylist) - if(!T) continue - jobban_runonce++ //don't run this update again - - /proc/jobban_remove(X) for (var/i = 1; i <= length(jobban_keylist); i++) if( findtext(jobban_keylist[i], "[X]") ) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 9be088bb426..aa540d04501 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -982,19 +982,6 @@ if("Cancel") return - else if(href_list["unjobbanf"]) - if(!check_rights(R_BAN)) return - - var/banfolder = href_list["unjobbanf"] - Banlist.cd = "/base/[banfolder]" - var/key = Banlist["key"] - if(alert(usr, "Are you sure you want to unban [key]?", "Confirmation", "Yes", "No") == "Yes") - if (RemoveBanjob(banfolder)) - unjobbanpanel() - else - alert(usr,"This ban has already been lifted / does not exist.","Error","Ok") - unjobbanpanel() - else if(href_list["mute"]) if(!check_rights(R_ADMIN)) return diff --git a/code/modules/ext_scripts/irc.dm b/code/modules/ext_scripts/irc.dm index c8dc3bfc48c..41003052fd5 100644 --- a/code/modules/ext_scripts/irc.dm +++ b/code/modules/ext_scripts/irc.dm @@ -4,16 +4,15 @@ return /proc/send2mainirc(var/msg) - if(config.use_irc_bot && config.main_irc && config.irc_bot_host) - ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [config.main_irc] [msg]") + if(config.main_irc) + send2irc(config.main_irc, msg) return /proc/send2adminirc(var/msg) - if(config.use_irc_bot && config.admin_irc && config.irc_bot_host) - ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [config.admin_irc] [msg]") + if(config.admin_irc) + send2irc(config.admin_irc, msg) return /hook/startup/proc/ircNotify() send2mainirc("Server starting up on [config.server? "byond://[config.server]" : "byond://[world.address]:[world.port]"]") return 1 - diff --git a/code/modules/mob/living/silicon/pai/recruit.dm b/code/modules/mob/living/silicon/pai/recruit.dm index e007298c5c5..fd2c6fc99d9 100644 --- a/code/modules/mob/living/silicon/pai/recruit.dm +++ b/code/modules/mob/living/silicon/pai/recruit.dm @@ -12,6 +12,12 @@ var/datum/paiController/paiController // Global handler for pAI candidates var/comments var/ready = 0 + +/hook/startup/proc/paiControllerSetup() + paiController = new /datum/paiController() + return 1 + + /datum/paiController var/list/pai_candidates = list() var/list/asked = list() diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index ebfdc10c312..636971a0177 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -89,6 +89,9 @@ // rebuild all power networks from scratch +/hook/startup/proc/buildPowernets() + return makepowernets() + /proc/makepowernets() for(var/datum/powernet/PN in powernets) del(PN) @@ -111,6 +114,8 @@ if(!M.powernet) continue // APCs have powernet=0 so they don't count as network nodes directly M.powernet.nodes[M] = M + return 1 + // returns a list of all power-related objects (nodes, cable, junctions) in turf, // excluding source, that match the direction d diff --git a/code/world.dm b/code/world.dm index de470d98e81..492ca853bcc 100644 --- a/code/world.dm +++ b/code/world.dm @@ -24,62 +24,14 @@ if(config && config.log_runtimes) log = file("data/logs/runtime/[time2text(world.realtime,"YYYY-MM-DD-(hh-mm-ss)")]-runtime.log") - make_datum_references_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once) - load_configuration() - load_mode() - load_motd() - load_admins() - load_mods() - LoadBansjob() - if(config.usewhitelist) - load_whitelist() - if(config.usealienwhitelist) - load_alienwhitelist() - jobban_loadbanfile() - appearance_loadbanfile() - jobban_updatelegacybans() - LoadBans() SetupHooks() // /vg/ if(config && config.server_name != null && config.server_suffix && world.port > 0) // dumb and hardcoded but I don't care~ config.server_name += " #[(world.port % 1000) / 100]" - investigate_reset() - Get_Holiday() //~Carn, needs to be here when the station is named so :P - - src.update_status() - - makepowernets() - - sun = new /datum/sun() - radio_controller = new /datum/controller/radio() - data_core = new /obj/effect/datacore() - crafting_master = new /datum/crafting_controller() - paiController = new /datum/paiController() - - if(!setup_database_connection()) - world.log << "Your server failed to establish a connection with the feedback database." - else - world.log << "Feedback database connection established." - - if(!setup_old_database_connection()) - world.log << "Your server failed to establish a connection with the tgstation database." - else - world.log << "Tgstation database connection established." - - plmaster = new /obj/effect/overlay() - plmaster.icon = 'icons/effects/tile_effects.dmi' - plmaster.icon_state = "plasma" - plmaster.layer = FLY_LAYER - plmaster.mouse_opacity = 0 - - slmaster = new /obj/effect/overlay() - slmaster.icon = 'icons/effects/tile_effects.dmi' - slmaster.icon_state = "sleeping_agent" - slmaster.layer = FLY_LAYER - slmaster.mouse_opacity = 0 + callHook("startup") src.update_status() @@ -87,17 +39,10 @@ sleep_offline = 1 - send2mainirc("Server starting up on [config.server? "byond://[config.server]" : "byond://[world.address]:[world.port]"]") - master_controller = new /datum/controller/game_controller() spawn(1) master_controller.setup() - setup_species() - - process_teleport_locs() //Sets up the wizard teleport locations - process_ghost_teleport_locs() //Sets up ghost teleport locations. - spawn(3000) //so we aren't adding to the round-start lag if(config.ToRban) ToRban_autoupdate() @@ -302,8 +247,13 @@ var/world_topic_spam_protect_time = world.timeofday for(var/obj/item/W in C) C.drop_from_inventory(W) del(C) -#undef DISCONNECTED_DELETE +#undef INACTIVITY_KICK */ + +/hook/startup/proc/loadMode() + world.load_mode() + return 1 + /world/proc/load_mode() var/list/Lines = file2list("data/mode.txt") if(Lines.len) @@ -316,9 +266,15 @@ var/world_topic_spam_protect_time = world.timeofday fdel(F) F << the_mode + +/hook/startup/proc/loadMOTD() + world.load_motd() + return 1 + /world/proc/load_motd() join_motd = file2text("config/motd.txt") + /world/proc/load_configuration() config = new /datum/configuration() config.load("config/config.txt") @@ -326,6 +282,11 @@ var/world_topic_spam_protect_time = world.timeofday config.loadsql("config/dbconfig.txt") config.loadforumsql("config/forumdbconfig.txt") // apply some settings from config.. + +/hook/startup/proc/loadMods() + world.load_mods() + return 1 + /world/proc/load_mods() if(config.admin_legacy_system) var/text = file2text("config/moderators.txt") @@ -414,6 +375,13 @@ var/world_topic_spam_protect_time = world.timeofday var/failed_db_connections = 0 var/failed_old_db_connections = 0 +/hook/startup/proc/connectDB() + if(!setup_database_connection()) + world.log << "Your server failed to establish a connection with the feedback database." + else + world.log << "Feedback database connection established." + return 1 + proc/setup_database_connection() if(failed_db_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to conenct anymore. @@ -449,7 +417,12 @@ proc/establish_db_connection() return 1 - +/hook/startup/proc/connectOldDB() + if(!setup_old_database_connection()) + world.log << "Your server failed to establish a connection with the SQL database." + else + world.log << "SQL database connection established." + return 1 //These two procs are for the old database, while it's being phased out. See the tgstation.sql file in the SQL folder for more information. proc/setup_old_database_connection()