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
This commit is contained in:
Erthilo
2012-06-03 01:09:26 +01:00
parent 813d43e1d5
commit 86feaac9c2
19 changed files with 761 additions and 717 deletions
+12
View File
@@ -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)
@@ -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)
+29 -45
View File
@@ -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("<font color='red'><B>Notice: </B><font color='blue'><A href='?src=\ref[usr];priv_msg=\ref[src]'>[key_name_admin(src)]</A> has the same IP address as <A href='?src=\ref[usr];priv_msg=\ref[M]'>[key_name_admin(M)]</A></font>", 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("<font color='red'><B>Notice: </B><font color='blue'><A href='?src=\ref[usr];priv_msg=\ref[src]'>[key_name_admin(src)]</A> has the same IP address as [key_name_admin(M)] did ([key_name_admin(M)] is no longer logged in).</font>", 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("<font color='red'><B>Notice: </B><font color='blue'><A href='?src=\ref[usr];priv_msg=\ref[src]'>[key_name_admin(src)]</A> has the same <font color='red'><B>computer ID</B><font color='blue'> as <A href='?src=\ref[usr];priv_msg=\ref[M]'>[key_name_admin(M)]</A></font>", 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("<font color='red'><B>Notice: </B><font color='blue'><A href='?src=\ref[usr];priv_msg=\ref[src]'>[key_name_admin(src)]</A> has the same <font color='red'><B>computer ID</B><font color='blue'> as [key_name_admin(M)] did ([key_name_admin(M)] is no longer logged in).</font>", 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("<font color='red'><B>Notice: </B><font color='blue'><A href='?src=\ref[usr];priv_msg=\ref[src]'>[key_name_admin(src)]</A> has the same [matches] as <A href='?src=\ref[usr];priv_msg=\ref[M]'>[key_name_admin(M)]</A>.</font>", 1)
log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)].")
else
message_admins("<font color='red'><B>Notice: </B><font color='blue'><A href='?src=\ref[usr];priv_msg=\ref[src]'>[key_name_admin(src)]</A> has the same [matches] as [key_name_admin(M)] (no longer logged in). </font>", 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
..()
..()
-1
View File
@@ -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
..()
-48
View File
@@ -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 << "<h1 class='alert'>Custom Event</h1>"
src << "<h2 class='alert'>A custom event is taking place. OOC Info:</h2>"
src << "<span class='alert'>[html_encode(custom_event_msg)]</span>"
src << "<br>"
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
-1
View File
@@ -182,7 +182,6 @@
var/job = null//Living
var/nodamage = 0
var/logged_in = 0
var/underwear = 1//Human
var/backbag = 2//Human
+91
View File
@@ -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 << "<div class=\"motd\">[join_motd]</div>"
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 =====================================================>
-94
View File
@@ -15,100 +15,6 @@
anchored = 1 // don't get pushed around
Login()
if (join_motd)
src << "<div class=\"motd\">[join_motd]</div>"
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 << "<b><font color=blue>There are some unread <a href='?src=\ref[news_topic_handler];client=\ref[client];action=show_news'>news</a> for you! Please make sure to read all news, as they may contain important updates about roleplay rules or canon.</font></b>"
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
..()