[JAMIE] Cyborgs automatically get PDA messengers & AI has a tablet now (#16947)

* AI PDA AAHHHHH

* parity in job names

* del tablet on destroy

* Update ntpda_msg.dm

* Update ntpda_msg.dm
This commit is contained in:
ynot01
2022-12-06 12:38:44 -05:00
committed by GitHub
parent 7244001bae
commit c2bb7c3b90
11 changed files with 104 additions and 112 deletions

View File

@@ -582,7 +582,7 @@
if(starting_components.len < 1)
return
for(var/part in starting_components)
var/new_part = new part
var/new_part = new part(src)
if(istype(new_part, /obj/item/computer_hardware))
var/result = install_component(new_part)
if(result == FALSE)

View File

@@ -9,7 +9,7 @@
comp_light_luminosity = 0
variants = null
///Ref to the borg we're installed in. Set by the borg during our creation.
var/mob/living/silicon/robot/borgo
var/mob/living/silicon/borgo
///Ref to the RoboTact app. Important enough to borgs to deserve a ref.
var/datum/computer_file/program/robotact/robotact
///IC log that borgs can view in their personal management app
@@ -21,7 +21,7 @@
borgo = loc
if(!istype(borgo))
borgo = null
stack_trace("[type] initialized outside of a borg, deleting.")
stack_trace("[type] initialized outside of a silicon, deleting.")
return INITIALIZE_HINT_QDEL
RegisterSignal(src, COMSIG_PDA_CHECK_DETONATE, .proc/pda_no_detonate)
@@ -68,33 +68,37 @@
/obj/item/modular_computer/tablet/integrated/ui_data(mob/user)
. = ..()
.["has_light"] = TRUE
.["light_on"] = borgo?.lamp_enabled
.["comp_light_color"] = borgo?.lamp_color
if(istype(borgo, /mob/living/silicon/robot))
var/mob/living/silicon/robot/R = borgo
.["light_on"] = R?.lamp_enabled
.["comp_light_color"] = R?.lamp_color
//Overrides the ui_act to make the flashlight controls link to the borg instead
/obj/item/modular_computer/tablet/integrated/ui_act(action, params)
switch(action)
if("PC_toggle_light")
if(!borgo)
return FALSE
borgo.toggle_headlamp()
return TRUE
if(istype(borgo, /mob/living/silicon/robot))
var/mob/living/silicon/robot/R = borgo
switch(action)
if("PC_toggle_light")
if(!R)
return FALSE
R.toggle_headlamp()
return TRUE
if("PC_light_color")
if(!borgo)
return FALSE
var/mob/user = usr
var/new_color
while(!new_color)
new_color = input(user, "Choose a new color for [src]'s flashlight.", "Light Color",light_color) as color|null
if(!new_color || QDELETED(borgo))
return
if(color_hex2num(new_color) < 200) //Colors too dark are rejected
to_chat(user, "<span class='warning'>That color is too dark! Choose a lighter one.</span>")
new_color = null
borgo.lamp_color = new_color
borgo.toggle_headlamp(FALSE, TRUE)
return TRUE
if("PC_light_color")
if(!R)
return FALSE
var/mob/user = usr
var/new_color
while(!new_color)
new_color = input(user, "Choose a new color for [src]'s flashlight.", "Light Color",light_color) as color|null
if(!new_color || QDELETED(R))
return
if(color_hex2num(new_color) < 200) //Colors too dark are rejected
to_chat(user, "<span class='warning'>That color is too dark! Choose a lighter one.</span>")
new_color = null
R.lamp_color = new_color
R.toggle_headlamp(FALSE, TRUE)
return TRUE
return ..()
/obj/item/modular_computer/tablet/integrated/syndicate
@@ -107,4 +111,6 @@
/obj/item/modular_computer/tablet/integrated/syndicate/Initialize()
. = ..()
borgo.lamp_color = COLOR_RED //Syndicate likes it red
if(istype(borgo, /mob/living/silicon/robot))
var/mob/living/silicon/robot/R = borgo
R.lamp_color = COLOR_RED //Syndicate likes it red

View File

@@ -63,7 +63,7 @@ GLOBAL_LIST_EMPTY(NTPDAMessages)
/datum/computer_file/program/pdamessager/proc/send_message(message, datum/computer_file/program/pdamessager/recipient, mob/user)
if(user.shared_ui_interaction(computer) < UI_INTERACTIVE) //no replying if you're incapacitated
return
if(user.physical_can_use_topic(computer) < UI_INTERACTIVE) //no replying if you're too far away
if(!istype(user, /mob/living/silicon/ai) && user.physical_can_use_topic(computer) < UI_INTERACTIVE) //no replying if you're too far away
return
// FOR SOME REASON [computer] ISN'T SET ON INIT AND IS SET WHEN YOU START IT UP THE FIRST TIME
var/obj/item/modular_computer/comp

View File

@@ -166,10 +166,32 @@
w_class = WEIGHT_CLASS_TINY
custom_price = 15
// For borg integrated tablets.
// For silicon integrated tablets.
/obj/item/computer_hardware/hard_drive/small/integrated/install_default_programs()
..()
store_file(new /datum/computer_file/program/robotact(src))
var/datum/computer_file/program/pdamessager/P = store_file(new/datum/computer_file/program/pdamessager(src))
var/obj/item/modular_computer/stored = holder
if(!stored && istype(loc, /obj/item/modular_computer))
stored = loc
if(P && istype(stored?.loc, /mob/living/silicon))
var/mob/living/silicon/R = stored.loc
var/jobname
if(R.job)
jobname = R.job
else if(istype(R, /mob/living/silicon/robot))
jobname = "[R.designation ? "[R.designation] " : ""]Cyborg"
else if(R.designation)
jobname = R.designation
else if(istype(R, /mob/living/silicon/ai))
jobname = "AI"
else if(istype(R, /mob/living/silicon/pai))
jobname = "pAI"
else
jobname = "Silicon"
P.username = "[R.real_name] ([jobname])" // This is (and hopefully remains to be) created after silicons are named
P.receiving = TRUE
if(istype(stored?.loc, /mob/living/silicon/robot)) // RoboTact is for cyborgs only, not AIs
store_file(new /datum/computer_file/program/robotact(src))
// Syndicate variant - very slight better
/obj/item/computer_hardware/hard_drive/small/syndicate

View File

@@ -87,13 +87,15 @@
if(!modularInterface || !istype(modularInterface))
return FALSE //wrong type of tablet
if(!modularInterface.borgo)
return FALSE //No borg found
if(istype(modularInterface.borgo, /mob/living/silicon/robot))
var/mob/living/silicon/robot/R = modularInterface.borgo
if(!R)
return FALSE //No borg found
if(modularInterface.borgo.lockcharge)
return FALSE //lockdown restricts borg networking
if(R.lockcharge)
return FALSE //lockdown restricts borg networking
if(!modularInterface.borgo.cell || modularInterface.borgo.cell.charge == 0)
return FALSE //borg cell dying restricts borg networking
if(!R.cell || R.cell.charge == 0)
return FALSE //borg cell dying restricts borg networking
return ..()