mirror of
https://github.com/quotefox/Hyper-Station-13.git
synced 2026-08-22 04:06:14 +01:00
Fix borg flavortext
Ensures silicon flavortext is properly populated whenever a borg mind initializes by creating a new signal for it in mind.dm. Brings savefile code for silicon flavortext in line with standards for OOC and IC flavortext. Tested and works upon round start, when borgified, or when an AI deploys to a shell.
This commit is contained in:
@@ -191,7 +191,6 @@
|
||||
#define COMSIG_CLICK_CTRL_SHIFT "ctrl_shift_click" //from base of atom/CtrlShiftClick(/mob)
|
||||
#define COMSIG_MOUSEDROP_ONTO "mousedrop_onto" //from base of atom/MouseDrop(): (/atom/over, /mob/user)
|
||||
#define COMPONENT_NO_MOUSEDROP 1
|
||||
#define COMSIG_MOUSEDROPPED_ONTO "mousedropped_onto"
|
||||
|
||||
|
||||
#define COMSIG_MICRO_PICKUP_FEET "micro_force_grabbed" //From /datum/element/mob_holder/micro
|
||||
@@ -377,6 +376,10 @@
|
||||
#define COMSIG_LIVING_CAN_TRACK "mob_cantrack"
|
||||
#define COMPONENT_CANT_TRACK (1<<0)
|
||||
|
||||
// /mob/living/silicon signals
|
||||
|
||||
#define COMSIG_SILICON_MIND_ATTACHED "silicon_mind_attached" //from /mob/living/silicon/robot/mind_initialize(): (/mob/living/silicon)
|
||||
|
||||
// /mob/living/carbon signals
|
||||
|
||||
///from base of mob/living/carbon/soundbang_act(): (list(intensity))
|
||||
|
||||
@@ -40,12 +40,17 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
|
||||
LAZYOR(GLOB.mobs_with_editable_flavor_text[M], src)
|
||||
M.verbs |= /mob/proc/manage_flavor_tests
|
||||
|
||||
if(save_key && ishuman(target))
|
||||
RegisterSignal(target, COMSIG_HUMAN_PREFS_COPIED_TO, .proc/update_prefs_flavor_text)
|
||||
if(save_key)
|
||||
if(ishuman(target))
|
||||
RegisterSignal(target, COMSIG_HUMAN_PREFS_COPIED_TO, .proc/update_prefs_flavor_text)
|
||||
|
||||
//add silicon flavor text when mind initializes.
|
||||
else if(issilicon(target))
|
||||
RegisterSignal(target, COMSIG_SILICON_MIND_ATTACHED, .proc/set_initial_silicon_flavor)
|
||||
|
||||
/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_SILICON_MIND_ATTACHED))
|
||||
texts_by_atom -= A
|
||||
if(can_edit && ismob(A))
|
||||
var/mob/M = A
|
||||
@@ -150,7 +155,22 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/element/flavor_text/proc/set_initial_silicon_flavor(datum/source, mob/living/silicon/user)
|
||||
|
||||
if(!(user in texts_by_atom))
|
||||
return FALSE
|
||||
|
||||
//var/new_text = user.client.prefs.features["silicon_flavor_text"]
|
||||
var/new_text = user.client.prefs.features["silicon_flavor_text"]
|
||||
if(!isnull(new_text) && (user in texts_by_atom))
|
||||
texts_by_atom[user] = new_text
|
||||
to_chat(user, "Your silicon flavor text has been updated.")
|
||||
to_chat(user, "[new_text] is your silicon flavor text.")
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/element/flavor_text/proc/update_prefs_flavor_text(mob/living/carbon/human/H, datum/preferences/P, icon_updates = TRUE, roundstart_checks = TRUE)
|
||||
to_chat(src, "Update prefs flavor text triggered.")
|
||||
if(P.features.Find(save_key))
|
||||
texts_by_atom[H] = P.features[save_key]
|
||||
|
||||
|
||||
@@ -890,6 +890,7 @@
|
||||
/mob/living/silicon/robot/mind_initialize()
|
||||
..()
|
||||
mind.assigned_role = "Cyborg"
|
||||
SEND_SIGNAL(src, COMSIG_SILICON_MIND_ATTACHED, src) //Sends the signal that a mind has been attached. Used when adding initial flavortext to silicon.
|
||||
|
||||
//PAI
|
||||
/mob/living/silicon/pai/mind_initialize()
|
||||
|
||||
@@ -454,13 +454,21 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
else //We have no old flavortext, default to new
|
||||
S["feature_flavor_text"] >> features["flavor_text"]
|
||||
|
||||
S["feature_silicon_flavor_text"] >> features["silicon_flavor_text"]
|
||||
|
||||
if((S["silicon_flavor_text"] != "") && (S["silicon_flavor_text"] != null) && S["silicon_flavor_text"])
|
||||
S["silicon_flavor_text"] >> features["silicon_flavor_text"]
|
||||
|
||||
WRITE_FILE(S["feature_silicon_flavor_text"], features["silicon_flavor_text"]) //Save it in our new type of flavor-text
|
||||
WRITE_FILE(S["silicon_flavor_text"], "") //Remove old flavortext, completing the cut-and-paste into the new format.
|
||||
else
|
||||
S["feature_silicon_flavor_text"] >> features["silicon_flavor_text"]
|
||||
|
||||
|
||||
if((S["ooc_text"] != "") && (S["ooc_text"] != null) && S["ooc_text"])
|
||||
S["ooc_text"] >> features["ooc_text"]
|
||||
|
||||
WRITE_FILE(S["feature_ooc_text"], features["ooc_text"]) //Save it in our new type of flavor-text
|
||||
WRITE_FILE(S["ooc_text"], "") //Remove old flavortext, completing the cut-and-paste into the new format.
|
||||
|
||||
else
|
||||
S["feature_ooc_text"] >> features["ooc_text"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user