From 2bec817db26a9b088bff1af03146fa5dc7b41720 Mon Sep 17 00:00:00 2001 From: Mechoid Date: Sat, 4 Mar 2023 11:57:16 -0800 Subject: [PATCH] AI can change their hologram color. (#8955) * AI can change their hologram color. * QDELETED check, extra return. * Typed Vaaaar. --- code/game/machinery/hologram.dm | 13 +- code/modules/mob/living/silicon/ai/ai.dm | 213 ++++++++++++----------- 2 files changed, 126 insertions(+), 100 deletions(-) diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 552fd9cd87..39daf3306d 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -120,8 +120,17 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ hologram.layer = FLY_LAYER//Above all the other objects/mobs. Or the vast majority of them. hologram.anchored = 1//So space wind cannot drag it. hologram.name = "[A.name] (Hologram)"//If someone decides to right click. - hologram.set_light(2) //hologram lighting - hologram.color = color //painted holopad gives coloured holograms + + if(!isnull(color)) + hologram.color = color + else + hologram.color = A.holo_color + + if(hologram.color) //hologram lighting + hologram.set_light(2,1,hologram.color) + else + hologram.set_light(2) + masters[A] = hologram set_light(2) //pad lighting icon_state = "holopad1" diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 8cacfd7db0..89ae6a7ff8 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -54,6 +54,7 @@ var/global/list/ai_verbs_default = list( var/aiRestorePowerRoutine = 0 var/viewalerts = 0 var/icon/holo_icon//Default is assigned when AI is created. + var/holo_color = null var/list/connected_robots = list() var/obj/item/pda/ai/aiPDA = null var/obj/item/communicator/aiCommunicator = null @@ -608,108 +609,124 @@ var/global/list/ai_verbs_default = list( return var/input - var/choice = alert("Would you like to select a hologram based on a (visible) crew member, switch to unique avatar, or load your character from your character slot?",,"Crew Member","Unique","My Character") + var/choice + + choice = alert("Would you like to modify your hologram's model, or color?",,"Model","Color","Cancel") switch(choice) - if("Crew Member") //A seeable crew member (or a dog) - var/list/targets = trackable_mobs() - if(targets.len) - input = input("Select a crew member:") as null|anything in targets //The definition of "crew member" is a little loose... - //This is torture, I know. If someone knows a better way... - if(!input) return - var/new_holo = getHologramIcon(getCompoundIcon(targets[input])) - qdel(holo_icon) - holo_icon = new_holo + if("Color") + input = input("Choose a color:", "Hologram Color", holo_color) as color|null - else - alert("No suitable records found. Aborting.") - - if("My Character") //Loaded character slot - if(!client || !client.prefs) return - var/mob/living/carbon/human/dummy/dummy = new () - //This doesn't include custom_items because that's ... hard. - client.prefs.dress_preview_mob(dummy) - sleep(1 SECOND) //Strange bug in preview code? Without this, certain things won't show up. Yay race conditions? - dummy.regenerate_icons() - - var/new_holo = getHologramIcon(getCompoundIcon(dummy)) - qdel(holo_icon) - qdel(dummy) - holo_icon = new_holo - - else //A premade from the dmi - var/icon_list[] = list( - "default", - "floating face", - "singularity", - "drone", - "carp", - "spider", - "bear", - "slime", - "ian", - "runtime", - "poly", - "pun pun", - "male human", - "female human", - "male unathi", - "female unathi", - "male tajaran", - "female tajaran", - "male tesharii", - "female tesharii", - "male skrell", - "female skrell" - ) - input = input("Please select a hologram:") as null|anything in icon_list if(input) - qdel(holo_icon) - switch(input) - if("default") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo1")) - if("floating face") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo2")) - if("singularity") - holo_icon = getHologramIcon(icon('icons/obj/singularity.dmi',"singularity_s1")) - if("drone") - holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"drone0")) - if("carp") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo4")) - if("spider") - holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"nurse")) - if("bear") - holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"brownbear")) - if("slime") - holo_icon = getHologramIcon(icon('icons/mob/slimes.dmi',"cerulean adult slime")) - if("ian") - holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"corgi")) - if("runtime") - holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"cat")) - if("poly") - holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"parrot_fly")) - if("pun pun") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"punpun")) - if("male human") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holohumm")) - if("female human") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holohumf")) - if("male unathi") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holounam")) - if("female unathi") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holounaf")) - if("male tajaran") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holotajm")) - if("female tajaran") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holotajf")) - if("male tesharii") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holotesm")) - if("female tesharii") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holotesf")) - if("male skrell") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holoskrm")) - if("female skrell") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holoskrf")) + holo_color = input + + if("Model") + choice = alert("Would you like to select a hologram based on a (visible) crew member, switch to unique avatar, load your character from your character slot, or change its color?",,"Crew Member","Unique","My Character") + + switch(choice) + if("Crew Member") //A seeable crew member (or a dog) + var/list/targets = trackable_mobs() + if(targets.len) + var/mob/living/Target + Target = input("Select a crew member:") as null|anything in targets //The definition of "crew member" is a little loose... + //This is torture, I know. If someone knows a better way... + if(QDELETED(Target) || !Target) return + var/new_holo = getHologramIcon(getCompoundIcon(targets[Target])) + qdel(holo_icon) + holo_icon = new_holo + + else + alert("No suitable records found. Aborting.") + + if("My Character") //Loaded character slot + if(!client || !client.prefs) return + var/mob/living/carbon/human/dummy/dummy = new () + //This doesn't include custom_items because that's ... hard. + client.prefs.dress_preview_mob(dummy) + sleep(1 SECOND) //Strange bug in preview code? Without this, certain things won't show up. Yay race conditions? + dummy.regenerate_icons() + + var/new_holo = getHologramIcon(getCompoundIcon(dummy)) + qdel(holo_icon) + qdel(dummy) + holo_icon = new_holo + + else //A premade from the dmi + var/icon_list[] = list( + "default", + "floating face", + "singularity", + "drone", + "carp", + "spider", + "bear", + "slime", + "ian", + "runtime", + "poly", + "pun pun", + "male human", + "female human", + "male unathi", + "female unathi", + "male tajaran", + "female tajaran", + "male tesharii", + "female tesharii", + "male skrell", + "female skrell" + ) + input = input("Please select a hologram:") as null|anything in icon_list + if(input) + qdel(holo_icon) + switch(input) + if("default") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo1")) + if("floating face") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo2")) + if("singularity") + holo_icon = getHologramIcon(icon('icons/obj/singularity.dmi',"singularity_s1")) + if("drone") + holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"drone0")) + if("carp") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo4")) + if("spider") + holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"nurse")) + if("bear") + holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"brownbear")) + if("slime") + holo_icon = getHologramIcon(icon('icons/mob/slimes.dmi',"cerulean adult slime")) + if("ian") + holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"corgi")) + if("runtime") + holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"cat")) + if("poly") + holo_icon = getHologramIcon(icon('icons/mob/animal.dmi',"parrot_fly")) + if("pun pun") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"punpun")) + if("male human") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holohumm")) + if("female human") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holohumf")) + if("male unathi") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holounam")) + if("female unathi") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holounaf")) + if("male tajaran") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holotajm")) + if("female tajaran") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holotajf")) + if("male tesharii") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holotesm")) + if("female tesharii") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holotesf")) + if("male skrell") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holoskrm")) + if("female skrell") + holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holoskrf")) + + + //Toggles the luminosity and applies it by re-entereing the camera. /mob/living/silicon/ai/proc/toggle_camera_light()