allows pAIs to place up to 5 holograms of things they have scanned (#6363)

This commit is contained in:
Timothy Teakettle
2024-03-30 18:07:36 +01:00
committed by GitHub
parent 30d91ed702
commit 08a3b660b7
9 changed files with 97 additions and 9 deletions
@@ -87,3 +87,21 @@
var/mob/living/silicon/pai/user = owner
button_visibility = (user.loc == user.card)
/// Hologram Placement
/datum/action/pai/place_hologram
name = "Place Hologram"
desc = "Place a hologram of a scanned object on the floor."
button_icon_state = "pai_place_hologram"
/datum/action/pai/place_hologram/on_trigger(mob/living/silicon/pai/user)
user.prompt_hologram_placement()
/// Delete All Holograms
/datum/action/pai/delete_holograms
name = "Delete All Holograms"
desc = "Delete all placed holograms."
button_icon_state = "pai_delete_holograms"
/datum/action/pai/delete_holograms/on_trigger(mob/living/silicon/pai/user)
user.delete_all_holograms()
@@ -1,4 +1,5 @@
/mob/living/silicon/pai/death(gibbed)
delete_all_holograms()
if(card)
card.removePersonality()
src.loc = get_turf(card)
@@ -0,0 +1,22 @@
/obj/effect/pai_hologram
name = "blank hologram"
desc = "You shouldn't be seeing this!"
hit_sound_brute = 'sound/weapons/egloves.ogg'
hit_sound_burn = 'sound/weapons/egloves.ogg'
var/mob/living/silicon/pai/owner
/obj/effect/pai_hologram/attackby(obj/item/W, mob/user)
hologram_destroy(user)
/obj/effect/pai_hologram/attack_hand(mob/user, list/params)
hologram_destroy(user)
/obj/effect/pai_hologram/proc/hologram_destroy(mob/user)
user.visible_message(SPAN_WARNING("[user] dissipates the holographic [src.name]"))
QDEL_NULL(src)
/obj/effect/pai_hologram/Destroy()
owner.handle_hologram_destroy(src)
. = ..()
+39 -2
View File
@@ -1,3 +1,5 @@
#define MAX_HOLOGRAMS 5
/datum/category_item/catalogue/fauna/silicon/pai
name = "Silicons - pAI"
desc = "There remains some dispute over whether the 'p' stands \
@@ -123,7 +125,11 @@
/datum/action/pai/change_chassis,
/datum/action/pai/clothing_transform,
/datum/action/pai/revert_to_card,
/datum/action/pai/hologram_display)
/datum/action/pai/hologram_display,
/datum/action/pai/place_hologram,
/datum/action/pai/delete_holograms)
var/list/active_holograms = list()
/mob/living/silicon/pai/Initialize(mapload)
. = ..()
@@ -325,7 +331,7 @@
return /obj/item/clothing/suit
/mob/living/silicon/pai/AltClickOn(var/atom/A)
if((isobj(A) || ismob(A)) && in_range_of(src, A) && !istype(A, /obj/item/paicard))
if((isobj(A) || ismob(A)) && in_range_of(src, A) && !istype(A, /obj/item/paicard) && !istype(A, /obj/effect/pai_hologram))
if(world.time > last_scanned_time + 600)
last_scanned_time = world.time
scan_object(A)
@@ -464,3 +470,34 @@
if(A.update_on_chassis_change)
A.update_button()
update_action_buttons()
/mob/living/silicon/pai/proc/handle_hologram_destroy(var/obj/effect/pai_hologram/hologram)
active_holograms -= hologram
/mob/living/silicon/pai/proc/place_hologram(var/scanned_object_name)
var/image/I = scanned_objects[scanned_object_name]
var/obj/effect/pai_hologram/hologram = new(get_turf(src))
hologram.icon = I
hologram.name = scanned_object_name
hologram.desc = "It's a holographic [scanned_object_name]."
hologram.owner = src
active_holograms += hologram
/mob/living/silicon/pai/proc/delete_all_holograms()
for(var/obj/effect/pai_hologram/hologram in active_holograms)
QDEL_NULL(hologram)
/mob/living/silicon/pai/proc/prompt_hologram_placement()
if(length(active_holograms) >= MAX_HOLOGRAMS)
to_chat(src, SPAN_NOTICE("You cannot have more than [MAX_HOLOGRAMS] holograms active!"))
return
var/scanned_item_to_show = tgui_input_list(usr, "Select Scanned Object", "Scanned Objects", scanned_objects)
if(scanned_item_to_show)
place_hologram(scanned_item_to_show)
/mob/living/silicon/pai/UnarmedAttack(var/atom/A, var/proximity_flag)
if(istype(A, /obj/effect/pai_hologram))
A.attack_hand(src)
#undef MAX_HOLOGRAMS
@@ -105,3 +105,17 @@
set desc = "Allows you to pick a scanned object to display from your holoprojector."
card_hologram_display()
/mob/living/silicon/pai/verb/hologram_place()
set name = "Place Hologram"
set category = "pAI Commands"
set desc = "Allows you to deploy a holographic version of something you have scanned."
prompt_hologram_placement()
/mob/living/silicon/pai/verb/delete_holograms()
set name = "Delete All Holograms"
set category = "pAI Commands"
set desc = "Allows you to delete all holograms you have placed."
delete_all_holograms()