Reworks pAIs (#68241)

A pretty heavy refactor for pAIs that just spilled into a rework.

Attempts to fully document and organize backend code.
Fixes a large number of bugs left untouched for a decade.
Breaks down the frontend into subcomponents.
Rebalances their software modules.
(should) fix pAI faces get removed if you activate them during alert #68242
This commit is contained in:
Jeremiah
2022-07-24 16:18:59 +01:00
committed by GitHub
parent c529eab0e0
commit 86e801987e
63 changed files with 2304 additions and 2067 deletions
@@ -8,24 +8,16 @@
name = "AI photo camera"
flash_enabled = FALSE
/obj/item/camera/siliconcam/proc/toggle_camera_mode(mob/user)
if(in_camera_mode)
camera_mode_off(user)
else
camera_mode_on(user)
/obj/item/camera/siliconcam/proc/camera_mode_off(mob/user)
in_camera_mode = FALSE
to_chat(user, "<span class='infoplain'><B>Camera Mode deactivated</B></span>")
/obj/item/camera/siliconcam/proc/camera_mode_on(mob/user)
in_camera_mode = TRUE
to_chat(user, "<span class='infoplain'><B>Camera Mode activated</B></span>")
/obj/item/camera/siliconcam/proc/toggle_camera_mode(mob/user, sound = TRUE)
in_camera_mode = !in_camera_mode
if(sound)
playsound(src, 'sound/items/wirecutter.ogg', 50, TRUE)
to_chat(user, span_notice("Camera mode: [in_camera_mode ? "Activated" : "Deactivated"]."))
/obj/item/camera/siliconcam/proc/selectpicture(mob/user)
var/list/nametemp = list()
if(!stored.len)
to_chat(usr, "<span class='infoplain'><font color=red><b>No images saved</b></font></span>")
if(!length(stored))
to_chat(usr, span_warning("No images saved"))
return
var/list/temp = list()
for(var/i in stored)
@@ -45,10 +37,10 @@
show_picture(user, selection)
/obj/item/camera/siliconcam/ai_camera/after_picture(mob/user, datum/picture/picture)
var/number = stored.len
var/number = length(stored)
picture.picture_name = "Image [number] (taken by [loc.name])"
stored[picture] = TRUE
to_chat(usr, "<span class='infoplain'>[span_unconscious("Image recorded")]</span>")
to_chat(user, span_notice("Image recorded."))
/obj/item/camera/siliconcam/robot_camera
name = "Cyborg photo camera"
@@ -60,12 +52,12 @@
var/number = C.connected_ai.aicamera.stored.len
picture.picture_name = "Image [number] (taken by [loc.name])"
C.connected_ai.aicamera.stored[picture] = TRUE
to_chat(usr, "<span class='infoplain'>[span_unconscious("Image recorded and saved to remote database")]</span>")
to_chat(usr, span_notice("Image recorded and saved to remote database."))
else
var/number = stored.len
picture.picture_name = "Image [number] (taken by [loc.name])"
stored[picture] = TRUE
to_chat(usr, "<span class='infoplain'>[span_unconscious("Image recorded and saved to local storage. Upload will happen automatically if unit is lawsynced.")]</span>")
to_chat(usr, span_notice("Image recorded and saved to local storage. Upload will happen automatically if unit is lawsynced."))
/obj/item/camera/siliconcam/robot_camera/selectpicture(mob/user)
var/mob/living/silicon/robot/R = loc
@@ -88,13 +80,4 @@
p.pixel_x = p.base_pixel_x + rand(-10, 10)
p.pixel_y = p.base_pixel_y + rand(-10, 10)
C.toner -= printcost //All fun allowed.
user.visible_message(span_notice("[C.name] spits out a photograph from a narrow slot on its chassis."),span_notice("You print a photograph."))
/obj/item/camera/siliconcam/proc/paiprint(mob/user)
var/mob/living/silicon/pai/paimob = loc
var/datum/picture/selection = selectpicture(user)
if(!istype(selection))
to_chat(user, span_warning("Invalid Image."))
return
printpicture(user,selection)
user.visible_message(span_notice("A picture appears on top of the chassis of [paimob.name]!"),span_notice("You print a photograph."))
user.visible_message(span_notice("[C.name] spits out a photograph from a narrow slot on its chassis."), span_notice("You print a photograph."))