Preferences now store client key instead of the client itself.

For reasons unbeknown to me, the client var is reset when the client logs outs and thus the preference mob cease to be.
Now stores the client key, and acquires the appropriate mob based on that, if possible.
Also removes the sanitation check because the holder isn't set before the preferences are created.

Fixes #12341.
This commit is contained in:
PsiOmegaDelta
2016-03-04 21:52:41 +01:00
committed by Yoshax
parent dfe77a0669
commit ea579b2da6
3 changed files with 23 additions and 7 deletions

View File

@@ -212,13 +212,13 @@
/datum/category_item/player_setup_item/Topic(var/href,var/list/href_list)
if(..())
return 1
var/mob/user = usr
if(!user.client)
var/mob/pref_mob = preference_mob()
if(!pref_mob || !pref_mob.client)
return 1
. = OnTopic(href, href_list, user)
. = OnTopic(href, href_list, usr)
if(. == TOPIC_REFRESH)
user.client.prefs.ShowChoices(user)
pref_mob.client.prefs.ShowChoices(usr)
/datum/category_item/player_setup_item/CanUseTopic(var/mob/user)
return 1
@@ -227,5 +227,4 @@
return TOPIC_NOACTION
/datum/category_item/player_setup_item/proc/preference_mob()
if(pref && pref.client && pref.client.mob)
return pref.client.mob
return get_mob_by_key(pref.client_ckey)