Merge pull request #16017 from SandPoot/silicons-flavor-text-loading
Silicon flavor text loading (for real now)
This commit is contained in:
@@ -358,6 +358,7 @@
|
||||
#define COMSIG_MOB_CLIENT_MOVE "mob_client_move" //sent when client/Move() finishes with no early returns: (client, direction, n, oldloc)
|
||||
#define COMSIG_MOB_CLIENT_CHANGE_VIEW "mob_client_change_view" //from base of /client/change_view(): (client, old_view, view)
|
||||
#define COMSIG_MOB_CLIENT_MOUSEMOVE "mob_client_mousemove" //from base of /client/MouseMove(): (object, location, control, params)
|
||||
#define COMSIG_MOB_CLIENT_JOINED_FROM_LOBBY "mob_client_joined_from_lobby" //sent when a player joins/latejoins the game: (new_character, client, late_transfer)
|
||||
|
||||
///sent when a mob/login() finishes: (client)
|
||||
#define COMSIG_MOB_CLIENT_LOGIN "comsig_mob_client_login"
|
||||
|
||||
@@ -41,12 +41,17 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
|
||||
LAZYOR(GLOB.mobs_with_editable_flavor_text[M], src)
|
||||
add_verb(M, /mob/proc/manage_flavor_tests)
|
||||
|
||||
if(save_key && ishuman(target))
|
||||
if(!save_key)
|
||||
return
|
||||
if(ishuman(target))
|
||||
RegisterSignal(target, COMSIG_HUMAN_PREFS_COPIED_TO, .proc/update_prefs_flavor_text)
|
||||
else if(iscyborg(target))
|
||||
RegisterSignal(target, COMSIG_MOB_ON_NEW_MIND, .proc/borged_update_flavor_text)
|
||||
RegisterSignal(target, COMSIG_MOB_CLIENT_JOINED_FROM_LOBBY, .proc/borged_update_flavor_text)
|
||||
|
||||
/datum/element/flavor_text/Detach(atom/A)
|
||||
. = ..()
|
||||
UnregisterSignal(A, list(COMSIG_PARENT_EXAMINE, COMSIG_HUMAN_PREFS_COPIED_TO))
|
||||
UnregisterSignal(A, list(COMSIG_PARENT_EXAMINE, COMSIG_HUMAN_PREFS_COPIED_TO, COMSIG_MOB_ON_NEW_MIND, COMSIG_MOB_CLIENT_JOINED_FROM_LOBBY))
|
||||
texts_by_atom -= A
|
||||
if(can_edit && ismob(A))
|
||||
var/mob/M = A
|
||||
@@ -149,6 +154,20 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
|
||||
if(P.features.Find(save_key))
|
||||
texts_by_atom[H] = P.features[save_key]
|
||||
|
||||
/datum/element/flavor_text/proc/borged_update_flavor_text(mob/new_character, client/C)
|
||||
C = C || GET_CLIENT(new_character)
|
||||
if(!C)
|
||||
LAZYREMOVE(texts_by_atom, new_character)
|
||||
return
|
||||
var/datum/preferences/P = C.prefs
|
||||
if(!P)
|
||||
LAZYREMOVE(texts_by_atom, new_character)
|
||||
return
|
||||
if(P.custom_names["cyborg"] == new_character.real_name)
|
||||
LAZYSET(texts_by_atom, new_character, P.features[save_key])
|
||||
else
|
||||
LAZYREMOVE(texts_by_atom, new_character)
|
||||
|
||||
//subtypes with additional hooks for DNA and preferences.
|
||||
/datum/element/flavor_text/carbon
|
||||
//list of antagonists etcetera that should have nothing to do with people's snowflakes.
|
||||
|
||||
@@ -702,13 +702,14 @@
|
||||
. = H
|
||||
new_character = .
|
||||
if(transfer_after)
|
||||
transfer_character()
|
||||
transfer_character(TRUE)
|
||||
|
||||
/mob/dead/new_player/proc/transfer_character()
|
||||
/mob/dead/new_player/proc/transfer_character(late_transfer = FALSE)
|
||||
. = new_character
|
||||
if(.)
|
||||
new_character.key = key //Manually transfer the key to log them in
|
||||
new_character.stop_sound_channel(CHANNEL_LOBBYMUSIC)
|
||||
SEND_SIGNAL(new_character, COMSIG_MOB_CLIENT_JOINED_FROM_LOBBY, new_character?.client, late_transfer)
|
||||
new_character = null
|
||||
qdel(src)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user