mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-03 05:52:43 +00:00
* Removes Captain as a title, sets default to Station Administrator, and adds a new title, Site Manager * Fix atmo_control interface temperature reading * Adds Multiple Alternative Titles * Removed Supply Assistant * Removed Sergeant * Removed Computer Scientist * Revert "Revert "Frame Cleanup"" This reverts commit82722ba42f. * Changed Supply Officer to Requisitions Officer * Changed Requisitions Officer to Supply Chief and Removed Courier * Removed Life Support Technician * Removed Brig Officer * Tweaks the lowest level of heat damage to be less insane * Corrects damage amount for heat_damage_level_1 * Maybe Perhaps Last Major Technomancer PR Adds ability to sort the spells section of the catalog into categories. The categories available are 'All', 'Offensive', 'Defensive', 'Utility', and 'Support'. Removes preset section on catalog as it was unused. Projectile spells now have a sound when fired. Haste lasts five seconds instead of three. Repel Missiles lasts for five minutes instead of two. All healing spells work five times as fast, healing in five seconds instead of twenty five seconds. The amount of instability and healing done has been multiplied to remain consistent. Passwall can now be used on more than just walls, if there's something dense on the same tile. Force Missile is now 25% cheaper to cast, and has a cooldown of .5 seconds instead of one second, and does 5 more damage. Beam's damage is increased by 10, and energy cost decreased by 25%. Lightning's warm-up time is now one second instead of two. Overload now costs 10% of total energy instead of 15%, and damage scaled with 4% of their current energy reserves, and 5% with the Scepter, instead of 3%/4%. Additionally, instability per shot is lowered to 12 from 15. Track now costs 25 points instead of 30 in the catalog, because roundness. Fire Aura should look more impressive without a Scepter. Fixes bug where shooting Lightning made you motionless for twenty seconds. * Adds Multiple New Clothing Items * Makes Loincloths only Availiable to Taj and Unathi * Tweaks the contents of the captain's closet * Smokables now give an approximation of how much longer they'll burn once lit * make teshari not bad to play * Tea Tweaks - Minor changes to the color of some of the drinks such as tea and iced tea. Still not happy with the colors, but they seem better than before. - Modification to the British cup sprite. - Addition of a tea sprite for the coffee cups. * fixes exception handling runtiming * Adds missing error handler that made it difficult to debug runtimes. * Corrects error handling proc * Adds missing runtime viewer Topic calls. Relocates them to the datum itself rather than it being an admin topic for maximum self-containment. Also adds 'adminplayerobservefollow', making it possible for admins to not only jump to mobs but also follow them with a single click. Misc tweaks from Paradise. * gib population * Adds the ash() mob proc, preps ninja suit * Fixes #2352 * Changelog * alt title * Rigs now have suit coolers * Map edit - Fixes lighting in Security. Again. - Fixes lighting in Library. - Adds a new maint tunnel between engineering solars and atmos, now outside the blast radius of SME explosions. * Almost forgot emergency shutters. * Examine Cigarette Lore * Fixes Capitalization * Eliminates colon * Should clear up the usr issue * Fixes cryopods of all types not setting occupant correctly. * updates changelog * Fixes runtime that occured if someone touched a blast door with an empty hand. * Fixes check_rights() runtime. * Adds magboots to ling spacesuits * Adds Changelog * Turret Fix Turrets can now deploy properly and not be stuck in a state of deploying forever if a target is in range. * Revert "Adds hub passwordu" * Makes changeling recursive enhancement a passive power * Corrects a description * Adss changelog * Add files via upload * Changeling/Wizard/Future Stuff Hud Button Fix Hopefully this stops the roundstop changeling hud wonkiness. * Changes Mining Hardsuit slowdown to 1, from 3 * Widened hallway * Speeds up arm_guard and leg_guard wearers slightly * Forgot to use map cleanup tool. * Adds changelog * Adds changelog * Minor Emitter Tweaks Emitters no longer die by shooting a taser or laser tag gun at it. Emitters don't explode if they are not on a powered wire with sufficient electricity in it. They will just crumple away instead if integrity is reduced to zero. Taking any damage to the emitter no longer results in instant death due to me being an idiot awhile ago. Emitters can be examined to see if they are damaged, and can be repaired by applying metal sheets to it. * Github, stop being stupid! * Tweaks Sec Voidsuit values * Fixes external airlocks * Elevator-MMI fix * Shoveling Snow * Laptop ID Computer Fix The manifest should now be updated correctly when using laptops. * do_after is more immersive * Fixes second bug involving inability to change title to station admin. * Adds more unathi hair and facial options * Adds the changelog * Retweaks secret player requirements * Updates changelog * Fixes sprite not updating to not be floating when leaving non-gravity * Adds changelog * Fixes changeling revive not working when you're missing a limb * Fixes #860 * Adds changelog * Makes flash confused duration the same length as the flash blurry eyes * Increases the change of lung rupturing * Adds vomit as an emote * Adds changelog * Removes revolution shuttle delay * Adds changelog * Projectile flash rounds will now do the same as a flash when hitting a target * Adds changelog * Fixes dna-lockable gun explosion security level * Drink Container Lore * Decapitalizes 'Sleeper' Because Why * Fixes Grammatical/Flow/Sarcasm Errors * Completes dna lockable guns implementation by adding a dna chip that can be added to guns * Fixes + forgotten file * Moves DNA locking stuff down to the item level rather than gun, also adds the ability to emag to remove the lock * Adds changelog * Adds the ability to wear ponchos as an accessory, also adds the ability to have ponchos as a suit accessory * Adds changelog * Closes 2 missing spans * Adds secure briefcase to custom loadout * Adds changelog * Headgear Additions, and an Undershirt * Medical splint buff and new ghetto splints. Adds hands and feet to splint-splintable organs. Also adds ghetto splints that can't do hands and feet. * Fixed Sleeper... Again * Renames "poncho" slot to "over" * Speeds Hyperzine metabolism * 1.5.8 Map bug fixes -Fixed brit cup sprite. - Replaced a maintenance door leading into atmospherics with one with the proper access. - Fixed Missing Disposals pipe next to atmos. - Tweaked some light placement in the main hallways. - AI core redesign. - Turned off medbay lobby intercom. - Cyborg charging station added to prison wing. - Cyborg charging station added to the research outpost. - Medical rig suit added to medical. - EVA rig suit for engineering added to EVA. - Second residential elevator installed. Due to budget cuts the size of the elevators has been reduced. * Updates changelog * Sombrero Code * Fixes #2365 * Adds changelog * Sleeper is evil. * no message * Changelog * Stops observers from leaving prints on the ground. No more spooking the mortals, ghosts. * Allows autotraitor in secret to start with 0 players * Adds changelog * Makes diona slightly less slow * Adds changelog * Bowling Shirts * Updates changelog * Adds a missing description * Flat Cap Changes and Hair Bow * Fixed Error * Adds an in-hand * Lower Torso cannot be amputated * Smoke works, adds changelog * Updates changelog * Makes Unathi Voidsuits Less Fat * Medical related fixes * Fuzzy Cuffs * Tube Top * Made Icons for Security Suit Less Gaunt * Revert "Medical related fixes" This reverts commitd7c59520e6. * Just the fix to random med item now * Fixes Evening Glove Coloring * HAZMAT Suits * Changes Unathi sprite slightly * Tweaks skirt pathing * Corrects changelog * Adds changelog * Construction Voidsuits * makes people bleed real good * adderino changeling * Revert "Revert "Adds hub passwordu"" * Explosive implants should no longer gib on limbs. * I still have no idea what I am doing. * Resolves #331
657 lines
19 KiB
Plaintext
657 lines
19 KiB
Plaintext
|
|
/*
|
|
The initialization of the game happens roughly like this:
|
|
|
|
1. All global variables are initialized (including the global_init instance).
|
|
2. The map is initialized, and map objects are created.
|
|
3. world/New() runs, creating the process scheduler (and the old master controller) and spawning their setup.
|
|
4. processScheduler/setup() runs, creating all the processes. game_controller/setup() runs, calling initialize() on all movable atoms in the world.
|
|
5. The gameticker is created.
|
|
|
|
*/
|
|
var/global/datum/global_init/init = new ()
|
|
|
|
/*
|
|
Pre-map initialization stuff should go here.
|
|
*/
|
|
/datum/global_init/New()
|
|
|
|
makeDatumRefLists()
|
|
load_configuration()
|
|
|
|
initialize_chemical_reagents()
|
|
initialize_chemical_reactions()
|
|
|
|
qdel(src) //we're done
|
|
|
|
/datum/global_init/Destroy()
|
|
return 1
|
|
|
|
/world
|
|
mob = /mob/new_player
|
|
turf = /turf/space
|
|
area = /area/space
|
|
view = "15x15"
|
|
cache_lifespan = 0 //stops player uploaded stuff from being kept in the rsc past the current session
|
|
|
|
|
|
|
|
#define RECOMMENDED_VERSION 501
|
|
/world/New()
|
|
//logs
|
|
var/date_string = time2text(world.realtime, "YYYY/MM-Month/DD-Day")
|
|
href_logfile = file("data/logs/[date_string] hrefs.htm")
|
|
diary = file("data/logs/[date_string].log")
|
|
diary << "[log_end]\n[log_end]\nStarting up. [time2text(world.timeofday, "hh:mm.ss")][log_end]\n---------------------[log_end]"
|
|
changelog_hash = md5('html/changelog.html') //used for telling if the changelog has changed recently
|
|
|
|
if(byond_version < RECOMMENDED_VERSION)
|
|
world.log << "Your server's byond version does not meet the recommended requirements for this server. Please update BYOND"
|
|
|
|
config.post_load()
|
|
|
|
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]"
|
|
|
|
if(config && config.log_runtime)
|
|
log = file("data/logs/runtime/[time2text(world.realtime,"YYYY-MM-DD-(hh-mm-ss)")]-runtime.log")
|
|
|
|
callHook("startup")
|
|
//Emergency Fix
|
|
load_mods()
|
|
//end-emergency fix
|
|
|
|
src.update_status()
|
|
|
|
. = ..()
|
|
|
|
#if UNIT_TEST
|
|
log_unit_test("Unit Tests Enabled. This will destroy the world when testing is complete.")
|
|
log_unit_test("If you did not intend to enable this please check code/__defines/unit_testing.dm")
|
|
#else
|
|
sleep_offline = 1
|
|
#endif
|
|
|
|
// Set up roundstart seed list.
|
|
plant_controller = new()
|
|
|
|
// Set up roundstart gene masking
|
|
xenobio_controller = new()
|
|
|
|
// This is kinda important. Set up details of what the hell things are made of.
|
|
populate_material_list()
|
|
|
|
if(config.generate_asteroid)
|
|
// These values determine the specific area that the map is applied to.
|
|
// Because we do not use Bay's default map, we check the config file to see if custom parameters are needed, so we need to avoid hardcoding.
|
|
if(config.asteroid_z_levels)
|
|
for(var/z_level in config.asteroid_z_levels)
|
|
// In case we got fed a string instead of a number...
|
|
z_level = text2num(z_level)
|
|
if(!isnum(z_level))
|
|
// If it's still not a number, we probably got fed some nonsense string.
|
|
admin_notice("<span class='danger'>Error: ASTEROID_Z_LEVELS config wasn't given a number.</span>")
|
|
// Now for the actual map generating. This occurs for every z-level defined in the config.
|
|
new /datum/random_map/automata/cave_system(null,1,1,z_level,300,300)
|
|
// Let's add ore too.
|
|
new /datum/random_map/noise/ore(null, 1, 1, z_level, 64, 64)
|
|
else
|
|
admin_notice("<span class='danger'>Error: No asteroid z-levels defined in config!</span>")
|
|
// Update all turfs to ensure everything looks good post-generation. Yes,
|
|
// it's brute-forcey, but frankly the alternative is a mine turf rewrite.
|
|
for(var/turf/simulated/mineral/M in world) // Ugh.
|
|
M.update_icon()
|
|
|
|
// Create frame types.
|
|
populate_frame_types()
|
|
|
|
// Create robolimbs for chargen.
|
|
populate_robolimb_list()
|
|
|
|
//Must be done now, otherwise ZAS zones and lighting overlays need to be recreated.
|
|
createRandomZlevel()
|
|
|
|
processScheduler = new
|
|
master_controller = new /datum/controller/game_controller()
|
|
spawn(1)
|
|
processScheduler.deferSetupFor(/datum/controller/process/ticker)
|
|
processScheduler.setup()
|
|
master_controller.setup()
|
|
#if UNIT_TEST
|
|
initialize_unit_tests()
|
|
#endif
|
|
|
|
spawn(3000) //so we aren't adding to the round-start lag
|
|
if(config.ToRban)
|
|
ToRban_autoupdate()
|
|
|
|
#undef RECOMMENDED_VERSION
|
|
|
|
return
|
|
|
|
var/world_topic_spam_protect_ip = "0.0.0.0"
|
|
var/world_topic_spam_protect_time = world.timeofday
|
|
|
|
/world/Topic(T, addr, master, key)
|
|
diary << "TOPIC: \"[T]\", from:[addr], master:[master], key:[key][log_end]"
|
|
|
|
if (T == "ping")
|
|
var/x = 1
|
|
for (var/client/C)
|
|
x++
|
|
return x
|
|
|
|
else if(T == "players")
|
|
var/n = 0
|
|
for(var/mob/M in player_list)
|
|
if(M.client)
|
|
n++
|
|
return n
|
|
|
|
else if (copytext(T,1,7) == "status")
|
|
var/input[] = params2list(T)
|
|
var/list/s = list()
|
|
s["version"] = game_version
|
|
s["mode"] = master_mode
|
|
s["respawn"] = config.abandon_allowed
|
|
s["enter"] = config.enter_allowed
|
|
s["vote"] = config.allow_vote_mode
|
|
s["ai"] = config.allow_ai
|
|
s["host"] = host ? host : null
|
|
|
|
// This is dumb, but spacestation13.com's banners break if player count isn't the 8th field of the reply, so... this has to go here.
|
|
s["players"] = 0
|
|
s["stationtime"] = stationtime2text()
|
|
s["roundduration"] = roundduration2text()
|
|
|
|
if(input["status"] == "2")
|
|
var/list/players = list()
|
|
var/list/admins = list()
|
|
|
|
for(var/client/C in clients)
|
|
if(C.holder)
|
|
if(C.holder.fakekey)
|
|
continue
|
|
admins[C.key] = C.holder.rank
|
|
players += C.key
|
|
|
|
s["players"] = players.len
|
|
s["playerlist"] = list2params(players)
|
|
s["admins"] = admins.len
|
|
s["adminlist"] = list2params(admins)
|
|
else
|
|
var/n = 0
|
|
var/admins = 0
|
|
|
|
for(var/client/C in clients)
|
|
if(C.holder)
|
|
if(C.holder.fakekey)
|
|
continue //so stealthmins aren't revealed by the hub
|
|
admins++
|
|
s["player[n]"] = C.key
|
|
n++
|
|
|
|
s["players"] = n
|
|
s["admins"] = admins
|
|
|
|
return list2params(s)
|
|
|
|
else if(T == "manifest")
|
|
var/list/positions = list()
|
|
var/list/set_names = list(
|
|
"heads" = command_positions,
|
|
"sec" = security_positions,
|
|
"eng" = engineering_positions,
|
|
"med" = medical_positions,
|
|
"sci" = science_positions,
|
|
"car" = cargo_positions,
|
|
"civ" = civilian_positions,
|
|
"bot" = nonhuman_positions
|
|
)
|
|
|
|
for(var/datum/data/record/t in data_core.general)
|
|
var/name = t.fields["name"]
|
|
var/rank = t.fields["rank"]
|
|
var/real_rank = make_list_rank(t.fields["real_rank"])
|
|
|
|
var/department = 0
|
|
for(var/k in set_names)
|
|
if(real_rank in set_names[k])
|
|
if(!positions[k])
|
|
positions[k] = list()
|
|
positions[k][name] = rank
|
|
department = 1
|
|
if(!department)
|
|
if(!positions["misc"])
|
|
positions["misc"] = list()
|
|
positions["misc"][name] = rank
|
|
|
|
for(var/k in positions)
|
|
positions[k] = list2params(positions[k]) // converts positions["heads"] = list("Bob"="Captain", "Bill"="CMO") into positions["heads"] = "Bob=Captain&Bill=CMO"
|
|
|
|
return list2params(positions)
|
|
|
|
else if(T == "revision")
|
|
if(revdata.revision)
|
|
return list2params(list(branch = revdata.branch, date = revdata.date, revision = revdata.revision))
|
|
else
|
|
return "unknown"
|
|
|
|
else if(copytext(T,1,5) == "info")
|
|
var/input[] = params2list(T)
|
|
if(input["key"] != config.comms_password)
|
|
if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50)
|
|
|
|
spawn(50)
|
|
world_topic_spam_protect_time = world.time
|
|
return "Bad Key (Throttled)"
|
|
|
|
world_topic_spam_protect_time = world.time
|
|
world_topic_spam_protect_ip = addr
|
|
|
|
return "Bad Key"
|
|
|
|
var/list/search = params2list(input["info"])
|
|
var/list/ckeysearch = list()
|
|
for(var/text in search)
|
|
ckeysearch += ckey(text)
|
|
|
|
var/list/match = list()
|
|
|
|
for(var/mob/M in mob_list)
|
|
var/strings = list(M.name, M.ckey)
|
|
if(M.mind)
|
|
strings += M.mind.assigned_role
|
|
strings += M.mind.special_role
|
|
for(var/text in strings)
|
|
if(ckey(text) in ckeysearch)
|
|
match[M] += 10 // an exact match is far better than a partial one
|
|
else
|
|
for(var/searchstr in search)
|
|
if(findtext(text, searchstr))
|
|
match[M] += 1
|
|
|
|
var/maxstrength = 0
|
|
for(var/mob/M in match)
|
|
maxstrength = max(match[M], maxstrength)
|
|
for(var/mob/M in match)
|
|
if(match[M] < maxstrength)
|
|
match -= M
|
|
|
|
if(!match.len)
|
|
return "No matches"
|
|
else if(match.len == 1)
|
|
var/mob/M = match[1]
|
|
var/info = list()
|
|
info["key"] = M.key
|
|
info["name"] = M.name == M.real_name ? M.name : "[M.name] ([M.real_name])"
|
|
info["role"] = M.mind ? (M.mind.assigned_role ? M.mind.assigned_role : "No role") : "No mind"
|
|
var/turf/MT = get_turf(M)
|
|
info["loc"] = M.loc ? "[M.loc]" : "null"
|
|
info["turf"] = MT ? "[MT] @ [MT.x], [MT.y], [MT.z]" : "null"
|
|
info["area"] = MT ? "[MT.loc]" : "null"
|
|
info["antag"] = M.mind ? (M.mind.special_role ? M.mind.special_role : "Not antag") : "No mind"
|
|
info["hasbeenrev"] = M.mind ? M.mind.has_been_rev : "No mind"
|
|
info["stat"] = M.stat
|
|
info["type"] = M.type
|
|
if(isliving(M))
|
|
var/mob/living/L = M
|
|
info["damage"] = list2params(list(
|
|
oxy = L.getOxyLoss(),
|
|
tox = L.getToxLoss(),
|
|
fire = L.getFireLoss(),
|
|
brute = L.getBruteLoss(),
|
|
clone = L.getCloneLoss(),
|
|
brain = L.getBrainLoss()
|
|
))
|
|
else
|
|
info["damage"] = "non-living"
|
|
info["gender"] = M.gender
|
|
return list2params(info)
|
|
else
|
|
var/list/ret = list()
|
|
for(var/mob/M in match)
|
|
ret[M.key] = M.name
|
|
return list2params(ret)
|
|
|
|
else if(copytext(T,1,9) == "adminmsg")
|
|
/*
|
|
We got an adminmsg from IRC bot lets split the input then validate the input.
|
|
expected output:
|
|
1. adminmsg = ckey of person the message is to
|
|
2. msg = contents of message, parems2list requires
|
|
3. validatationkey = the key the bot has, it should match the gameservers commspassword in it's configuration.
|
|
4. sender = the ircnick that send the message.
|
|
*/
|
|
|
|
|
|
var/input[] = params2list(T)
|
|
if(input["key"] != config.comms_password)
|
|
if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50)
|
|
|
|
spawn(50)
|
|
world_topic_spam_protect_time = world.time
|
|
return "Bad Key (Throttled)"
|
|
|
|
world_topic_spam_protect_time = world.time
|
|
world_topic_spam_protect_ip = addr
|
|
|
|
return "Bad Key"
|
|
|
|
var/client/C
|
|
var/req_ckey = ckey(input["adminmsg"])
|
|
|
|
for(var/client/K in clients)
|
|
if(K.ckey == req_ckey)
|
|
C = K
|
|
break
|
|
if(!C)
|
|
return "No client with that name on server"
|
|
|
|
var/rank = input["rank"]
|
|
if(!rank)
|
|
rank = "Admin"
|
|
|
|
var/message = "<font color='red'>IRC-[rank] PM from <b><a href='?irc_msg=[input["sender"]]'>IRC-[input["sender"]]</a></b>: [input["msg"]]</font>"
|
|
var/amessage = "<font color='blue'>IRC-[rank] PM from <a href='?irc_msg=[input["sender"]]'>IRC-[input["sender"]]</a> to <b>[key_name(C)]</b> : [input["msg"]]</font>"
|
|
|
|
C.received_irc_pm = world.time
|
|
C.irc_admin = input["sender"]
|
|
|
|
C << 'sound/effects/adminhelp.ogg'
|
|
C << message
|
|
|
|
|
|
for(var/client/A in admins)
|
|
if(A != C)
|
|
A << amessage
|
|
|
|
return "Message Successful"
|
|
|
|
else if(copytext(T,1,6) == "notes")
|
|
/*
|
|
We got a request for notes from the IRC Bot
|
|
expected output:
|
|
1. notes = ckey of person the notes lookup is for
|
|
2. validationkey = the key the bot has, it should match the gameservers commspassword in it's configuration.
|
|
*/
|
|
var/input[] = params2list(T)
|
|
if(input["key"] != config.comms_password)
|
|
if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50)
|
|
|
|
spawn(50)
|
|
world_topic_spam_protect_time = world.time
|
|
return "Bad Key (Throttled)"
|
|
|
|
world_topic_spam_protect_time = world.time
|
|
world_topic_spam_protect_ip = addr
|
|
return "Bad Key"
|
|
|
|
return show_player_info_irc(ckey(input["notes"]))
|
|
|
|
else if(copytext(T,1,4) == "age")
|
|
var/input[] = params2list(T)
|
|
if(input["key"] != config.comms_password)
|
|
if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50)
|
|
spawn(50)
|
|
world_topic_spam_protect_time = world.time
|
|
return "Bad Key (Throttled)"
|
|
|
|
world_topic_spam_protect_time = world.time
|
|
world_topic_spam_protect_ip = addr
|
|
return "Bad Key"
|
|
|
|
var/age = get_player_age(input["age"])
|
|
if(isnum(age))
|
|
if(age >= 0)
|
|
return "[age]"
|
|
else
|
|
return "Ckey not found"
|
|
else
|
|
return "Database connection failed or not set up"
|
|
|
|
|
|
/world/Reboot(var/reason)
|
|
/*spawn(0)
|
|
world << sound(pick('sound/AI/newroundsexy.ogg','sound/misc/apcdestroyed.ogg','sound/misc/bangindonk.ogg')) // random end sounds!! - LastyBatsy
|
|
*/
|
|
|
|
processScheduler.stop()
|
|
|
|
for(var/client/C in clients)
|
|
if(config.server) //if you set a server location in config.txt, it sends you there instead of trying to reconnect to the same world address. -- NeoFite
|
|
C << link("byond://[config.server]")
|
|
|
|
..(reason)
|
|
|
|
/hook/startup/proc/loadMode()
|
|
world.load_mode()
|
|
return 1
|
|
|
|
/world/proc/load_mode()
|
|
if(!fexists("data/mode.txt"))
|
|
return
|
|
|
|
|
|
var/list/Lines = file2list("data/mode.txt")
|
|
if(Lines.len)
|
|
if(Lines[1])
|
|
master_mode = Lines[1]
|
|
log_misc("Saved mode is '[master_mode]'")
|
|
|
|
/world/proc/save_mode(var/the_mode)
|
|
var/F = file("data/mode.txt")
|
|
fdel(F)
|
|
F << the_mode
|
|
|
|
|
|
/hook/startup/proc/loadMOTD()
|
|
world.load_motd()
|
|
return 1
|
|
|
|
/world/proc/load_motd()
|
|
join_motd = file2text("config/motd.txt")
|
|
|
|
|
|
/proc/load_configuration()
|
|
config = new /datum/configuration()
|
|
config.load("config/config.txt")
|
|
config.load("config/game_options.txt","game_options")
|
|
config.loadsql("config/dbconfig.txt")
|
|
config.loadforumsql("config/forumdbconfig.txt")
|
|
|
|
/hook/startup/proc/loadMods()
|
|
world.load_mods()
|
|
world.load_mentors() // no need to write another hook.
|
|
return 1
|
|
|
|
/world/proc/load_mods()
|
|
if(config.admin_legacy_system)
|
|
var/text = file2text("config/moderators.txt")
|
|
if (!text)
|
|
error("Failed to load config/mods.txt")
|
|
else
|
|
var/list/lines = splittext(text, "\n")
|
|
for(var/line in lines)
|
|
if (!line)
|
|
continue
|
|
|
|
if (copytext(line, 1, 2) == ";")
|
|
continue
|
|
|
|
var/title = "Moderator"
|
|
var/rights = admin_ranks[title]
|
|
|
|
var/ckey = copytext(line, 1, length(line)+1)
|
|
var/datum/admins/D = new /datum/admins(title, rights, ckey)
|
|
D.associate(directory[ckey])
|
|
|
|
/world/proc/load_mentors()
|
|
if(config.admin_legacy_system)
|
|
var/text = file2text("config/mentors.txt")
|
|
if (!text)
|
|
error("Failed to load config/mentors.txt")
|
|
else
|
|
var/list/lines = splittext(text, "\n")
|
|
for(var/line in lines)
|
|
if (!line)
|
|
continue
|
|
if (copytext(line, 1, 2) == ";")
|
|
continue
|
|
|
|
var/title = "Mentor"
|
|
var/rights = admin_ranks[title]
|
|
|
|
var/ckey = copytext(line, 1, length(line)+1)
|
|
var/datum/admins/D = new /datum/admins(title, rights, ckey)
|
|
D.associate(directory[ckey])
|
|
|
|
/world/proc/update_status()
|
|
var/s = ""
|
|
|
|
if (config && config.server_name)
|
|
s += "<b>[config.server_name]</b> — "
|
|
|
|
s += "<b>[station_name()]</b>";
|
|
s += " ("
|
|
s += "<a href=\"http://\">" //Change this to wherever you want the hub to link to.
|
|
// s += "[game_version]"
|
|
s += "Default" //Replace this with something else. Or ever better, delete it and uncomment the game version.
|
|
s += "</a>"
|
|
s += ")"
|
|
|
|
var/list/features = list()
|
|
|
|
if(ticker)
|
|
if(master_mode)
|
|
features += master_mode
|
|
else
|
|
features += "<b>STARTING</b>"
|
|
|
|
if (!config.enter_allowed)
|
|
features += "closed"
|
|
|
|
features += config.abandon_allowed ? "respawn" : "no respawn"
|
|
|
|
if (config && config.allow_vote_mode)
|
|
features += "vote"
|
|
|
|
if (config && config.allow_ai)
|
|
features += "AI allowed"
|
|
|
|
var/n = 0
|
|
for (var/mob/M in player_list)
|
|
if (M.client)
|
|
n++
|
|
|
|
if (n > 1)
|
|
features += "~[n] players"
|
|
else if (n > 0)
|
|
features += "~[n] player"
|
|
|
|
|
|
if (config && config.hostedby)
|
|
features += "hosted by <b>[config.hostedby]</b>"
|
|
|
|
if (features)
|
|
s += ": [jointext(features, ", ")]"
|
|
|
|
/* does this help? I do not know */
|
|
if (src.status != s)
|
|
src.status = s
|
|
|
|
#define FAILED_DB_CONNECTION_CUTOFF 5
|
|
var/failed_db_connections = 0
|
|
var/failed_old_db_connections = 0
|
|
|
|
/hook/startup/proc/connectDB()
|
|
if(!config.sql_enabled)
|
|
world.log << "SQL connection disabled in config."
|
|
else 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.
|
|
return 0
|
|
|
|
if(!dbcon)
|
|
dbcon = new()
|
|
|
|
var/user = sqlfdbklogin
|
|
var/pass = sqlfdbkpass
|
|
var/db = sqlfdbkdb
|
|
var/address = sqladdress
|
|
var/port = sqlport
|
|
|
|
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
|
|
. = dbcon.IsConnected()
|
|
if ( . )
|
|
failed_db_connections = 0 //If this connection succeeded, reset the failed connections counter.
|
|
else
|
|
failed_db_connections++ //If it failed, increase the failed connections counter.
|
|
world.log << dbcon.ErrorMsg()
|
|
|
|
return .
|
|
|
|
//This proc ensures that the connection to the feedback database (global variable dbcon) is established
|
|
proc/establish_db_connection()
|
|
if(failed_db_connections > FAILED_DB_CONNECTION_CUTOFF)
|
|
return 0
|
|
|
|
if(!dbcon || !dbcon.IsConnected())
|
|
return setup_database_connection()
|
|
else
|
|
return 1
|
|
|
|
|
|
/hook/startup/proc/connectOldDB()
|
|
if(!config.sql_enabled)
|
|
world.log << "SQL connection disabled in config."
|
|
else 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()
|
|
|
|
if(failed_old_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.
|
|
return 0
|
|
|
|
if(!dbcon_old)
|
|
dbcon_old = new()
|
|
|
|
var/user = sqllogin
|
|
var/pass = sqlpass
|
|
var/db = sqldb
|
|
var/address = sqladdress
|
|
var/port = sqlport
|
|
|
|
dbcon_old.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
|
|
. = dbcon_old.IsConnected()
|
|
if ( . )
|
|
failed_old_db_connections = 0 //If this connection succeeded, reset the failed connections counter.
|
|
else
|
|
failed_old_db_connections++ //If it failed, increase the failed connections counter.
|
|
world.log << dbcon.ErrorMsg()
|
|
|
|
return .
|
|
|
|
//This proc ensures that the connection to the feedback database (global variable dbcon) is established
|
|
proc/establish_old_db_connection()
|
|
if(failed_old_db_connections > FAILED_DB_CONNECTION_CUTOFF)
|
|
return 0
|
|
|
|
if(!dbcon_old || !dbcon_old.IsConnected())
|
|
return setup_old_database_connection()
|
|
else
|
|
return 1
|
|
|
|
#undef FAILED_DB_CONNECTION_CUTOFF
|