mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 19:17:50 +01:00
Merge pull request #27 from tigercat2000/ai_eye_refactors
A handful of aiEye refactors
This commit is contained in:
@@ -87,11 +87,12 @@ var/list/ai_verbs_default = list(
|
||||
var/mob/living/simple_animal/bot/Bot
|
||||
var/turf/waypoint //Holds the turf of the currently selected waypoint.
|
||||
var/waypoint_mode = 0 //Waypoint mode is for selecting a turf via clicking.
|
||||
var/apc_override = FALSE //hack for letting the AI use its APC even when visionless
|
||||
var/nuking = 0
|
||||
var/obj/machinery/doomsday_device/doomsday_device
|
||||
|
||||
var/obj/machinery/hologram/holopad/holo = null
|
||||
var/mob/camera/aiEye/eyeobj = new()
|
||||
var/mob/camera/aiEye/eyeobj
|
||||
var/sprint = 10
|
||||
var/cooldown = 0
|
||||
var/acceleration = 1
|
||||
@@ -191,9 +192,7 @@ var/list/ai_verbs_default = list(
|
||||
spawn(5)
|
||||
new /obj/machinery/ai_powersupply(src)
|
||||
|
||||
eyeobj.ai = src
|
||||
eyeobj.name = "[src.name] (AI Eye)" // Give it a name
|
||||
eyeobj.loc = src.loc
|
||||
create_eye()
|
||||
|
||||
builtInCamera = new /obj/machinery/camera/portable(src)
|
||||
builtInCamera.c_tag = name
|
||||
@@ -1163,6 +1162,17 @@ var/list/ai_verbs_default = list(
|
||||
client.eye = eyeobj
|
||||
return TRUE
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/can_see(atom/A)
|
||||
if(isturf(loc)) //AI in core, check if on cameras
|
||||
//get_turf_pixel() is because APCs in maint aren't actually in view of the inner camera
|
||||
//apc_override is needed here because AIs use their own APC when depowered
|
||||
return (cameranet && cameranet.checkTurfVis(get_turf_pixel(A))) || apc_override
|
||||
//AI is carded/shunted
|
||||
//view(src) returns nothing for carded/shunted AIs and they have x-ray vision so just use get_dist
|
||||
var/list/viewscale = getviewsize(client.view)
|
||||
return get_dist(src, A) <= max(viewscale[1]*0.5,viewscale[2]*0.5)
|
||||
|
||||
/mob/living/silicon/ai/proc/relay_speech(mob/living/M, text, verb, datum/language/speaking)
|
||||
if(!say_understands(M, speaking))//The AI will be able to understand most mobs talking through the holopad.
|
||||
if(speaking)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
eye.visibleCameraChunks += src
|
||||
visible++
|
||||
seenby += eye
|
||||
if(changed && !updating)
|
||||
if(changed)
|
||||
update()
|
||||
|
||||
// Remove an AI eye from the chunk, then update if changed.
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
// It will also stream the chunk that the new loc is in.
|
||||
|
||||
/mob/camera/aiEye/setLoc(T)
|
||||
|
||||
if(ai)
|
||||
if(!isturf(ai.loc))
|
||||
return
|
||||
@@ -42,8 +41,22 @@
|
||||
return ai.client
|
||||
return null
|
||||
|
||||
|
||||
/mob/camera/aiEye/proc/RemoveImages()
|
||||
var/client/C = GetViewerClient()
|
||||
if(C)
|
||||
for(var/V in visibleCameraChunks)
|
||||
var/datum/camerachunk/chunk = V
|
||||
C.images -= chunk.obscured
|
||||
|
||||
|
||||
/mob/camera/aiEye/Destroy()
|
||||
ai = null
|
||||
if(ai)
|
||||
//ai.all_eyes -= src
|
||||
ai = null
|
||||
for(var/V in visibleCameraChunks)
|
||||
var/datum/camerachunk/chunk = V
|
||||
chunk.remove(src)
|
||||
return ..()
|
||||
|
||||
/atom/proc/move_camera_by_click()
|
||||
@@ -103,12 +116,18 @@
|
||||
src.eyeobj.loc = src.loc
|
||||
else
|
||||
to_chat(src, "ERROR: Eyeobj not found. Creating new eye...")
|
||||
src.eyeobj = new(src.loc)
|
||||
src.eyeobj.ai = src
|
||||
src.eyeobj.name = "[src.name] (AI Eye)" // Give it a name
|
||||
create_eye()
|
||||
|
||||
eyeobj.setLoc(loc)
|
||||
|
||||
/mob/living/silicon/ai/proc/create_eye()
|
||||
if(eyeobj)
|
||||
return
|
||||
eyeobj = new /mob/camera/aiEye()
|
||||
eyeobj.ai = src
|
||||
eyeobj.setLoc(loc)
|
||||
eyeobj.name = "[name] (AI Eye)"
|
||||
|
||||
/mob/living/silicon/ai/proc/toggle_acceleration()
|
||||
set category = "AI Commands"
|
||||
set name = "Toggle Camera Acceleration"
|
||||
|
||||
@@ -129,8 +129,10 @@
|
||||
to_chat(src, "Receiving control information from APC.")
|
||||
sleep(2)
|
||||
//bring up APC dialog
|
||||
aiRestorePowerRoutine = 3
|
||||
apc_override = 1
|
||||
theAPC.attack_ai(src)
|
||||
apc_override = 0
|
||||
aiRestorePowerRoutine = 3
|
||||
to_chat(src, "Here are your current laws:")
|
||||
src.show_laws() //WHY THE FUCK IS THIS HERE
|
||||
sleep(50)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
desc = "A computer used for remotely handling slimes."
|
||||
networks = list("SS13")
|
||||
circuit = /obj/item/circuitboard/xenobiology
|
||||
off_action = new /datum/action/innate/camera_off/xenobio
|
||||
var/datum/action/innate/slime_place/slime_place_action = new
|
||||
var/datum/action/innate/slime_pick_up/slime_up_action = new
|
||||
var/datum/action/innate/feed_slime/feed_slime_action = new
|
||||
@@ -43,23 +42,27 @@
|
||||
eyeobj.icon_state = "camera_target"
|
||||
|
||||
/obj/machinery/computer/camera_advanced/xenobio/GrantActions(mob/living/carbon/user)
|
||||
off_action.target = user
|
||||
off_action.Grant(user)
|
||||
..()
|
||||
if(slime_up_action)
|
||||
slime_up_action.target = src
|
||||
slime_up_action.Grant(user)
|
||||
actions += slime_up_action
|
||||
|
||||
if(slime_place_action)
|
||||
slime_place_action.target = src
|
||||
slime_place_action.Grant(user)
|
||||
actions += slime_place_action
|
||||
|
||||
if(feed_slime_action)
|
||||
feed_slime_action.target = src
|
||||
feed_slime_action.Grant(user)
|
||||
actions += feed_slime_action
|
||||
|
||||
if(monkey_recycle_action)
|
||||
monkey_recycle_action.target = src
|
||||
monkey_recycle_action.Grant(user)
|
||||
actions += monkey_recycle_action
|
||||
|
||||
jump_action.target = user
|
||||
jump_action.Grant(user)
|
||||
|
||||
slime_up_action.target = src
|
||||
slime_up_action.Grant(user)
|
||||
|
||||
slime_place_action.target = src
|
||||
slime_place_action.Grant(user)
|
||||
|
||||
feed_slime_action.target = src
|
||||
feed_slime_action.Grant(user)
|
||||
|
||||
monkey_recycle_action.target = src
|
||||
monkey_recycle_action.Grant(user)
|
||||
|
||||
|
||||
/obj/machinery/computer/camera_advanced/xenobio/attack_hand(mob/user)
|
||||
@@ -87,31 +90,6 @@
|
||||
return
|
||||
..()
|
||||
|
||||
/datum/action/innate/camera_off/xenobio/Activate()
|
||||
if(!target || !ishuman(target))
|
||||
return
|
||||
var/mob/living/carbon/C = target
|
||||
var/mob/camera/aiEye/remote/xenobio/remote_eye = C.remote_control
|
||||
var/obj/machinery/computer/camera_advanced/xenobio/origin = remote_eye.origin
|
||||
C.remote_view = 0
|
||||
origin.current_user = null
|
||||
origin.jump_action.Remove(C)
|
||||
origin.slime_place_action.Remove(C)
|
||||
origin.slime_up_action.Remove(C)
|
||||
origin.feed_slime_action.Remove(C)
|
||||
origin.monkey_recycle_action.Remove(C)
|
||||
//All of this stuff below could probably be a proc for all advanced cameras, only the action removal needs to be camera specific
|
||||
remote_eye.eye_user = null
|
||||
C.reset_perspective(null)
|
||||
if(C.client)
|
||||
C.client.images -= remote_eye.user_image
|
||||
for(var/datum/camerachunk/chunk in remote_eye.visibleCameraChunks)
|
||||
C.client.images -= chunk.obscured
|
||||
C.remote_control = null
|
||||
C.unset_machine()
|
||||
src.Remove(C)
|
||||
|
||||
|
||||
/datum/action/innate/slime_place
|
||||
name = "Place Slimes"
|
||||
button_icon_state = "slime_down"
|
||||
|
||||
Reference in New Issue
Block a user