Fixes the client.eye problems when a mob is in a atom/moveable which gets deleted.

Robots trapped inside an atom/moveable which gets deleted now ghost properly rather than having their brain dumped into loc=null.

client.images, client.screen and client.eye are always updated upon login()

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4088 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
elly1989@rocketmail.com
2012-07-16 12:15:07 +00:00
parent a4de35c932
commit b222e9cdee
15 changed files with 57 additions and 84 deletions
+1 -9
View File
@@ -1,10 +1,2 @@
/mob/dead/observer/Login()
..()
src.client.screen = null
if (!isturf(src.loc))
src.client.eye = src.loc
src.client.perspective = EYE_PERSPECTIVE
return
return ..()
@@ -31,9 +31,6 @@ Works together with spawning an observer, noted above.
/mob/proc/ghostize(var/transfer_mind = 0)
if(key)
var/mob/dead/observer/ghost = new(src,transfer_mind) //Transfer safety to observer spawning proc.
if(client)
client.images.len = null //remove the images such as AIs being unable to see runes
client.screen.len = null //remove hud items just in case
ghost.attack_log = attack_log //preserve our attack logs by copying them to our ghost
if(transfer_mind && mind) //When a body is destroyed attempt to transfer their mind
mind.transfer_to(ghost)
@@ -1,6 +1,3 @@
/mob/living/carbon/alien/larva/Login()
..()
if(!isturf(loc))
client.eye = loc
client.perspective = EYE_PERSPECTIVE
return
return ..()
@@ -1,6 +1,2 @@
/mob/living/carbon/brain/Login()
..()
if (!isturf(loc))
client.eye = loc
client.perspective = EYE_PERSPECTIVE
return
return ..()
@@ -1,7 +1,4 @@
/mob/living/carbon/human/Login()
..()
update_hud()
if(!isturf(loc))
client.eye = loc
client.perspective = EYE_PERSPECTIVE
return
@@ -356,15 +356,14 @@ Please contact me on #coderbus IRC. ~Carn x
var/image/lying = image("icon_state" = "[t_color]_l")
var/image/standing = image("icon_state" = "[t_color]_s")
if( (FAT in mutations) )
if(FAT in mutations)
if(w_uniform.flags&ONESIZEFITSALL)
lying.icon = 'uniform_fat.dmi'
standing.icon = 'uniform_fat.dmi'
else
src << "\red You burst out of \the [w_uniform]!"
drop_from_inventory(w_uniform)
lying = null
standing = null
return
else
lying.icon = 'uniform.dmi'
standing.icon = 'uniform.dmi'
@@ -1,7 +1,4 @@
/mob/living/carbon/metroid/Login()
..()
update_hud()
if(!isturf(loc))
client.eye = loc
client.perspective = EYE_PERSPECTIVE
return
@@ -1,7 +1,4 @@
/mob/living/carbon/monkey/Login()
..()
update_hud()
if(!isturf(loc))
client.eye = loc
client.perspective = EYE_PERSPECTIVE
return
+2 -6
View File
@@ -1,11 +1,9 @@
/mob/living/silicon/ai/Login() //ThisIsDumb(TM) TODO: tidy this up ¬_¬ ~Carn
client.screen.len = 0
client.images.len = 0
..()
for(var/obj/effect/rune/rune in world)
var/image/blood = image(loc = rune)
blood.override = 1
client.images += blood
..()
regenerate_icons()
flash = new /obj/screen( null )
flash.icon_state = "blank"
@@ -18,9 +16,7 @@
blind.screen_loc = "1,1 to 15,15"
blind.layer = 0
client.screen += list( blind, flash )
if(!isturf(loc))
client.eye = loc
client.perspective = EYE_PERSPECTIVE
if(stat != DEAD)
for(var/obj/machinery/ai_status_display/O in world) //change status
if(O)
+2 -2
View File
@@ -12,6 +12,6 @@
//New pAI's get a brand new mind to prevent meta stuff from their previous life. This new mind causes problems down the line if it's not deleted here.
//Read as: I have no idea what I'm doing but asking for help got me nowhere so this is what you get. - Nodrak
del(mind)
if(key) ghostize(0)
if(mind) del(mind)
ghostize(0)
del(src)
@@ -2,9 +2,6 @@
..()
regenerate_icons()
if(!isturf(loc))
client.eye = loc
client.perspective = EYE_PERSPECTIVE
if(real_name == "Cyborg")
ident = rand(1, 999)
real_name += " "
+19 -17
View File
@@ -58,25 +58,27 @@
//Improved /N
/mob/living/silicon/robot/Del()
if(mmi)//Safety for when a cyborg gets dust()ed. Or there is no MMI inside.
mmi.loc = get_turf(loc)//To hopefully prevent run time errors.
var/turf/T = get_turf(loc)//To hopefully prevent run time errors.
if(T)
mmi.loc = T
if(!key)
for(var/mob/dead/observer/ghost in world)
if(ghost.corpse == src && ghost.client)
ghost.client.mob = ghost.corpse
if(!key) //if we don't have an associated key, try to find the ghost of this body
for(var/mob/dead/observer/ghost in world)
if(ghost.corpse == src && ghost.client)
ghost.client.mob = ghost.corpse
if(key)//If there is a client attached to host.
if(client)
client.screen.len = null
if(mind)//If the cyborg has a mind. It should if it's a player. May not.
mind.transfer_to(mmi.brainmob)
else if(!mmi.brainmob.mind)//If the brainmob has no mind and neither does the cyborg. Shouldn't happen but can due to admun canspiraucy.
mmi.brainmob.mind = new()//Quick mind initialize
mmi.brainmob.mind.current = mmi.brainmob
mmi.brainmob.mind.assigned_role = "Assistant"//Default to an assistant.
mmi.brainmob.key = key
else//If the brain does have a mind. Also shouldn't happen but who knows.
mmi.brainmob.key = key
if(key)//If there is a client attached to host.
if(client)
client.screen.len = null
if(mind)//If the cyborg has a mind. It should if it's a player. May not.
mind.transfer_to(mmi.brainmob)
else if(!mmi.brainmob.mind)//If the brainmob has no mind and neither does the cyborg. Shouldn't happen but can due to admun canspiraucy.
mmi.brainmob.mind = new()//Quick mind initialize
mmi.brainmob.mind.current = mmi.brainmob
mmi.brainmob.mind.assigned_role = "Assistant"//Default to an assistant.
mmi.brainmob.key = key
else//If the brain does have a mind. Also shouldn't happen but who knows.
mmi.brainmob.key = key
mmi = null
..()
+16 -8
View File
@@ -24,14 +24,22 @@
/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)
src.hud_used = new/obj/hud( src )
client.images = null //remove the images such as AIs being unable to see runes
client.screen = null //remove hud items just in case
if(!dna) dna = new /datum/dna(null)
if(hud_used) del(hud_used)
hud_used = new/obj/hud( src )
src.next_move = 1
src.sight |= SEE_SELF
next_move = 1
sight |= SEE_SELF
..()
if(loc && !isturf(loc))
client.eye = loc
client.perspective = EYE_PERSPECTIVE
else
client.eye = src
client.perspective = MOB_PERSPECTIVE
+12 -11
View File
@@ -28,19 +28,20 @@
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)
spawn(60)
if(client)
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)
handle_privacy_poll()
new_player_panel()
//PDA Resource Initialisation =======================================================>