[MIRROR] The AI's internal camera functions better (#2219)

* The AI's internal camera functions better

* sync robot.dm and hopefully not break shit
This commit is contained in:
CitadelStationBot
2017-08-05 12:24:58 -05:00
committed by kevinz000
parent f8371a4fbe
commit 90a7ead961
10 changed files with 60 additions and 77 deletions
+1 -3
View File
@@ -79,8 +79,6 @@
var/cooldown = 0
var/acceleration = 1
var/obj/machinery/camera/portable/builtInCamera
var/obj/structure/AIcore/deactivated/linked_core //For exosuit control
var/mob/living/silicon/robot/deployed_shell = null //For shell control
var/datum/action/innate/deploy_shell/deploy_action = new
@@ -151,7 +149,7 @@
GLOB.ai_list += src
GLOB.shuttle_caller_list += src
builtInCamera = new /obj/machinery/camera/portable(src)
builtInCamera = new (src)
builtInCamera.network = list("SS13")
@@ -22,8 +22,8 @@
locked = FALSE //unlock cover
update_canmove()
if(camera && camera.status)
camera.toggle_cam(src,0)
if(!QDELETED(builtInCamera) && builtInCamera.status)
builtInCamera.toggle_cam(src,0)
update_headlamp(1) //So borg lights are disabled when killed.
uneq_all() // particularly to ensure sight modes are cleared
+22 -26
View File
@@ -42,7 +42,6 @@
var/mob/living/silicon/ai/connected_ai = null
var/obj/item/weapon/stock_parts/cell/cell = null
var/obj/machinery/camera/camera = null
var/opened = 0
var/emagged = FALSE
@@ -76,7 +75,6 @@
var/lamp_recharging = 0 //Flag for if the lamp is on cooldown after being forcibly disabled.
var/sight_mode = 0
var/updating = 0 //portable camera camerachunk update
hud_possible = list(ANTAG_HUD, DIAG_STAT_HUD, DIAG_HUD, DIAG_BATT_HUD, DIAG_TRACK_HUD)
var/list/upgrades = list()
@@ -127,16 +125,16 @@
lawupdate = FALSE
radio = new /obj/item/device/radio/borg(src)
if(!scrambledcodes && !camera)
camera = new /obj/machinery/camera(src)
camera.c_tag = real_name
camera.network = list("SS13")
if(!scrambledcodes && !builtInCamera)
builtInCamera = new (src)
builtInCamera.c_tag = real_name
builtInCamera.network = list("SS13")
if(wires.is_cut(WIRE_CAMERA))
camera.status = 0
builtInCamera.status = 0
module = new /obj/item/weapon/robot_module(src)
module.rebuild_modules()
update_icons()
..()
. = ..()
//If this body is meant to be a borg controlled by the AI player
if(shell)
@@ -191,7 +189,6 @@
wires = null
module = null
eye_lights = null
camera = null
cell = null
return ..()
@@ -238,8 +235,8 @@
real_name = changed_name
name = real_name
if(camera)
camera.c_tag = real_name //update the camera name too
if(!QDELETED(builtInCamera))
builtInCamera.c_tag = real_name //update the camera name too
/mob/living/silicon/robot/proc/get_standard_name()
return "[(designation ? "[designation] " : "")][mmi.braintype]-[ident]"
@@ -676,9 +673,8 @@
canmove = 1
scrambledcodes = 1
//Disconnect it's camera so it's not so easily tracked.
if(src.camera)
qdel(src.camera)
src.camera = null
if(!QDELETED(builtInCamera))
QDEL_NULL(builtInCamera)
// I'm trying to get the Cyborg to not be listed in the camera list
// Instead of being listed as "deactivated". The downside is that I'm going
// to have to check if every camera is null or not before doing anything, to prevent runtime errors.
@@ -959,8 +955,8 @@
/mob/living/silicon/robot/revive(full_heal = 0, admin_revive = 0)
if(..()) //successfully ressuscitated from death
if(camera && !wires.is_cut(WIRE_CAMERA))
camera.toggle_cam(src,0)
if(!QDELETED(builtInCamera) && !wires.is_cut(WIRE_CAMERA))
builtInCamera.toggle_cam(src,0)
update_headlamp()
if(admin_revive)
locked = TRUE
@@ -971,8 +967,8 @@
..()
if(oldname != real_name)
notify_ai(RENAME, oldname, newname)
if(camera)
camera.c_tag = real_name
if(!QDELETED(builtInCamera))
builtInCamera.c_tag = real_name
custom_name = newname
@@ -1036,8 +1032,8 @@
name = "[designation] AI Shell [rand(100,999)]"
real_name = name
GLOB.available_ai_shells |= src
if(camera)
camera.c_tag = real_name //update the camera name too
if(!QDELETED(builtInCamera))
builtInCamera.c_tag = real_name //update the camera name too
diag_hud_set_aishell()
notify_ai(AI_SHELL)
@@ -1052,15 +1048,15 @@
GLOB.available_ai_shells -= src
name = "Unformatted Cyborg [rand(100,999)]"
real_name = name
if(camera)
camera.c_tag = real_name
if(!QDELETED(builtInCamera))
builtInCamera.c_tag = real_name
diag_hud_set_aishell()
/mob/living/silicon/robot/proc/deploy_init(var/mob/living/silicon/ai/AI)
real_name = "[AI.real_name] shell [rand(100, 999)] - [designation]" //Randomizing the name so it shows up separately in the shells list
name = real_name
if(camera)
camera.c_tag = real_name //update the camera name too
if(!QDELETED(builtInCamera))
builtInCamera.c_tag = real_name //update the camera name too
mainframe = AI
deployed = TRUE
connected_ai = mainframe
@@ -1105,8 +1101,8 @@
undeployment_action.Remove(src)
if(radio) //Return radio to normal
radio.recalculateChannels()
if(camera)
camera.c_tag = real_name //update the camera name too
if(!QDELETED(builtInCamera))
builtInCamera.c_tag = real_name //update the camera name too
diag_hud_set_aishell()
mainframe.diag_hud_set_deployed()
if(mainframe.laws)
@@ -1,24 +1,3 @@
/mob/living/silicon/robot/Moved(oldLoc, dir)
. = ..()
update_camera_location(oldLoc)
/mob/living/silicon/robot/forceMove(atom/destination)
. = ..()
update_camera_location(destination)
/mob/living/silicon/robot/proc/do_camera_update(oldLoc)
if(!QDELETED(camera) && oldLoc != get_turf(src))
GLOB.cameranet.updatePortableCamera(camera)
updating = FALSE
#define BORG_CAMERA_BUFFER 30
/mob/living/silicon/robot/proc/update_camera_location(oldLoc)
oldLoc = get_turf(oldLoc)
if(!QDELETED(camera) && !updating && oldLoc != get_turf(src))
updating = TRUE
addtimer(CALLBACK(src, .proc/do_camera_update, oldLoc), BORG_CAMERA_BUFFER)
#undef BORG_CAMERA_BUFFER
/mob/living/silicon/robot/Process_Spacemove(movement_dir = 0)
if(ionpulse())
return 1
@@ -36,6 +36,8 @@
var/d_hud = DATA_HUD_DIAGNOSTIC //There is only one kind of diag hud
var/law_change_counter = 0
var/obj/machinery/camera/builtInCamera = null
var/updating = FALSE //portable camera camerachunk update
/mob/living/silicon/Initialize()
. = ..()
@@ -54,6 +56,7 @@
/mob/living/silicon/Destroy()
radio = null
aicamera = null
QDEL_NULL(builtInCamera)
GLOB.silicon_mobs -= src
return ..()
@@ -0,0 +1,20 @@
/mob/living/silicon/Moved(oldLoc, dir)
. = ..()
update_camera_location(oldLoc)
/mob/living/silicon/forceMove(atom/destination)
. = ..()
update_camera_location(destination)
/mob/living/silicon/proc/do_camera_update(oldLoc)
if(!QDELETED(builtInCamera) && oldLoc != get_turf(src))
GLOB.cameranet.updatePortableCamera(builtInCamera)
updating = FALSE
#define SILICON_CAMERA_BUFFER 10
/mob/living/silicon/proc/update_camera_location(oldLoc)
oldLoc = get_turf(oldLoc)
if(!QDELETED(builtInCamera) && !updating && oldLoc != get_turf(src))
updating = TRUE
addtimer(CALLBACK(src, .proc/do_camera_update, oldLoc), SILICON_CAMERA_BUFFER)
#undef SILICON_CAMERA_BUFFER