From 6e02e416c12082f5f7bee6021b37b8230b59b192 Mon Sep 17 00:00:00 2001 From: Geeves Date: Mon, 23 Nov 2020 12:17:54 +0200 Subject: [PATCH] AI Hologram Fix (#10519) --- code/_helpers/icons.dm | 8 -- code/game/machinery/hologram.dm | 2 +- code/modules/mob/living/silicon/ai/ai.dm | 89 ++++++++--------------- html/changelogs/geeves-ai_holo_icon.yml | 7 ++ icons/mob/AI.dmi | Bin 364715 -> 364726 bytes 5 files changed, 40 insertions(+), 66 deletions(-) create mode 100644 html/changelogs/geeves-ai_holo_icon.yml diff --git a/code/_helpers/icons.dm b/code/_helpers/icons.dm index 2a07f2d496d..173b04febd8 100644 --- a/code/_helpers/icons.dm +++ b/code/_helpers/icons.dm @@ -870,14 +870,6 @@ proc/ColorTone(rgb, tone) if(4) I.pixel_y++ overlays += I//And finally add the overlay. -/proc/getHologramIcon(icon/A, safety=1)//If safety is on, a new icon is not created. - var/icon/flat_icon = safety ? A : new(A)//Has to be a new icon to not constantly change the same icon. - flat_icon.ColorTone(rgb(125,180,225))//Let's make it bluish. - flat_icon.ChangeOpacity(0.5)//Make it half transparent. - var/icon/alpha_mask = new('icons/effects/effects.dmi', "scanline")//Scanline effect. - flat_icon.AddAlphaMask(alpha_mask)//Finally, let's mix in a distortion effect. - return flat_icon - //For photo camera. /proc/build_composite_icon(atom/A) var/icon/composite = icon(A.icon, A.icon_state, A.dir, 1) diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index a6ce5f9680a..c546fd7a1ea 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -384,7 +384,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ /obj/effect/overlay/hologram/proc/assume_form(var/atom/A) if(isAI(A)) var/mob/living/silicon/ai/AI = A - icon = AI.holo_icon + appearance = AI.holo_icon.appearance else appearance = A.appearance mouse_opacity = 0 //So you can't click on it. diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 542be07bf9e..8e1809a030e 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -54,7 +54,7 @@ var/list/ai_verbs_default = list( var/carded // Holopad and holograms - var/icon/holo_icon + var/mob/holo_icon // an abstract mob used to store icon info var/hologram_follow = TRUE //This is used for the AI eye, to determine if a holopad's hologram should follow it or not // Equipment @@ -136,7 +136,7 @@ var/list/ai_verbs_default = list( canmove = FALSE density = TRUE - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo1")) + set_hologram_unique(icon('icons/mob/AI.dmi', "default")) if(L && istype(L, /datum/ai_laws)) laws = L @@ -203,6 +203,7 @@ var/list/ai_verbs_default = list( QDEL_NULL(ai_radio) QDEL_NULL(psupply) QDEL_NULL(ai_camera) + QDEL_NULL(holo_icon) ai_list -= src destroy_eyeobj() return ..() @@ -626,6 +627,7 @@ var/list/ai_verbs_default = list( return //I am the icon meister. Bow fefore me. //>fefore +// now im the icon meister and it's performant lick my nuts fefore - geeves /mob/living/silicon/ai/proc/ai_hologram_change() set name = "Change Hologram" set desc = "Change the default hologram available to AI to something else." @@ -635,64 +637,37 @@ var/list/ai_verbs_default = list( return var/input - if(alert("Would you like to select a hologram based on a crew member or switch to unique avatar?",,"Crew Member","Unique")=="Crew Member") - - var/personnel_list[] = list() - var/current_mobs = list() - - for(var/mob/living/carbon/human/H in human_mob_list) - current_mobs[H.real_name] = H - for(var/datum/record/general/t in SSrecords.records_locked)//Look in data core locked. - personnel_list["[t.name]: [t.rank]"] = t.photo_front //Pull names, rank, and image. - if(current_mobs[t.name]) - personnel_list["[t.name]: [t.rank]"] = list("mob" = current_mobs[t.name], "image" = t.photo_front) - - if(personnel_list.len) - input = input("Select a crew member:") as null|anything in personnel_list - var/selection = personnel_list[input] - var/icon/character_icon - if(selection && istype(selection, /list)) - var/mob/living/carbon/human/H = selection["mob"] - if (H.near_camera()) - character_icon = new('icons/mob/human.dmi', "blank") - for(var/renderdir in cardinal) - character_icon.Insert(getHologramIcon(getFlatIcon(H, renderdir)), dir = renderdir) - else - character_icon = getHologramIcon(icon(selection["image"])) - if(selection && istype(selection, /icon)) - character_icon = getHologramIcon(icon(selection)) - if(character_icon) - qdel(holo_icon) // Clear old icon so we're not storing it in memory. - holo_icon = character_icon + if(alert(usr, "Would you like to select a hologram based on a humanoids within camera view or switch to a unique avatar?",,"Humanoids","Unique") == "Humanoids") + var/list/selectable_humans = list() + for(var/mob/living/carbon/human/H in view(usr.client)) + if(H.near_camera()) + selectable_humans[H.name] = H + if(length(selectable_humans)) + var/chosen_human = input(usr, "Select the humanoid whose form you wish to emulate.", "Hologram Select") as null|anything in selectable_humans + if(!chosen_human) + return + var/mob/living/carbon/human/H = selectable_humans[chosen_human] + holo_icon.appearance = H.appearance else - alert("No suitable records found. Aborting.") - + to_chat(usr, SPAN_WARNING("There are no humanoids within camera view to base your hologram on.")) else - var/icon_list[] = list( - "default", - "floating face", - "carp", - "custom" - ) - input = input("Please select a hologram:") as null|anything in icon_list + input = input("Please select a hologram:") as null|anything in list("default", "floating face", "carp", "custom") 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("carp") - holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo4")) - if("custom") - if(custom_sprite) - var/datum/custom_synth/sprite = robot_custom_icons[name] - if(istype(sprite) && sprite.synthckey == ckey && sprite.aiholoicon) - holo_icon = getHologramIcon(icon("icons/mob/custom_synths/customhologram.dmi","[sprite.aiholoicon]")) - else - to_chat(src, "You do not have a custom sprite!") - return - return + if(input == "custom") + if(custom_sprite) + var/datum/custom_synth/sprite = robot_custom_icons[name] + if(istype(sprite) && sprite.synthckey == ckey && sprite.aiholoicon) + set_hologram_unique(icon("icons/mob/custom_synths/customhologram.dmi", "[sprite.aiholoicon]")) + else + to_chat(src, SPAN_WARNING("You do not have a custom sprite!")) + else + set_hologram_unique(icon('icons/mob/AI.dmi', input)) + +/mob/living/silicon/ai/proc/set_hologram_unique(var/icon/I) + QDEL_NULL(holo_icon) + holo_icon = new /mob/abstract(src) + holo_icon.invisibility = 0 + holo_icon.icon = I //Toggles the luminosity and applies it by re-entereing the camera. /mob/living/silicon/ai/proc/toggle_camera_light() diff --git a/html/changelogs/geeves-ai_holo_icon.yml b/html/changelogs/geeves-ai_holo_icon.yml new file mode 100644 index 00000000000..8efa098f18c --- /dev/null +++ b/html/changelogs/geeves-ai_holo_icon.yml @@ -0,0 +1,7 @@ +author: Geeves + +delete-after: True + +changes: + - bugfix: "AI holograms are now visible again." + - tweak: "AI can now set their holograms to be any humanoid within camera view." \ No newline at end of file diff --git a/icons/mob/AI.dmi b/icons/mob/AI.dmi index f364c4ddbd7609100a5c1a02f89972a10dc8cd3f..24543a22e3164a46864f24856b91ac6a45295a90 100644 GIT binary patch delta 763 zcmVo{8MW#t-Hur!Gl4a!a9-X5$2hpb>1ATOdtC5>f&1ryPtHqfGF1rvF+ zs8GQRD_Fu4E_f1Lq7QXtusSDPX}~rFpl68f*1d!clY`?GUwOM4t@M>vy^u2^WWh&P zv}m-mTkTlEM8-wl&!WN_cFGYhMz_{VgOlBc)leb@@YlKovke<%hdeT#@r-AOUGZdf z#iT_tX^~D_tS3!>vN=R3mELy*5we*S40L$lg2?$?K3dqcK;)ZDy6~ZNr_VW)yK{o= zC7QD;hIQa%Ng!sSfgZHO!*fRN+9zqi;Z+N&4kNF`OsV+Si^}D{P6MA^IR548o5k-_ zvy}>oLrUBn6}g8C-NwB5M+B{pEjS~e!x#>B~dG2jmD{1Y#jHszx z#wUyMmk_{UrAw#RXozYEKi*K3gDm_D4OB=K?IbyE5R6l@!`~GGCDdt;HrF{n@)!0; zROmE@dM>sGt*o#kG(;SuA)jJbQWMor=iVhxO37(mA#Ue4KJ6_Le-O*V+-ObQqxxEv z#GeDpdHPO&*Nmq;;WnZdOF4()(@%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