mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 19:52:40 +00:00
Implements hooks, an easier way to write code to be called at startup/roundstart/roundend.
Current hooks are "startup", "roundstart", and "roundend". Most stuff in world/New() has been moved over to the startup hook. Roundstart and roundend have no hooks yet. Removed the unused "newbanjob.dm" file and associated verbs/topics. Bumped RECOMMENDED_VERSION up to 501. Signed-off-by: Mloc-Argent <colmohici@gmail.com>
This commit is contained in:
@@ -77,6 +77,7 @@
|
|||||||
#include "code\controllers\_DynamicAreaLighting_TG.dm"
|
#include "code\controllers\_DynamicAreaLighting_TG.dm"
|
||||||
#include "code\controllers\configuration.dm"
|
#include "code\controllers\configuration.dm"
|
||||||
#include "code\controllers\failsafe.dm"
|
#include "code\controllers\failsafe.dm"
|
||||||
|
#include "code\controllers\hooks.dm"
|
||||||
#include "code\controllers\lighting_controller.dm"
|
#include "code\controllers\lighting_controller.dm"
|
||||||
#include "code\controllers\master_controller.dm"
|
#include "code\controllers\master_controller.dm"
|
||||||
#include "code\controllers\shuttle_controller.dm"
|
#include "code\controllers\shuttle_controller.dm"
|
||||||
@@ -650,7 +651,6 @@
|
|||||||
#include "code\modules\admin\holder2.dm"
|
#include "code\modules\admin\holder2.dm"
|
||||||
#include "code\modules\admin\IsBanned.dm"
|
#include "code\modules\admin\IsBanned.dm"
|
||||||
#include "code\modules\admin\NewBan.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_notes.dm"
|
||||||
#include "code\modules\admin\player_panel.dm"
|
#include "code\modules\admin\player_panel.dm"
|
||||||
#include "code\modules\admin\topic.dm"
|
#include "code\modules\admin\topic.dm"
|
||||||
|
|||||||
@@ -14,6 +14,20 @@ What are the archived variables for?
|
|||||||
#define QUANTIZE(variable) (round(variable,0.0001))
|
#define QUANTIZE(variable) (round(variable,0.0001))
|
||||||
#define TRANSFER_FRACTION 5 //What fraction (1/#) of the air difference to try and transfer
|
#define TRANSFER_FRACTION 5 //What fraction (1/#) of the air difference to try and transfer
|
||||||
|
|
||||||
|
/hook/startup/proc/createGasOverlays()
|
||||||
|
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
|
||||||
|
return 1
|
||||||
|
|
||||||
/datum/gas/sleeping_agent/specific_heat = 40 //These are used for the "Trace Gases" stuff, but is buggy.
|
/datum/gas/sleeping_agent/specific_heat = 40 //These are used for the "Trace Gases" stuff, but is buggy.
|
||||||
|
|
||||||
/datum/gas/oxygen_agent_b/specific_heat = 300
|
/datum/gas/oxygen_agent_b/specific_heat = 300
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel", "Satchel Al
|
|||||||
/////Initial Building/////
|
/////Initial Building/////
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
|
||||||
/proc/make_datum_references_lists()
|
/hook/startup/proc/makeDatumRefLists()
|
||||||
var/list/paths
|
var/list/paths
|
||||||
|
|
||||||
//Hair - Initialise all /datum/sprite_accessory/hair into an list indexed by hair-style name
|
//Hair - Initialise all /datum/sprite_accessory/hair into an list indexed by hair-style name
|
||||||
@@ -97,6 +97,8 @@ var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel", "Satchel Al
|
|||||||
if(S.flags & WHITELISTED)
|
if(S.flags & WHITELISTED)
|
||||||
whitelisted_species += S.name
|
whitelisted_species += S.name
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
/* // Uncomment to debug chemical reaction list.
|
/* // Uncomment to debug chemical reaction list.
|
||||||
/client/verb/debug_chemical_list()
|
/client/verb/debug_chemical_list()
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
/hook/startup/proc/createDatacore()
|
||||||
|
data_core = new /obj/effect/datacore()
|
||||||
|
return 1
|
||||||
|
|
||||||
/obj/effect/datacore/proc/manifest(var/nosleep = 0)
|
/obj/effect/datacore/proc/manifest(var/nosleep = 0)
|
||||||
spawn()
|
spawn()
|
||||||
|
|||||||
@@ -14,6 +14,10 @@
|
|||||||
if(prob(50))
|
if(prob(50))
|
||||||
rate = -rate
|
rate = -rate
|
||||||
|
|
||||||
|
/hook/startup/proc/createSun()
|
||||||
|
sun = new /datum/sun()
|
||||||
|
return 1
|
||||||
|
|
||||||
// calculate the sun's position given the time of day
|
// calculate the sun's position given the time of day
|
||||||
|
|
||||||
/datum/sun/proc/calc_position()
|
/datum/sun/proc/calc_position()
|
||||||
|
|||||||
@@ -56,7 +56,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*/
|
/*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()
|
var/list/teleportlocs = list()
|
||||||
|
|
||||||
proc/process_teleport_locs()
|
/hook/startup/proc/setupTeleportLocs()
|
||||||
for(var/area/AR in world)
|
for(var/area/AR in world)
|
||||||
if(istype(AR, /area/shuttle) || istype(AR, /area/syndicate_station) || istype(AR, /area/wizard_station)) continue
|
if(istype(AR, /area/shuttle) || istype(AR, /area/syndicate_station) || istype(AR, /area/wizard_station)) continue
|
||||||
if(teleportlocs.Find(AR.name)) continue
|
if(teleportlocs.Find(AR.name)) continue
|
||||||
@@ -65,20 +65,13 @@ proc/process_teleport_locs()
|
|||||||
teleportlocs += AR.name
|
teleportlocs += AR.name
|
||||||
teleportlocs[AR.name] = AR
|
teleportlocs[AR.name] = AR
|
||||||
|
|
||||||
var/not_in_order = 0
|
teleportlocs = sortAssoc(teleportlocs)
|
||||||
do
|
|
||||||
not_in_order = 0
|
return 1
|
||||||
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)
|
|
||||||
|
|
||||||
var/list/ghostteleportlocs = list()
|
var/list/ghostteleportlocs = list()
|
||||||
|
|
||||||
proc/process_ghost_teleport_locs()
|
/hook/startup/proc/setupGhostTeleportLocs()
|
||||||
for(var/area/AR in world)
|
for(var/area/AR in world)
|
||||||
if(ghostteleportlocs.Find(AR.name)) continue
|
if(ghostteleportlocs.Find(AR.name)) continue
|
||||||
if(istype(AR, /area/turret_protected/aisat) || istype(AR, /area/derelict) || istype(AR, /area/tdome))
|
if(istype(AR, /area/turret_protected/aisat) || istype(AR, /area/derelict) || istype(AR, /area/tdome))
|
||||||
@@ -89,17 +82,9 @@ proc/process_ghost_teleport_locs()
|
|||||||
ghostteleportlocs += AR.name
|
ghostteleportlocs += AR.name
|
||||||
ghostteleportlocs[AR.name] = AR
|
ghostteleportlocs[AR.name] = AR
|
||||||
|
|
||||||
var/not_in_order = 0
|
ghostteleportlocs = sortAssoc(ghostteleportlocs)
|
||||||
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)
|
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
@@ -140,6 +140,10 @@ var/const/RADIO_MAGNETS = "9"
|
|||||||
|
|
||||||
var/global/datum/controller/radio/radio_controller
|
var/global/datum/controller/radio/radio_controller
|
||||||
|
|
||||||
|
/hook/startup/proc/createRadioController()
|
||||||
|
radio_controller = new /datum/controller/radio()
|
||||||
|
return 1
|
||||||
|
|
||||||
datum/controller/radio
|
datum/controller/radio
|
||||||
var/list/datum/radio_frequency/frequencies = list()
|
var/list/datum/radio_frequency/frequencies = list()
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ var/global/Holiday = null
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// ~Carn
|
// ~Carn
|
||||||
|
|
||||||
|
/hook/startup/proc/updateHoliday()
|
||||||
|
Get_Holiday()
|
||||||
|
return 1
|
||||||
|
|
||||||
//sets up the Holiday global variable. Shouldbe called on game configuration or something.
|
//sets up the Holiday global variable. Shouldbe called on game configuration or something.
|
||||||
/proc/Get_Holiday()
|
/proc/Get_Holiday()
|
||||||
if(!Holiday) return // Holiday stuff was not enabled in the config!
|
if(!Holiday) return // Holiday stuff was not enabled in the config!
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ var/global/datum/controller/gameticker/ticker
|
|||||||
data_core.manifest()
|
data_core.manifest()
|
||||||
current_state = GAME_STATE_PLAYING
|
current_state = GAME_STATE_PLAYING
|
||||||
|
|
||||||
|
callHook("roundstart")
|
||||||
|
|
||||||
//here to initialize the random events nicely at round start
|
//here to initialize the random events nicely at round start
|
||||||
setup_economy()
|
setup_economy()
|
||||||
@@ -323,6 +324,8 @@ var/global/datum/controller/gameticker/ticker
|
|||||||
declare_completion()
|
declare_completion()
|
||||||
|
|
||||||
spawn(50)
|
spawn(50)
|
||||||
|
callHook("roundend")
|
||||||
|
|
||||||
if (mode.station_was_nuked)
|
if (mode.station_was_nuked)
|
||||||
feedback_set_details("end_proper","nuke")
|
feedback_set_details("end_proper","nuke")
|
||||||
if(!delay_end)
|
if(!delay_end)
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
var/list/whitelist = list()
|
var/list/whitelist = list()
|
||||||
|
|
||||||
|
/hook/startup/proc/loadWhitelist()
|
||||||
|
if(config.usewhitelist)
|
||||||
|
load_whitelist()
|
||||||
|
return 1
|
||||||
|
|
||||||
/proc/load_whitelist()
|
/proc/load_whitelist()
|
||||||
whitelist = file2list(WHITELISTFILE)
|
whitelist = file2list(WHITELISTFILE)
|
||||||
if(!whitelist.len) whitelist = null
|
if(!whitelist.len) whitelist = null
|
||||||
@@ -11,9 +16,14 @@ var/list/whitelist = list()
|
|||||||
return 0
|
return 0
|
||||||
return ("[M.ckey]" in whitelist)
|
return ("[M.ckey]" in whitelist)
|
||||||
|
|
||||||
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")
|
var/text = file2text("config/alienwhitelist.txt")
|
||||||
if (!text)
|
if (!text)
|
||||||
diary << "Failed to load config/alienwhitelist.txt\n"
|
diary << "Failed to load config/alienwhitelist.txt\n"
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ var/savefile/Banlist
|
|||||||
CMinutes = (world.realtime / 10) / 60
|
CMinutes = (world.realtime / 10) / 60
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
/hook/startup/proc/loadBans()
|
||||||
|
return LoadBans()
|
||||||
|
|
||||||
/proc/LoadBans()
|
/proc/LoadBans()
|
||||||
|
|
||||||
Banlist = new("data/banlist.bdb")
|
Banlist = new("data/banlist.bdb")
|
||||||
|
|||||||
@@ -1014,14 +1014,6 @@ var/global/floorIsLava = 0
|
|||||||
message_admins("\blue [key_name_admin(usr)] toggled guests game entering [guests_allowed?"":"dis"]allowed.", 1)
|
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!
|
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()
|
/datum/admins/proc/output_ai_laws()
|
||||||
var/ai_number = 0
|
var/ai_number = 0
|
||||||
for(var/mob/living/silicon/S in mob_list)
|
for(var/mob/living/silicon/S in mob_list)
|
||||||
|
|||||||
@@ -11,6 +11,10 @@
|
|||||||
/proc/investigate_subject2file(var/subject)
|
/proc/investigate_subject2file(var/subject)
|
||||||
return file("[INVESTIGATE_DIR][subject].html")
|
return file("[INVESTIGATE_DIR][subject].html")
|
||||||
|
|
||||||
|
/hook/startup/proc/resetInvestigate()
|
||||||
|
investigate_reset()
|
||||||
|
return 1
|
||||||
|
|
||||||
/proc/investigate_reset()
|
/proc/investigate_reset()
|
||||||
if(fdel(INVESTIGATE_DIR)) return 1
|
if(fdel(INVESTIGATE_DIR)) return 1
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -53,6 +53,10 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/hook/startup/proc/loadAdmins()
|
||||||
|
load_admins()
|
||||||
|
return 1
|
||||||
|
|
||||||
/proc/load_admins()
|
/proc/load_admins()
|
||||||
//clear the datums references
|
//clear the datums references
|
||||||
admin_datums.Cut()
|
admin_datums.Cut()
|
||||||
|
|||||||
@@ -74,9 +74,7 @@ var/list/admin_verbs_admin = list(
|
|||||||
)
|
)
|
||||||
var/list/admin_verbs_ban = list(
|
var/list/admin_verbs_ban = list(
|
||||||
/client/proc/unban_panel,
|
/client/proc/unban_panel,
|
||||||
/client/proc/jobbans,
|
/client/proc/jobbans
|
||||||
/client/proc/unjobban_panel,
|
|
||||||
// /client/proc/DB_ban_panel
|
|
||||||
)
|
)
|
||||||
var/list/admin_verbs_sounds = list(
|
var/list/admin_verbs_sounds = list(
|
||||||
/client/proc/play_local_sound,
|
/client/proc/play_local_sound,
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ DEBUG
|
|||||||
jobban_loadbanfile()
|
jobban_loadbanfile()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/hook/startup/proc/loadJobBans()
|
||||||
|
jobban_loadbanfile()
|
||||||
|
return 1
|
||||||
|
|
||||||
/proc/jobban_loadbanfile()
|
/proc/jobban_loadbanfile()
|
||||||
if(config.ban_legacy_system)
|
if(config.ban_legacy_system)
|
||||||
var/savefile/S=new("data/job_full.ban")
|
var/savefile/S=new("data/job_full.ban")
|
||||||
@@ -101,15 +105,6 @@ DEBUG
|
|||||||
text2file(formatted_log,"data/ban_unban_log.txt")
|
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)
|
/proc/jobban_remove(X)
|
||||||
for (var/i = 1; i <= length(jobban_keylist); i++)
|
for (var/i = 1; i <= length(jobban_keylist); i++)
|
||||||
if( findtext(jobban_keylist[i], "[X]") )
|
if( findtext(jobban_keylist[i], "[X]") )
|
||||||
|
|||||||
@@ -874,19 +874,6 @@
|
|||||||
if("Cancel")
|
if("Cancel")
|
||||||
return
|
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"])
|
else if(href_list["mute"])
|
||||||
if(!check_rights(R_MOD,0) && !check_rights(R_ADMIN)) return
|
if(!check_rights(R_MOD,0) && !check_rights(R_ADMIN)) return
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,16 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
/proc/send2mainirc(var/msg)
|
/proc/send2mainirc(var/msg)
|
||||||
if(config.use_irc_bot && config.main_irc && config.irc_bot_host)
|
if(config.main_irc)
|
||||||
ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [config.main_irc] [msg]")
|
send2irc(config.main_irc, msg)
|
||||||
return
|
return
|
||||||
|
|
||||||
/proc/send2adminirc(var/msg)
|
/proc/send2adminirc(var/msg)
|
||||||
if(config.use_irc_bot && config.admin_irc && config.irc_bot_host)
|
if(config.admin_irc)
|
||||||
ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [config.admin_irc] [msg]")
|
send2irc(config.admin_irc, msg)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
/hook/startup/proc/ircNotify()
|
||||||
|
send2mainirc("Server starting up on [config.server? "byond://[config.server]" : "byond://[world.address]:[world.port]"]")
|
||||||
|
return 1
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ var/datum/paiController/paiController // Global handler for pAI candidates
|
|||||||
var/ready = 0
|
var/ready = 0
|
||||||
|
|
||||||
|
|
||||||
|
/hook/startup/proc/paiControllerSetup()
|
||||||
|
paiController = new /datum/paiController()
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
/datum/paiController
|
/datum/paiController
|
||||||
var/list/pai_candidates = list()
|
var/list/pai_candidates = list()
|
||||||
|
|||||||
@@ -79,6 +79,9 @@
|
|||||||
|
|
||||||
// rebuild all power networks from scratch
|
// rebuild all power networks from scratch
|
||||||
|
|
||||||
|
/hook/startup/proc/buildPowernets()
|
||||||
|
return makepowernets()
|
||||||
|
|
||||||
/proc/makepowernets()
|
/proc/makepowernets()
|
||||||
for(var/datum/powernet/PN in powernets)
|
for(var/datum/powernet/PN in powernets)
|
||||||
del(PN)
|
del(PN)
|
||||||
@@ -101,6 +104,8 @@
|
|||||||
if(!M.powernet) continue // APCs have powernet=0 so they don't count as network nodes directly
|
if(!M.powernet) continue // APCs have powernet=0 so they don't count as network nodes directly
|
||||||
M.powernet.nodes[M] = M
|
M.powernet.nodes[M] = M
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
// returns a list of all power-related objects (nodes, cable, junctions) in turf,
|
// returns a list of all power-related objects (nodes, cable, junctions) in turf,
|
||||||
// excluding source, that match the direction d
|
// excluding source, that match the direction d
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define RECOMMENDED_VERSION 495
|
#define RECOMMENDED_VERSION 501
|
||||||
/world/New()
|
/world/New()
|
||||||
//logs
|
//logs
|
||||||
var/date_string = time2text(world.realtime, "YYYY/MM-Month/DD-Day")
|
var/date_string = time2text(world.realtime, "YYYY/MM-Month/DD-Day")
|
||||||
@@ -22,59 +22,13 @@
|
|||||||
if(byond_version < RECOMMENDED_VERSION)
|
if(byond_version < RECOMMENDED_VERSION)
|
||||||
world.log << "Your server's byond version does not meet the recommended requirements for this server. Please update BYOND"
|
world.log << "Your server's byond version does not meet the recommended requirements for this server. Please update BYOND"
|
||||||
|
|
||||||
make_datum_references_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once)
|
|
||||||
|
|
||||||
load_configuration()
|
load_configuration()
|
||||||
load_mode()
|
|
||||||
load_motd()
|
|
||||||
load_admins()
|
|
||||||
load_mods()
|
|
||||||
LoadBansjob()
|
|
||||||
if(config.usewhitelist)
|
|
||||||
load_whitelist()
|
|
||||||
if(config.usealienwhitelist)
|
|
||||||
load_alienwhitelist()
|
|
||||||
jobban_loadbanfile()
|
|
||||||
jobban_updatelegacybans()
|
|
||||||
LoadBans()
|
|
||||||
|
|
||||||
if(config && config.server_name != null && config.server_suffix && world.port > 0)
|
if(config && config.server_name != null && config.server_suffix && world.port > 0)
|
||||||
// dumb and hardcoded but I don't care~
|
// dumb and hardcoded but I don't care~
|
||||||
config.server_name += " #[(world.port % 1000) / 100]"
|
config.server_name += " #[(world.port % 1000) / 100]"
|
||||||
|
|
||||||
investigate_reset()
|
callHook("startup")
|
||||||
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()
|
|
||||||
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 SQL database."
|
|
||||||
else
|
|
||||||
world.log << "SQL 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
|
|
||||||
|
|
||||||
src.update_status()
|
src.update_status()
|
||||||
|
|
||||||
@@ -82,15 +36,10 @@
|
|||||||
|
|
||||||
sleep_offline = 1
|
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()
|
master_controller = new /datum/controller/game_controller()
|
||||||
spawn(1)
|
spawn(1)
|
||||||
master_controller.setup()
|
master_controller.setup()
|
||||||
|
|
||||||
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
|
spawn(3000) //so we aren't adding to the round-start lag
|
||||||
if(config.ToRban)
|
if(config.ToRban)
|
||||||
ToRban_autoupdate()
|
ToRban_autoupdate()
|
||||||
@@ -184,6 +133,10 @@
|
|||||||
#undef INACTIVITY_KICK
|
#undef INACTIVITY_KICK
|
||||||
|
|
||||||
|
|
||||||
|
/hook/startup/proc/loadMode()
|
||||||
|
world.load_mode()
|
||||||
|
return 1
|
||||||
|
|
||||||
/world/proc/load_mode()
|
/world/proc/load_mode()
|
||||||
var/list/Lines = file2list("data/mode.txt")
|
var/list/Lines = file2list("data/mode.txt")
|
||||||
if(Lines.len)
|
if(Lines.len)
|
||||||
@@ -196,9 +149,15 @@
|
|||||||
fdel(F)
|
fdel(F)
|
||||||
F << the_mode
|
F << the_mode
|
||||||
|
|
||||||
|
|
||||||
|
/hook/startup/proc/loadMOTD()
|
||||||
|
world.load_motd()
|
||||||
|
return 1
|
||||||
|
|
||||||
/world/proc/load_motd()
|
/world/proc/load_motd()
|
||||||
join_motd = file2text("config/motd.txt")
|
join_motd = file2text("config/motd.txt")
|
||||||
|
|
||||||
|
|
||||||
/world/proc/load_configuration()
|
/world/proc/load_configuration()
|
||||||
config = new /datum/configuration()
|
config = new /datum/configuration()
|
||||||
config.load("config/config.txt")
|
config.load("config/config.txt")
|
||||||
@@ -208,6 +167,11 @@
|
|||||||
// apply some settings from config..
|
// apply some settings from config..
|
||||||
abandon_allowed = config.respawn
|
abandon_allowed = config.respawn
|
||||||
|
|
||||||
|
|
||||||
|
/hook/startup/proc/loadMods()
|
||||||
|
world.load_mods()
|
||||||
|
return 1
|
||||||
|
|
||||||
/world/proc/load_mods()
|
/world/proc/load_mods()
|
||||||
if(config.admin_legacy_system)
|
if(config.admin_legacy_system)
|
||||||
var/text = file2text("config/moderators.txt")
|
var/text = file2text("config/moderators.txt")
|
||||||
@@ -290,6 +254,13 @@
|
|||||||
var/failed_db_connections = 0
|
var/failed_db_connections = 0
|
||||||
var/failed_old_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()
|
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.
|
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.
|
||||||
@@ -325,7 +296,12 @@ proc/establish_db_connection()
|
|||||||
return 1
|
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.
|
//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()
|
proc/setup_old_database_connection()
|
||||||
|
|||||||
Reference in New Issue
Block a user