mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Makes it possible for the AI to take and view images.
This commit is contained in:
@@ -1103,6 +1103,7 @@
|
||||
#include "code\modules\organs\organ_internal.dm"
|
||||
#include "code\modules\organs\pain.dm"
|
||||
#include "code\modules\organs\wound.dm"
|
||||
#include "code\modules\paperwork\ai_photography.dm"
|
||||
#include "code\modules\paperwork\carbonpaper.dm"
|
||||
#include "code\modules\paperwork\clipboard.dm"
|
||||
#include "code\modules\paperwork\filingcabinet.dm"
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
// BEGIN_INTERNALS
|
||||
/*
|
||||
MAP_ICON_TYPE: 0
|
||||
LAST_COMPILE_VERSION: 503.1224
|
||||
WINDOW: code\modules\paperwork\photography.dm;code\modules\mob\living\silicon\ai\ai.dm;code\_onclick\click.dm;code\_onclick\ai.dm;code\modules\mob\transform_procs.dm;code\game\objects\items\blueprints.dm;code\modules\paperwork\ai_photography.dm
|
||||
DIR: code code\_onclick code\game\gamemodes code\game\gamemodes\mutiny code\game\gamemodes\mutiny\directives code\game\objects code\game\objects\items code\modules code\modules\mob code\modules\mob\living code\modules\mob\living\silicon code\modules\mob\living\silicon\ai code\modules\paperwork code\WorkInProgress\AI_Visibility icons icons\mob icons\obj icons\obj\atmospherics sound sound\vox
|
||||
FILE: code\modules\paperwork\ai_photography.dm
|
||||
LAST_COMPILE_TIME: 1406556860
|
||||
AUTO_FILE_DIR: OFF
|
||||
*/
|
||||
// END_INTERNALS
|
||||
|
||||
@@ -53,6 +53,11 @@
|
||||
return
|
||||
next_move = world.time + 9
|
||||
|
||||
if(aicamera.in_camera_mode)
|
||||
aicamera.camera_mode_off()
|
||||
aicamera.captureimage(A, usr)
|
||||
return
|
||||
|
||||
/*
|
||||
AI restrained() currently does nothing
|
||||
if(restrained())
|
||||
|
||||
@@ -32,6 +32,7 @@ var/list/ai_list = list()
|
||||
var/obj/item/device/pda/ai/aiPDA = null
|
||||
var/obj/item/device/multitool/aiMulti = null
|
||||
var/obj/item/device/radio/headset/heads/ai_integrated/aiRadio = null
|
||||
var/obj/item/device/camera/ai_camera/aicamera = null
|
||||
var/custom_sprite = 0 //For our custom sprites
|
||||
//Hud stuff
|
||||
|
||||
@@ -92,6 +93,8 @@ var/list/ai_list = list()
|
||||
aiRadio = new(src)
|
||||
aiRadio.myAi = src
|
||||
|
||||
aicamera = new/obj/item/device/camera/ai_camera(src)
|
||||
|
||||
if (istype(loc, /turf))
|
||||
verbs.Add(/mob/living/silicon/ai/proc/ai_call_shuttle,/mob/living/silicon/ai/proc/ai_camera_track, \
|
||||
/mob/living/silicon/ai/proc/ai_camera_list, /mob/living/silicon/ai/proc/ai_network_change, \
|
||||
@@ -756,4 +759,4 @@ var/list/ai_list = list()
|
||||
|
||||
src << "Accessing Subspace Transceiver control..."
|
||||
if (src.aiRadio)
|
||||
src.aiRadio.interact(src)
|
||||
src.aiRadio.interact(src)
|
||||
|
||||
@@ -130,6 +130,8 @@
|
||||
O.verbs += /mob/living/silicon/ai/proc/ai_store_location
|
||||
O.verbs += /mob/living/silicon/ai/proc/ai_goto_location
|
||||
O.verbs += /mob/living/silicon/ai/proc/ai_remove_location
|
||||
O.verbs += /mob/living/silicon/ai/proc/ai_take_image
|
||||
O.verbs += /mob/living/silicon/ai/proc/ai_view_images
|
||||
|
||||
O.job = "AI"
|
||||
|
||||
|
||||
96
code/modules/paperwork/ai_photography.dm
Normal file
96
code/modules/paperwork/ai_photography.dm
Normal file
@@ -0,0 +1,96 @@
|
||||
/**************
|
||||
* AI-specific *
|
||||
**************/
|
||||
/datum/picture
|
||||
var/name = "image"
|
||||
var/list/fields = list()
|
||||
|
||||
obj/item/device/camera/ai_camera //camera AI can take pictures with
|
||||
name = "AI photo camera"
|
||||
var/in_camera_mode = 0
|
||||
var/list/aipictures = list()
|
||||
|
||||
/obj/item/device/camera/ai_camera/proc/injectaialbum(var/icon, var/img, var/desc, var/pixel_x, var/pixel_y) //stores image information to a list similar to that of the datacore
|
||||
var/numberer = 1
|
||||
for(var/datum/picture in src.aipictures)
|
||||
numberer++
|
||||
var/datum/picture/P = new()
|
||||
P.fields["name"] = "Image [numberer]"
|
||||
P.fields["icon"] = icon
|
||||
P.fields["img"] = img
|
||||
P.fields["desc"] = desc
|
||||
P.fields["pixel_x"] = pixel_x
|
||||
P.fields["pixel_y"] = pixel_y
|
||||
|
||||
aipictures += P
|
||||
usr << "<FONT COLOR=blue><B>Image recorded</B>"
|
||||
|
||||
/obj/item/device/camera/ai_camera/proc/viewpictures()
|
||||
var/list/nametemp = list()
|
||||
var/find
|
||||
var/datum/picture/selection
|
||||
if(src.aipictures.len == 0)
|
||||
usr << "<FONT COLOR=red><B>No images saved</B>"
|
||||
return
|
||||
for(var/datum/picture/t in src.aipictures)
|
||||
nametemp += t.fields["name"]
|
||||
find = input("Select image (numbered in order taken)") in nametemp
|
||||
var/obj/item/weapon/photo/P = new/obj/item/weapon/photo()
|
||||
for(var/datum/picture/q in src.aipictures)
|
||||
if(q.fields["name"] == find)
|
||||
selection = q
|
||||
break
|
||||
P.icon = selection.fields["icon"]
|
||||
P.img = selection.fields["img"]
|
||||
P.desc = selection.fields["desc"]
|
||||
P.pixel_x = selection.fields["pixel_x"]
|
||||
P.pixel_y = selection.fields["pixel_y"]
|
||||
|
||||
P.show(usr)
|
||||
usr << P.desc
|
||||
|
||||
// TG uses a special garbage collector.. qdel(P)
|
||||
del(P) //so 10 thousand pictures items are not left in memory should an AI take them and then view them all.
|
||||
|
||||
/obj/item/device/camera/ai_camera/printpicture(mob/user, icon/temp, mobs, flag)
|
||||
var/icon/small_img = icon(temp)
|
||||
var/icon/ic = icon('icons/obj/items.dmi',"photo")
|
||||
small_img.Scale(8, 8)
|
||||
ic.Blend(small_img,ICON_OVERLAY, 10, 13)
|
||||
var/icon = ic
|
||||
var/img = temp
|
||||
var/desc = mobs
|
||||
var/pixel_x = rand(-10, 10)
|
||||
var/pixel_y = rand(-10, 10)
|
||||
|
||||
injectaialbum(icon, img, desc, pixel_x, pixel_y)
|
||||
|
||||
/obj/item/device/camera/ai_camera/can_capture_turf(turf/T, mob/user)
|
||||
var/mob/living/silicon/ai = user
|
||||
return ai.TurfAdjacent(T)
|
||||
|
||||
/obj/item/device/camera/ai_camera/proc/toggle_camera_mode()
|
||||
if(in_camera_mode)
|
||||
camera_mode_off()
|
||||
else
|
||||
camera_mode_on()
|
||||
|
||||
/obj/item/device/camera/ai_camera/proc/camera_mode_off()
|
||||
src.in_camera_mode = 0
|
||||
usr << "<B>Camera Mode deactivated</B>"
|
||||
|
||||
/obj/item/device/camera/ai_camera/proc/camera_mode_on()
|
||||
src.in_camera_mode = 1
|
||||
usr << "<B>Camera Mode activated</B>"
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_take_image()
|
||||
set category = "AI Commands"
|
||||
set name = "Take Image"
|
||||
set desc = "Takes an image"
|
||||
aicamera.toggle_camera_mode()
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_view_images()
|
||||
set category = "AI Commands"
|
||||
set name = "View Images"
|
||||
set desc = "View images"
|
||||
aicamera.viewpictures()
|
||||
@@ -212,7 +212,31 @@
|
||||
|
||||
/obj/item/device/camera/afterattack(atom/target as mob|obj|turf|area, mob/user as mob, flag)
|
||||
if(!on || !pictures_left || ismob(target.loc)) return
|
||||
captureimage(target, user, flag)
|
||||
|
||||
playsound(loc, pick('sound/items/polaroid1.ogg', 'sound/items/polaroid2.ogg'), 75, 1, -3)
|
||||
|
||||
pictures_left--
|
||||
desc = "A polaroid camera. It has [pictures_left] photos left."
|
||||
user << "<span class='notice'>[pictures_left] photos left.</span>"
|
||||
icon_state = icon_off
|
||||
on = 0
|
||||
spawn(64)
|
||||
icon_state = icon_on
|
||||
on = 1
|
||||
|
||||
/obj/item/device/camera/proc/can_capture_turf(turf/T, mob/user)
|
||||
var/mob/dummy = new(T) //Go go visibility check dummy
|
||||
var/viewer = user
|
||||
if(user.client) //To make shooting through security cameras possible
|
||||
viewer = user.client.eye
|
||||
var/can_see = (dummy in viewers(world.view, viewer)) != null
|
||||
|
||||
dummy.loc = null
|
||||
dummy = null //Alas, nameless creature //garbage collect it instead
|
||||
return can_see
|
||||
|
||||
/obj/item/device/camera/proc/captureimage(atom/target, mob/user, flag)
|
||||
var/x_c = target.x - 1
|
||||
var/y_c = target.y + 1
|
||||
var/z_c = target.z
|
||||
@@ -223,21 +247,18 @@
|
||||
for(var/i = 1; i <= 3; i++)
|
||||
for(var/j = 1; j <= 3; j++)
|
||||
var/turf/T = locate(x_c, y_c, z_c)
|
||||
var/mob/dummy = new(T) //Go go visibility check dummy
|
||||
var/viewer = user
|
||||
if(user.client) //To make shooting through security cameras possible
|
||||
viewer = user.client.eye
|
||||
if(dummy in viewers(world.view, viewer))
|
||||
if(can_capture_turf(T, user))
|
||||
temp.Blend(get_icon(T), ICON_OVERLAY, 32 * (j-1-1), 32 - 32 * (i-1))
|
||||
mobs += get_mobs(T, user)
|
||||
else
|
||||
temp.Blend(black, ICON_OVERLAY, 32 * (j-1), 64 - 32 * (i-1))
|
||||
mobs += get_mobs(T)
|
||||
dummy.loc = null
|
||||
dummy = null //Alas, nameless creature //garbage collect it instead
|
||||
x_c++
|
||||
y_c--
|
||||
x_c = x_c - 3
|
||||
|
||||
printpicture(user, temp, mobs, flag)
|
||||
|
||||
/obj/item/device/camera/proc/printpicture(mob/user, icon/temp, mobs, flag)
|
||||
var/obj/item/weapon/photo/P = new/obj/item/weapon/photo()
|
||||
P.loc = user.loc
|
||||
if(!user.get_inactive_hand())
|
||||
@@ -256,13 +277,3 @@
|
||||
P.desc = mobs
|
||||
P.pixel_x = rand(-10, 10)
|
||||
P.pixel_y = rand(-10, 10)
|
||||
playsound(loc, pick('sound/items/polaroid1.ogg', 'sound/items/polaroid2.ogg'), 75, 1, -3)
|
||||
|
||||
pictures_left--
|
||||
desc = "A polaroid camera. It has [pictures_left] photos left."
|
||||
user << "<span class='notice'>[pictures_left] photos left.</span>"
|
||||
icon_state = icon_off
|
||||
on = 0
|
||||
spawn(64)
|
||||
icon_state = icon_on
|
||||
on = 1
|
||||
Reference in New Issue
Block a user