From 86feaac9c213e1b15a97bf455e12ddd6fce54d40 Mon Sep 17 00:00:00 2001 From: Erthilo Date: Sun, 3 Jun 2012 01:09:26 +0100 Subject: [PATCH] TG: Ban moved into IsBanned so that people whom are banned can actually see -why- they are banned. Another perk of using IsBanned and not client/New() is that we now disconnect potential clients before they are given a client object and start downloading any resources...which is like a 30Mb saving per failed login (after each server update). Tidied up the Login and Logout procs for mobs. Moved the sandbox buildmode stuff to mob/living/login.dm so you shouldn't have to log-out and back in to enable build mode. Removed the logged_in variable for mobs as it was the most pointless thing ever. Made the multikeying checks a separate proc. People are checked the second they get a new_player mob. Its notices are also less spammy. Changed AllowUpload from the default. It now restricts uploads of over 1Mb to prevent admins uploading massive .Oggs and lagging the server to hell whilst it sends the ogg to 40+ players. Feel free to change the limit. Moved some of the core client procs into one folder; they should really be together and not in /modules/mob/mob.dm and various other places. I will be giving the client stuff a belated spring-clean over the next few commits, just got to iron out some of the kinks. Revision: r3694 Author: elly1...@rocketmail.com --- baystation12.dme | 7 +- code/datums/configuration.dm | 4 + code/datums/datumvars.dm | 764 ++++++++++---------- code/defines/client.dm | 53 -- code/defines/global.dm | 3 +- code/game/algorithm.dm | 8 +- code/modules/admin/IsBanned.dm | 19 + code/modules/admin/NewBan.dm | 111 ++- code/modules/client/client defines.dm | 54 ++ code/modules/client/client procs.dm | 112 +++ code/modules/mob/living/login.dm | 12 + code/modules/mob/living/silicon/ai/login.dm | 4 + code/modules/mob/login.dm | 74 +- code/modules/mob/logout.dm | 1 - code/modules/mob/mob.dm | 48 -- code/modules/mob/mob_defines.dm | 1 - code/modules/mob/new_player/login.dm | 91 +++ code/modules/mob/new_player/new_player.dm | 94 --- config/config.txt | 18 +- 19 files changed, 761 insertions(+), 717 deletions(-) delete mode 100644 code/defines/client.dm create mode 100644 code/modules/admin/IsBanned.dm create mode 100644 code/modules/client/client defines.dm create mode 100644 code/modules/client/client procs.dm create mode 100644 code/modules/mob/living/login.dm create mode 100644 code/modules/mob/new_player/login.dm diff --git a/baystation12.dme b/baystation12.dme index 2355bffb6d..c88a93cd35 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -91,6 +91,7 @@ #define FILE_DIR "code/modules/admin/verbs" #define FILE_DIR "code/modules/assembly" #define FILE_DIR "code/modules/chemical" +#define FILE_DIR "code/modules/client" #define FILE_DIR "code/modules/clothing" #define FILE_DIR "code/modules/clothing/glasses" #define FILE_DIR "code/modules/clothing/head" @@ -309,7 +310,6 @@ #include "code\datums\spells\turf_teleport.dm" #include "code\datums\spells\wizard.dm" #include "code\defines\atom.dm" -#include "code\defines\client.dm" #include "code\defines\global.dm" #include "code\defines\hub.dm" #include "code\defines\obj.dm" @@ -797,6 +797,7 @@ #include "code\modules\admin\create_mob.dm" #include "code\modules\admin\create_object.dm" #include "code\modules\admin\create_turf.dm" +#include "code\modules\admin\IsBanned.dm" #include "code\modules\admin\NewBan.dm" #include "code\modules\admin\newbanjob.dm" #include "code\modules\admin\player_panel.dm" @@ -839,6 +840,8 @@ #include "code\modules\chemical\Chemistry-Reagents.dm" #include "code\modules\chemical\Chemistry-Recipes.dm" #include "code\modules\chemical\Chemistry-Tools.dm" +#include "code\modules\client\client defines.dm" +#include "code\modules\client\client procs.dm" #include "code\modules\clothing\costume.dm" #include "code\modules\clothing\ears.dm" #include "code\modules\clothing\gimmick.dm" @@ -927,6 +930,7 @@ #include "code\modules\mob\living\damage_procs.dm" #include "code\modules\mob\living\living.dm" #include "code\modules\mob\living\living_defense.dm" +#include "code\modules\mob\living\login.dm" #include "code\modules\mob\living\say.dm" #include "code\modules\mob\living\blob\blob.dm" #include "code\modules\mob\living\carbon\carbon.dm" @@ -1042,6 +1046,7 @@ #include "code\modules\mob\living\silicon\robot\say.dm" #include "code\modules\mob\living\silicon\robot\wires.dm" #include "code\modules\mob\new_player\hud.dm" +#include "code\modules\mob\new_player\login.dm" #include "code\modules\mob\new_player\new_player.dm" #include "code\modules\mob\new_player\preferences.dm" #include "code\modules\mob\new_player\preferences_setup.dm" diff --git a/code/datums/configuration.dm b/code/datums/configuration.dm index e2a0397860..f0cfee61df 100644 --- a/code/datums/configuration.dm +++ b/code/datums/configuration.dm @@ -14,6 +14,7 @@ var/log_adminchat = 0 // log admin chat messages var/log_adminwarn = 0 // log warnings admins get about bomb construction and such var/log_pda = 0 // log pda messages + var/log_hrefs = 0 // logs all links clicked in-game. Could be used for debugging and tracking down exploits var/sql_enabled = 1 // for sql switching var/allow_vote_restart = 0 // allow votes to restart var/allow_vote_mode = 0 // allow votes to change mode @@ -171,6 +172,9 @@ if ("log_pda") config.log_pda = 1 + if ("log_hrefs") + config.log_hrefs = 1 + if ("allow_vote_restart") config.allow_vote_restart = 1 diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 2040d87432..2e488ab427 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -248,7 +248,6 @@ client if(ishuman(D)) body += "" body += "" - body += "" body += "" body += "" body += "" @@ -390,419 +389,382 @@ client return html -//All BYOND links pass through client/Topic() FIRST and are then directed to [hsrc]/Topic() by the ..() call at the end. -client/Topic(href, href_list, hsrc) - file("topic_log") << "[time2text(world.realtime, "DDD MMM DD YYYY")] at [time2text(world.timeofday, "hh:mm:ss")], [ckey], \"[url_encode(href)]\"" - // build some more useful info - var/references = "" - for(var/href_key in href_list) - var/href_val = locate(href_list[href_key]) - references += "[href_key] = [href_val](" - if(istype(href_val,/datum)) - references += "[href_val:type]" - if(istype(href_val,/atom)) - references += " at [href_val:x],[href_val:y],[href_val:z]" +/client/proc/view_var_Topic(href,href_list,hsrc) + //This will all be moved over to datum/admins/Topic() ~Carn + if( (usr.client == src) && src.holder ) + . = 1 //default return + if (href_list["Vars"]) + debug_variables(locate(href_list["Vars"])) - references += "); " - file("topic_log") << references + //~CARN: for renaming mobs (updates their real_name and their ID/PDA if applicable). + else if (href_list["rename"]) + var/new_name = copytext(sanitize(input(usr,"What would you like to name this mob?","Input a name") as text|null),1,MAX_NAME_LEN) + if(!new_name) return + var/mob/M = locate(href_list["rename"]) + if(!istype(M)) return - sleep(3) + message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(M)] to [new_name].", 1) + if(istype(M, /mob/living/carbon/human)) + for(var/obj/item/weapon/card/id/ID in M.contents) + if(ID.registered_name == M.real_name) + ID.name = "[new_name]'s ID Card ([ID.assignment])" + ID.registered_name = new_name + break + for(var/obj/item/device/pda/PDA in M.contents) + if(PDA.owner == M.real_name) + PDA.name = "PDA-[new_name] ([PDA.ownjob])" + PDA.owner = new_name + break + M.real_name = new_name + M.name = new_name + M.original_name = new_name + href_list["datumrefresh"] = href_list["rename"] - //search the href for script injection //This is a temporary measure - if( findtext(href,"= 10) + if( !C.holder && (C.inactivity >= INACTIVITY_KICK) ) if(C.mob) if(!istype(C.mob, /mob/dead/)) log_access("AFK: [key_name(C)]") C << "\red You have been inactive for more than 10 minutes and have been disconnected." - C.mob.logged_in = 0 del(C) spawn(3000) KickInactiveClients()//more or less five minutes diff --git a/code/modules/admin/IsBanned.dm b/code/modules/admin/IsBanned.dm new file mode 100644 index 0000000000..94f81aafa2 --- /dev/null +++ b/code/modules/admin/IsBanned.dm @@ -0,0 +1,19 @@ +//Blocks an attempt to connect before even creating our client datum thing. +world/IsBanned(key,address,computer_id) + if(ckey(key) in admins) + return ..() + + //Guest Checking + if( !guests_allowed && IsGuestKey(key) ) + log_access("Failed Login: [key] - Guests not allowed") + message_admins("\blue Failed Login: [key] - Guests not allowed") + return list("reason"="guest", "desc"="\nReason: Guests not allowed.brb") + + //Ban Checking + . = CheckBan( ckey(key), computer_id, address ) + if(.) + log_access("Failed Login: [key] [computer_id] [address] - Banned [.["reason"]]") + message_admins("\blue Failed Login: [key] id:[computer_id] ip:[address] - Banned [.["reason"]]") + return . + + return ..() //default pager ban stuff diff --git a/code/modules/admin/NewBan.dm b/code/modules/admin/NewBan.dm index beafeff0a5..4ad0979f1a 100644 --- a/code/modules/admin/NewBan.dm +++ b/code/modules/admin/NewBan.dm @@ -1,86 +1,82 @@ var/CMinutes = null var/savefile/Banlist -/proc/LoadBans() - - Banlist = new("data/banlist.bdb") - log_admin("Loading banlist.") - - if (!length(Banlist.dir)) log_admin("Banlist is empty.") - - if (!Banlist.dir.Find("base")) - log_admin("Banlist missing base dir.") - Banlist.dir.Add("base") - - Banlist.cd = "/base" - - ClearTempbans() - return 1 -/proc/CheckBan(var/client/clientvar) - - var/id = clientvar.computer_id - var/key = clientvar.ckey +/proc/CheckBan(var/ckey, var/id, var/address) if(!Banlist) // if Banlist cannot be located for some reason LoadBans() // try to load the bans if(!Banlist) // uh oh, can't find bans! return 0 // ABORT ABORT ABORT + . = list() + var/appeal + if(config && config.banappeals) + appeal = "\nFor more information on your ban, or to appeal, head to [config.banappeals]" Banlist.cd = "/base" - if (Banlist.dir.Find("[key][id]")) - Banlist.cd = "[key][id]" + if( "[ckey][id]" in Banlist.dir ) + Banlist.cd = "[ckey][id]" if (Banlist["temp"]) if (!GetBanExp(Banlist["minutes"])) ClearTempbans() return 0 else - log_access("Failed Login: [clientvar] - Banned") - message_admins("\blue Failed Login: [clientvar] - Banned") - alert(clientvar,"You have been banned.\nReason : [Banlist["reason"]]\n(This ban will be automatically removed in [GetBanExp(Banlist["minutes"])].)[config.appeal_address ? "\nYou may try to appeal this at [config.appeal_address]" : ""]","Ban","Ok") - return 1 + .["desc"] = "\nReason: [Banlist["reason"]]\nExpires: [GetBanExp(Banlist["minutes"])]\nBy: [Banlist["bannedby"]][appeal]" else - Banlist.cd = "/base/[key][id]" - log_access("Failed Login: [clientvar] - Banned") - message_admins("\blue Failed Login: [clientvar] - Banned") - alert(clientvar,"You have been banned.\nReason : [Banlist["reason"]]\n(This is a permanent ban.)[config.appeal_address ? "\nYou may try to appeal this at [config.appeal_address]" : ""]","Ban","Ok") - return 1 + Banlist.cd = "/base/[ckey][id]" + .["desc"] = "\nReason: [Banlist["reason"]]\nExpires: PERMENANT\nBy: [Banlist["bannedby"]][appeal]" + .["reason"] = "ckey/id" + return . + else + for (var/A in Banlist.dir) + Banlist.cd = "/base/[A]" + var/matches + if( ckey == Banlist["key"] ) + matches += "ckey" + if( id == Banlist["id"] && Banlist["skipIdCheck"] == 0) + if(matches) + matches += "/" + matches += "id" +// if( address == Banlist["ip"] ) +// if(matches) +// matches += "/" +// matches += "ip" - Banlist.cd = "/base" - for (var/A in Banlist.dir) - Banlist.cd = "/base/[A]" - if ( key == Banlist["key"] || (id == Banlist["id"] && Banlist["skipIdCheck"] == 0) ) - if(Banlist["temp"]) - if (!GetBanExp(Banlist["minutes"])) - ClearTempbans() - return 0 - else - if(key != Banlist["key"]) - log_access("Failed Login: [clientvar] - Banned as [Banlist["key"]]") - message_admins("\blue Failed Login: [clientvar] - Banned as [Banlist["key"]]") + if(matches) + if(Banlist["temp"]) + if (!GetBanExp(Banlist["minutes"])) + ClearTempbans() + return 0 else - log_access("Failed Login: [clientvar] - Banned") - message_admins("\blue Failed Login: [clientvar] - Banned") - alert(clientvar,"You have been banned.\nReason : [Banlist["reason"]]\n(This ban will be automatically removed in [GetBanExp(Banlist["minutes"])].)[config.appeal_address ? "\nYou may try to appeal this at [config.appeal_address]" : ""]","Ban","Ok") - return 1 - else - if(key != Banlist["key"]) - log_access("Failed Login: [clientvar] - Banned as [Banlist["key"]]") - message_admins("\blue Failed Login: [clientvar] - Banned as [Banlist["key"]]") + .["desc"] = "\nReason: [Banlist["reason"]]\nExpires: [GetBanExp(Banlist["minutes"])]\nBy: [Banlist["bannedby"]][appeal]" else - log_access("Failed Login: [clientvar] - Banned") - message_admins("\blue Failed Login: [clientvar] - Banned") - alert(clientvar,"You have been banned.\nReason : [Banlist["reason"]]\n(This is a permanent ban.)[config.appeal_address ? "\nYou may try to appeal this at [config.appeal_address]" : ""]","Ban","Ok") - return 1 - + .["desc"] = "\nReason: [Banlist["reason"]]\nExpires: PERMENANT\nBy: [Banlist["bannedby"]][appeal]" + .["reason"] = matches + return . return 0 - -/proc/UpdateTime() +/proc/UpdateTime() //No idea why i made this a proc. CMinutes = (world.realtime / 10) / 60 return 1 +/proc/LoadBans() + + Banlist = new("data/banlist.bdb") + log_admin("Loading Banlist") + + if (!length(Banlist.dir)) log_admin("Banlist is empty.") + + if (!Banlist.dir.Find("base")) + log_admin("Banlist missing base dir.") + Banlist.dir.Add("base") + Banlist.cd = "/base" + else if (Banlist.dir.Find("base")) + Banlist.cd = "/base" + + ClearTempbans() + return 1 + /proc/ClearTempbans() UpdateTime() @@ -171,6 +167,7 @@ var/savefile/Banlist /obj/admins/proc/unbanpanel() var/count = 0 var/dat + //var/dat = "
Unban Player: \blue(U) = Unban , (E) = Edit Ban\green (Total
" Banlist.cd = "/base" for (var/A in Banlist.dir) count++ diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm new file mode 100644 index 0000000000..518e8b79f8 --- /dev/null +++ b/code/modules/client/client defines.dm @@ -0,0 +1,54 @@ +//Some of this is being changed to a datum to cut down on uneccessary variables at the client level. ~Carn +/client + //////////////// + //ADMIN THINGS// + //////////////// + var/obj/admins/holder = null + var/buildmode = 0 + var/stealth = 0 + var/fakekey = null + var/seeprayers = 0 + var/ooccolor = "#b82e00" + var/muted = null //Can't talk in OOC, say, whisper, emote... anything except for adminhelp and admin-pm. An admin punishment + var/muted_complete = null //Can't talk in any way shape or form (muted + can't adminhelp or respond to admin pm-s). An admin punishment + var/warned = 0 + var/sound_adminhelp = 0 //If set to 1 this will play a sound when adminhelps are received. + var/admin_invis = 0 + + ///////// + //OTHER// + ///////// + var/listen_ooc = 1 + var/move_delay = 1 + var/moving = null + var/adminobs = null + var/deadchat = 0 + var/changes = 0 + var/area = null + var/played = 0 + var/team = null + var/be_alien = 0 //Check if that guy wants to be an alien + var/be_pai = 1 //Consider client when searching for players to recruit as a pAI + var/vote = null + var/showvote = null + var/STFU_ghosts //80+ people rounds are fun to admin when text flies faster than airport security + var/STFU_radio //80+ people rounds are fun to admin when text flies faster than airport security + var/be_syndicate = 0 //Moving this into client vars, since I was silly when I made it. + + /////////////// + //SOUND STUFF// + /////////////// + var/canplaysound = 1 + var/ambience_playing= null + var/no_ambi = 0 //Toggle Ambience + var/midis = 1 //Toggle Midis + + //////////// + //SECURITY// + //////////// + var/next_allowed_topic_time = 10 + // comment out the line below when debugging locally to enable the options & messages menu + control_freak = 1 + + + diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm new file mode 100644 index 0000000000..7a6795ff33 --- /dev/null +++ b/code/modules/client/client procs.dm @@ -0,0 +1,112 @@ + //////////// + //SECURITY// + //////////// +#define TOPIC_SPAM_DELAY 7 //7 tick delay is about half a second +#define UPLOAD_LIMIT 1048576 //Restricts client uploads to the server to 1MB //Could probably do with being lower. + /* + When somebody clicks a link in game, this Topic is called first. + It does the stuff in this proc and then is redirected to the Topic() proc for the src=[0xWhatever] + (if specified in the link). ie locate(hsrc).Topic() + + Such links can be spoofed. + + Because of this certain things MUST be considered whenever adding a Topic() for something: + - Can it be fed harmful values which could cause runtimes? + - Is the Topic call an admin-only thing? + - If so, does it have checks to see if the person who called it (usr.client) is an admin? + - Are the processes being called by Topic() particularly laggy? + - If so, is there any protection against somebody spam-clicking a link? + If you have any questions about this stuff feel free to ask. ~Carn + */ +/client/Topic(href, href_list, hsrc) + //Reduces spamming of links by dropping calls that happen during the delay period + if(next_allowed_topic_time > world.time) +// src << "\red DEBUG: Error: SPAM" + return + next_allowed_topic_time = world.time + TOPIC_SPAM_DELAY + + //search the href for script injection + if( findtext(href,"[time2text(world.timeofday,"hh:mm")] [src] (usr:[usr]) || [href]
" + + if(view_var_Topic(href,href_list,hsrc)) //Until viewvars can be rewritten as datum/admins/Topic() + return + + ..() //redirect to [locate(hsrc)]/Topic() + + +//This stops files larger than UPLOAD_LIMIT being sent from client to server via input(), client.Import() etc. +/client/AllowUpload(filename, filelength) + if(filelength > UPLOAD_LIMIT) + src << "Error: AllowUpload(): File Upload too large. Upload Limit: [UPLOAD_LIMIT/1024]KiB." + return 0 +/* //Don't need this at the moment. But it's here if it's needed later. + //Helps prevent multiple files being uploaded at once. Or right after eachother. + var/time_to_wait = fileaccess_timer - world.time + if(time_to_wait > 0) + src << "Error: AllowUpload(): Spam prevention. Please wait [round(time_to_wait/10)] seconds." + return 0 + fileaccess_timer = world.time + FTPDELAY */ + return 1 + + + /////////// + //CONNECT// + /////////// +/client/New() + //Connection-Type Checking + if( connection != "seeker" ) + del(src) + return + + if(IsGuestKey(key)) + alert(src,"Baystation12 doesn't allow guest accounts to play. Please go to http://www.byond.com/ and register for a key.","Guest","OK") + del(src) + return + + if (((world.address == address || !(address)) && !(host))) + host = key + world.update_status() + + ..() //calls mob.Login() + makejson() + + if(custom_event_msg && custom_event_msg != "") + src << "

Custom Event

" + src << "

A custom event is taking place. OOC Info:

" + src << "[html_encode(custom_event_msg)]" + src << "
" + + //Admin Authorisation + if( ckey in admins ) + holder = new /obj/admins(src) + holder.rank = admins[ckey] + update_admins(admins[ckey]) + admin_memo_show() + + + ////////////// + //DISCONNECT// + ////////////// +/client/Del() + spawn(0) + if(holder) + del(holder) + makejson() + return ..() \ No newline at end of file diff --git a/code/modules/mob/living/login.dm b/code/modules/mob/living/login.dm new file mode 100644 index 0000000000..a368bd2552 --- /dev/null +++ b/code/modules/mob/living/login.dm @@ -0,0 +1,12 @@ +/mob/living/Login() + ..() + if(ticker && ticker.mode) + switch(ticker.mode.name) + if("sandbox") + CanBuild() + if("revolution") + if ((src.mind in ticker.mode:revolutionaries) || (src.mind in ticker.mode:head_revolutionaries)) + ticker.mode:update_rev_icons_added(src.mind) + if("cult") + if (src.mind in ticker.mode:cult) + ticker.mode:update_cult_icons_added(src.mind) \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/login.dm b/code/modules/mob/living/silicon/ai/login.dm index 7a294615bf..5f70bdb775 100644 --- a/code/modules/mob/living/silicon/ai/login.dm +++ b/code/modules/mob/living/silicon/ai/login.dm @@ -1,4 +1,8 @@ /mob/living/silicon/ai/Login() + for(var/obj/effect/rune/rune in world) + var/image/blood = image('blood.dmi', loc = rune, icon_state = "floor[rand(1,7)]") + blood.override = 1 + client.images += blood ..() rebuild_appearance() for(var/S in src.client.screen) diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index e7a8d19da5..5d55ee62c7 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -1,32 +1,32 @@ -/mob/Login() - log_access("Login: [key_name(src)] from [src.client.address ? src.client.address : "localhost"]") - src.lastKnownIP = src.client.address - src.computer_id = src.client.computer_id - if (config.log_access) - for (var/mob/M in world) - if(M == src) - continue - if(M.client && M.client.address == src.client.address) - log_access("Notice: [key_name(src)] has same IP address as [key_name(M)]") - message_admins("Notice: [key_name_admin(src)] has the same IP address as [key_name_admin(M)]", 1) - else if (M.lastKnownIP && M.lastKnownIP == src.client.address && M.ckey != src.ckey && M.key) - log_access("Notice: [key_name(src)] has same IP address as [key_name(M)] did ([key_name(M)] is no longer logged in).") - message_admins("Notice: [key_name_admin(src)] has the same IP address as [key_name_admin(M)] did ([key_name_admin(M)] is no longer logged in).", 1) - if(M.client && M.client.computer_id == src.client.computer_id) - log_access("Notice: [key_name(src)] has same computer ID as [key_name(M)]") - message_admins("Notice: [key_name_admin(src)] has the same computer ID as [key_name_admin(M)]", 1) - spawn() alert("You have logged in already with another key this round, please log out of this one NOW or risk being banned!") - else if (M.computer_id && M.computer_id == src.client.computer_id && M.ckey != src.ckey && M.key) - log_access("Notice: [key_name(src)] has same computer ID as [key_name(M)] did ([key_name(M)] is no longer logged in).") - message_admins("Notice: [key_name_admin(src)] has the same computer ID as [key_name_admin(M)] did ([key_name_admin(M)] is no longer logged in).", 1) - spawn() alert("You have logged in already with another key this round, please log out of this one NOW or risk being banned!") - if(!src.dna) src.dna = new /datum/dna(null) - //src.client.screen -= main_hud1.contents - world.update_status() - //if (!src.hud_used) - // src.hud_used = main_hud1 +//handles setting lastKnownIP and computer_id for use by the ban systems as well as checking for multikeying +/mob/proc/update_Login_details() + lastKnownIP = client.address + computer_id = client.computer_id + log_access("Login: [key_name(src)] from [lastKnownIP ? lastKnownIP : "localhost"]-[computer_id] || BYOND v[client.byond_version]") + if(config.log_access) + for(var/mob/M in world) + if(M == src) continue + if( M.key && (M.key != key) ) + var/matches + if( (M.lastKnownIP == client.address) ) + matches += "IP ([client.address])" + if( (M.computer_id == client.computer_id) ) + if(matches) matches += " and " + matches += "ID ([client.computer_id])" + spawn() alert("You have logged in already with another key this round, please log out of this one NOW or risk being banned!") + if(matches) + if(M.client) + message_admins("Notice: [key_name_admin(src)] has the same [matches] as [key_name_admin(M)].", 1) + log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)].") + else + message_admins("Notice: [key_name_admin(src)] has the same [matches] as [key_name_admin(M)] (no longer logged in). ", 1) + log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)] (no longer logged in).") - if (!src.hud_used) +/mob/Login() + update_Login_details() + if(!src.dna) src.dna = new /datum/dna(null) + world.update_status() + if(!src.hud_used) src.hud_used = new/obj/hud( src ) else del(src.hud_used) @@ -34,20 +34,4 @@ src.next_move = 1 src.sight |= SEE_SELF - src.logged_in = 1 - - if(istype (src, /mob/living)) - if(ticker) - if(ticker.mode) - if(ticker.mode.name == "revolution") - if ((src.mind in ticker.mode:revolutionaries) || (src.mind in ticker.mode:head_revolutionaries)) - ticker.mode:update_rev_icons_added(src.mind) - if(ticker.mode.name == "cult") - if (src.mind in ticker.mode:cult) - ticker.mode:update_cult_icons_added(src.mind) - if(isAI(src)) - for(var/obj/effect/rune/rune in world) - var/image/blood = image('blood.dmi', loc = rune, icon_state = "floor[rand(1,7)]") - blood.override = 1 - client.images += blood - ..() + ..() diff --git a/code/modules/mob/logout.dm b/code/modules/mob/logout.dm index 8f9ad4c973..b58ae225fb 100644 --- a/code/modules/mob/logout.dm +++ b/code/modules/mob/logout.dm @@ -2,7 +2,6 @@ log_access("Logout: [key_name(src)]") if (admins[src.ckey]) message_admins("Admin logout: [key_name(src)]") - src.logged_in = 0 ..() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 76214d1cf1..b8e66cf0e3 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -730,54 +730,6 @@ //usr << "[name]: Dn:[density] dir:[dir] cont:[contents] icon:[icon] is:[icon_state] loc:[loc]" return -/client/New() - if( connection != "seeker" ) - src << "Sorry, this game does not support [connection] connections." //doesn't work - del(src) - if (CheckBan(src)) - del(src) - -/* - if (!guests_allowed && IsGuestKey(key)) - log_access("Failed Login: [src] - Guests not allowed") - message_admins("\blue Failed Login: [src] - Guests not allowed") - alert(src,"You cannot play here.\nReason : Guests not allowed","Guests not allowed","Ok") - del(src) -*/ - - if(IsGuestKey(key)) - alert(src,"Baystation12 doesn't allow guest accounts to play. Please go to http://www.byond.com/ and register for a key.","Guest","OK") - del(src) - - if (((world.address == address || !(address)) && !(host))) - host = key - world.update_status() - - ..() - makejson() - - if(custom_event_msg && custom_event_msg != "") - src << "

Custom Event

" - src << "

A custom event is taking place. OOC Info:

" - src << "[html_encode(custom_event_msg)]" - src << "
" - - if( ckey in admins ) - holder = new /obj/admins(src) - holder.rank = admins[ckey] - update_admins(admins[ckey]) - admin_memo_show() - - if(ticker && ticker.mode && ticker.mode.name =="sandbox") - mob.CanBuild() - -/client/Del() - spawn(0) - if(holder) - del(holder) - makejson() - return ..() - /mob/proc/can_use_hands() if(handcuffed) return 0 diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 855780cf29..a525e6122c 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -182,7 +182,6 @@ var/job = null//Living var/nodamage = 0 - var/logged_in = 0 var/underwear = 1//Human var/backbag = 2//Human diff --git a/code/modules/mob/new_player/login.dm b/code/modules/mob/new_player/login.dm new file mode 100644 index 0000000000..06d5b0e5cf --- /dev/null +++ b/code/modules/mob/new_player/login.dm @@ -0,0 +1,91 @@ +/mob/new_player/Login() + update_Login_details() //handles setting lastKnownIP and computer_id for use by the ban systems as well as checking for multikeying + if (join_motd) + src << "
[join_motd]
" + + if(!preferences) + preferences = new + + if(!mind) + mind = new + mind.key = key + mind.current = src + + spawn() Playmusic() // git some tunes up in heeyaa~ + + var/starting_loc = pick(newplayer_start) + if(!starting_loc) starting_loc = locate(1,1,1) + loc = starting_loc + lastarea = starting_loc + + sight |= SEE_TURFS + + var/list/watch_locations = list() + for(var/obj/effect/landmark/landmark in world) + if(landmark.tag == "landmark*new_player") + watch_locations += landmark.loc + + if(watch_locations.len>0) + loc = pick(watch_locations) + + if(!preferences.savefile_load(src, 0)) + preferences.ShowChoices(src) + if(!client.changes) + changes() + else + var/lastchangelog = length('changelog.html') + if(!client.changes && preferences.lastchangelog!=lastchangelog) + changes() + preferences.lastchangelog = lastchangelog + preferences.savefile_save(src) + + spawn(10) + if(client) + new_player_panel() + //PDA Resource Initialisation =======================================================> + /* + Quick note: local dream daemon instances don't seem to cache images right. Might be + a local problem with my machine but it's annoying nontheless. + */ + if(client) + //load the PDA iconset into the client + src << browse_rsc('pda_atmos.png') + src << browse_rsc('pda_back.png') + src << browse_rsc('pda_bell.png') + src << browse_rsc('pda_blank.png') + src << browse_rsc('pda_boom.png') + src << browse_rsc('pda_bucket.png') + src << browse_rsc('pda_crate.png') + src << browse_rsc('pda_cuffs.png') + src << browse_rsc('pda_eject.png') + src << browse_rsc('pda_exit.png') + src << browse_rsc('pda_flashlight.png') + src << browse_rsc('pda_honk.png') + src << browse_rsc('pda_mail.png') + src << browse_rsc('pda_medical.png') + src << browse_rsc('pda_menu.png') + src << browse_rsc('pda_mule.png') + src << browse_rsc('pda_notes.png') + src << browse_rsc('pda_power.png') + src << browse_rsc('pda_rdoor.png') + src << browse_rsc('pda_reagent.png') + src << browse_rsc('pda_refresh.png') + src << browse_rsc('pda_scanner.png') + src << browse_rsc('pda_signaler.png') + src << browse_rsc('pda_status.png') + //Loads icons for SpiderOS into client + src << browse_rsc('sos_1.png') + src << browse_rsc('sos_2.png') + src << browse_rsc('sos_3.png') + src << browse_rsc('sos_4.png') + src << browse_rsc('sos_5.png') + src << browse_rsc('sos_6.png') + src << browse_rsc('sos_7.png') + src << browse_rsc('sos_8.png') + src << browse_rsc('sos_9.png') + src << browse_rsc('sos_10.png') + src << browse_rsc('sos_11.png') + src << browse_rsc('sos_12.png') + src << browse_rsc('sos_13.png') + src << browse_rsc('sos_14.png') + //End PDA Resource Initialisation =====================================================> \ No newline at end of file diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 270a8448c1..23a9250514 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -15,100 +15,6 @@ anchored = 1 // don't get pushed around - Login() - if (join_motd) - src << "
[join_motd]
" - - if(!preferences) - preferences = new - - if(!mind) - mind = new - mind.key = key - mind.current = src - - var/starting_loc = pick(newplayer_start) - if(!starting_loc) starting_loc = locate(1,1,1) - loc = starting_loc - lastarea = starting_loc - - sight |= SEE_TURFS - - var/list/watch_locations = list() - for(var/obj/effect/landmark/landmark in world) - if(landmark.tag == "landmark*new_player") - watch_locations += landmark.loc - - if(watch_locations.len>0) - loc = pick(watch_locations) - - if(!preferences.savefile_load(src, 1)) - preferences.ShowChoices(src) - if(!client.changes) - changes() - else - var/lastchangelog = length('changelog.html') - if(!client.changes && preferences.lastchangelog!=lastchangelog) - changes() - preferences.lastchangelog = lastchangelog - preferences.savefile_save(src, 1) - - if(preferences.pregame_music) - spawn() Playmusic() // git some tunes up in heeyaa~ - - if(client.has_news()) - src << "There are some unread news for you! Please make sure to read all news, as they may contain important updates about roleplay rules or canon." - - new_player_panel() - //PDA Resource Initialisation =======================================================> - /* - Quick note: local dream daemon instances don't seem to cache images right. Might be - a local problem with my machine but it's annoying nontheless. - */ - if(client) - //load the PDA iconset into the client - src << browse_rsc('pda_atmos.png') - src << browse_rsc('pda_back.png') - src << browse_rsc('pda_bell.png') - src << browse_rsc('pda_blank.png') - src << browse_rsc('pda_boom.png') - src << browse_rsc('pda_bucket.png') - src << browse_rsc('pda_crate.png') - src << browse_rsc('pda_cuffs.png') - src << browse_rsc('pda_eject.png') - src << browse_rsc('pda_exit.png') - src << browse_rsc('pda_flashlight.png') - src << browse_rsc('pda_honk.png') - src << browse_rsc('pda_mail.png') - src << browse_rsc('pda_medical.png') - src << browse_rsc('pda_menu.png') - src << browse_rsc('pda_mule.png') - src << browse_rsc('pda_notes.png') - src << browse_rsc('pda_power.png') - src << browse_rsc('pda_rdoor.png') - src << browse_rsc('pda_reagent.png') - src << browse_rsc('pda_refresh.png') - src << browse_rsc('pda_scanner.png') - src << browse_rsc('pda_signaler.png') - src << browse_rsc('pda_status.png') - //Loads icons for SpiderOS into client - src << browse_rsc('sos_1.png') - src << browse_rsc('sos_2.png') - src << browse_rsc('sos_3.png') - src << browse_rsc('sos_4.png') - src << browse_rsc('sos_5.png') - src << browse_rsc('sos_6.png') - src << browse_rsc('sos_7.png') - src << browse_rsc('sos_8.png') - src << browse_rsc('sos_9.png') - src << browse_rsc('sos_10.png') - src << browse_rsc('sos_11.png') - src << browse_rsc('sos_12.png') - src << browse_rsc('sos_13.png') - src << browse_rsc('sos_14.png') - //End PDA Resource Initialisation =====================================================> - - Logout() ready = 0 ..() diff --git a/config/config.txt b/config/config.txt index b044674548..bb352233a5 100644 --- a/config/config.txt +++ b/config/config.txt @@ -38,6 +38,9 @@ LOG_ATTACK ## log pda messages LOG_PDA +## log all Topic() calls (for use by coders in tracking down Topic issues) +# LOG_HREFS + ## log admin warning messages ##LOG_ADMINWARN ## Also duplicates a bunch of other messages. @@ -53,21 +56,22 @@ SQL_ENABLED 0 ## set to 0 to disable that mode ## Cult mode is in alpha test, enable at your own risk PROBABILITY EXTENDED 0 -PROBABILITY TRAITOR 3 +PROBABILITY TRAITOR 1 PROBABILITY METEOR 0 PROBABILITY MALFUNCTION 0 -PROBABILITY BLOB 1 +PROBABILITY BLOB 0 PROBABILITY NUCLEAR 0 PROBABILITY SANDBOX 0 PROBABILITY WIZARD 0 PROBABILITY RESTRUCTURING 0 PROBABILITY REVOLUTION 1 PROBABILITY CHANGELING 0 -PROBABILITY CULT 1 +PROBABILITY CULT 2 PROBABILITY MONKEY 0 PROBABILITY TRAITORCHAN 0 PROBABILITY EXTEND-A-TRAITORMONGOUS 3 PROBABILITY EPIDEMIC 1 +PROBABILITY MEME 0 ## Hash out to disable random events during the round. ALLOW_RANDOM_EVENTS @@ -126,12 +130,6 @@ GUEST_JOBBAN 1 ## set a server location for world reboot. Don't include the byond://, just give the address and port. # SERVER ss13.example.com:2506 - - - - - - ## forum address # FORUMURL http://baystation12.net/forums/ @@ -156,7 +154,7 @@ GUEST_JOBBAN 1 #POPUP_ADMIN_PM ##What address should banned people appeal ther ban at? Remember to escape the characters, if needed! -APPEAL_ADDRESS http://baystation12.net/forums/index.php/board,2.0.html +# APPEAL_ADDRESS http://baystation12.net/forums/viewforum.php?f=2 ##Defines the ticklag for the world. 0.9 is the normal one, 0.5 is smoother. TICKLAG 0.9