mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 22:19:30 +01:00
* It's a start * more stuff * a * nice * Update attachable_soulcatcher.dm * code work better :3 * mal requested proc * let's move this little file over * Update soulcatcher_mob.dm * hehe :) * say * some more touches * Update soulcatcher_component.dm * working on signals * a * more * sending some signals :) * Update soulcatcher_component.dm * a instance I missed * some slimming down * whoops * Update declarations.dm * Apply suggestions from code review Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> * Update modular_skyrat/modules/modular_implants/code/soulcatcher/soulcatcher_tgui.dm Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> * Update modular_skyrat/modules/modular_implants/code/soulcatcher/soulcatcher_component.dm Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> * Update modular_skyrat/modules/modular_implants/code/soulcatcher/soulcatcher_user_component.dm Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> * Update modular_skyrat/modules/modular_implants/code/soulcatcher/soulcatcher_user_component.dm Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> * Update modular_skyrat/modules/modular_implants/code/soulcatcher/soulcatcher_user_component.dm Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> * Update modular_skyrat/modules/modular_implants/code/soulcatcher/soulcatcher_tgui.dm Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> * Update soulcatcher_tgui.dm * wew * woag * I don't want this PR to be hell to review * okay, just a little bit of moving * a * defines, they do exist * man * more renaming * mob * Update carrier_component.dm * Update soulcatcher_component.dm * a * some more moving * Update soulcatcher_verbs.dm * more tweaks * a * Update carrier_user_component.dm * chat fixes * updates how verbs work * getting the code to work * more adjustments * aaaaaa * Update carrier_tgui.dm * final fixes * Update carrier_tgui.dm --------- Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
93 lines
3.8 KiB
Plaintext
93 lines
3.8 KiB
Plaintext
/datum/component/carrier_communicator
|
|
/// What carrier room is the parent mob currently trying to communicate with?
|
|
var/datum/weakref/target_carrier
|
|
/// Is the mob trying to communicate with the carrier they are inside?
|
|
var/carried_mob = FALSE
|
|
|
|
/datum/component/carrier_communicator/New()
|
|
. = ..()
|
|
var/mob/living/parent_mob = parent
|
|
if(!istype(parent_mob))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
add_verb(parent_mob, list(/mob/living/proc/carrier_say, /mob/living/proc/carrier_emote))
|
|
|
|
/datum/component/carrier_communicator/Destroy(force)
|
|
var/mob/living/holder = parent
|
|
if(!istype(holder))
|
|
return FALSE
|
|
|
|
remove_verb(holder, list(/mob/living/proc/carrier_say, /mob/living/proc/carrier_emote))
|
|
return ..()
|
|
|
|
/// Prompts the parent mob to send a say message to the soulcatcher. Returns False if no soulcatcher or message could be found.
|
|
/mob/living/proc/carrier_say()
|
|
set name = "Carrier Say"
|
|
set category = "IC"
|
|
set desc = "Send a Say message to your currently targeted carrier room."
|
|
|
|
var/datum/carrier_room/room_to_send_to = get_current_carrier_room()
|
|
if(!istype(room_to_send_to))
|
|
to_chat(src, span_warning("You do not have a carrier you can send messages to!"))
|
|
return FALSE
|
|
|
|
var/message_to_send = tgui_input_text(usr, "Input the message you want to send", "Carrier", multiline = TRUE)
|
|
if(!message_to_send)
|
|
return FALSE
|
|
|
|
var/message_sender = room_to_send_to.outside_voice
|
|
var/datum/component/carrier_user/carrier_user_component = GetComponent(/datum/component/carrier_user)
|
|
var/datum/component/carrier_communicator/communicator_component = GetComponent(/datum/component/carrier_communicator)
|
|
if(istype(carrier_user_component) && istype(communicator_component) && communicator_component.carried_mob)
|
|
message_sender = carrier_user_component.name
|
|
|
|
room_to_send_to.send_message(message_to_send, message_sender)
|
|
return TRUE
|
|
|
|
/// Prompts the parent mob to send a emote to the soulcatcher. Returns False if no soulcatcher or emote could be found.
|
|
/mob/living/proc/carrier_emote()
|
|
set name = "Carrier Me"
|
|
set category = "IC"
|
|
set desc = "Send a emote to your currently targeted carrier room."
|
|
|
|
var/datum/carrier_room/room_to_send_to = get_current_carrier_room()
|
|
if(!istype(room_to_send_to))
|
|
to_chat(src, span_warning("You do not have a carrier you can send emotes to!"))
|
|
return FALSE
|
|
|
|
var/message_to_send = tgui_input_text(usr, "Input the emote you want to send", "Soulcatcher", multiline = TRUE)
|
|
if(!message_to_send)
|
|
return FALSE
|
|
|
|
var/message_sender = room_to_send_to.outside_voice
|
|
var/datum/component/carrier_user/carrier_user_component = GetComponent(/datum/component/carrier_user)
|
|
var/datum/component/carrier_communicator/communicator_component = GetComponent(/datum/component/carrier_communicator)
|
|
if(istype(carrier_user_component) && istype(communicator_component) && communicator_component.carried_mob)
|
|
message_sender = carrier_user_component.name
|
|
|
|
room_to_send_to.send_message(message_to_send, message_sender, TRUE)
|
|
return TRUE
|
|
|
|
/// Attempts to find and return the current carrier room the mob is using.
|
|
/mob/living/proc/get_current_carrier_room()
|
|
var/datum/component/carrier_communicator/communicator_component = GetComponent(/datum/component/carrier_communicator)
|
|
if(!communicator_component)
|
|
return FALSE
|
|
|
|
var/datum/component/carrier/master_carrier = communicator_component.target_carrier?.resolve()
|
|
if(!istype(master_carrier))
|
|
return FALSE
|
|
|
|
var/datum/carrier_room/target_room = master_carrier.targeted_carrier_room
|
|
var/datum/component/carrier_user/carrier_user_component = GetComponent(/datum/component/carrier_user)
|
|
if(communicator_component.carried_mob && istype(carrier_user_component))
|
|
target_room = carrier_user_component.current_room.resolve()
|
|
if(!istype(target_room))
|
|
return FALSE
|
|
|
|
if(!Adjacent(master_carrier.parent))
|
|
communicator_component.target_carrier = null
|
|
return FALSE
|
|
|
|
return target_room
|