Adds a "Toggle Sensors" verb to the robot/AI to set their HUD

This commit is contained in:
Markolie
2014-12-04 22:01:05 +01:00
parent dc8bda43df
commit 5b91100303
7 changed files with 97 additions and 11 deletions
@@ -478,9 +478,26 @@
var/mob/living/silicon/robot/R = M
switch(hudtype)
if("security")
return istype(R.module_state_1, /obj/item/borg/sight/hud/sec) || istype(R.module_state_2, /obj/item/borg/sight/hud/sec) || istype(R.module_state_3, /obj/item/borg/sight/hud/sec)
for(var/obj/I in R.contents)
if(istype(I, /obj/item/borg/sight/hud/sec))
return 1
if("medical")
return istype(R.module_state_1, /obj/item/borg/sight/hud/med) || istype(R.module_state_2, /obj/item/borg/sight/hud/med) || istype(R.module_state_3, /obj/item/borg/sight/hud/med)
for(var/obj/I in R.contents)
if(istype(I, /obj/item/borg/sight/hud/med))
return 1
else
return 0
else if(istype(M, /mob/living/silicon/ai))
var/mob/living/silicon/ai/A = M
switch(hudtype)
if("security")
for(var/obj/I in A.contents)
if(istype(I, /obj/item/borg/sight/hud/sec))
return 1
if("medical")
for(var/obj/I in A.contents)
if(istype(I, /obj/item/borg/sight/hud/med))
return 1
else
return 0
else
+29 -3
View File
@@ -58,6 +58,9 @@ var/list/ai_list = list()
var/obj/machinery/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/obj/item/borg/sight/hud/sec/sechud = null
var/obj/item/borg/sight/hud/med/healthhud = null
/mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0)
var/list/possibleNames = ai_names
@@ -99,11 +102,13 @@ var/list/ai_list = list()
aiRadio.myAi = src
aiCamera = new/obj/item/device/camera/siliconcam/ai_camera(src)
if (istype(loc, /turf))
verbs.Add(/mob/living/silicon/ai/proc/ai_network_change, \
/mob/living/silicon/ai/proc/ai_statuschange, /mob/living/silicon/ai/proc/ai_hologram_change, \
/mob/living/silicon/ai/proc/toggle_camera_light, /mob/living/silicon/ai/proc/botcall, /mob/living/silicon/ai/proc/control_integrated_radio)
/mob/living/silicon/ai/proc/toggle_camera_light, /mob/living/silicon/ai/proc/botcall, /mob/living/silicon/ai/proc/control_integrated_radio, /mob/living/silicon/ai/proc/control_hud)
if(!safety)//Only used by AIize() to successfully spawn an AI.
if (!B)//If there is no player/brain inside.
@@ -118,7 +123,7 @@ var/list/ai_list = list()
verbs.Remove(,/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, \
/mob/living/silicon/ai/proc/ai_statuschange, /mob/living/silicon/ai/proc/ai_hologram_change, \
/mob/living/silicon/ai/proc/toggle_camera_light,/mob/living/silicon/ai/verb/pick_icon)
/mob/living/silicon/ai/proc/toggle_camera_light,/mob/living/silicon/ai/verb/pick_icon,/mob/living/silicon/ai/proc/control_hud)
laws = new /datum/ai_laws/alienmov
else
B.brainmob.mind.transfer_to(src)
@@ -808,6 +813,10 @@ var/list/ai_list = list()
//Toggles the luminosity and applies it by re-entereing the camera.
/mob/living/silicon/ai/proc/toggle_camera_light()
set name = "Toggle Camera Lights"
set desc = "Toggles the lights on the cameras throughout the station."
set category = "AI Commands"
if(stat != CONSCIOUS)
return
@@ -820,8 +829,25 @@ var/list/ai_list = list()
else
lightNearbyCamera()
/mob/living/silicon/ai/proc/control_hud()
set name = "Toggle Sensors"
set desc = "Toggles your sensors to display security records, medical records or nothing."
set category = "AI Commands"
if(stat != 0)
return
var/hud = input("Please select a sensor module!", "Toggle Sensors", "None", null) in list("None","Security","Medical")
for(var/obj/item/borg/sight/hud/H in contents)
del(H)
switch(hud)
if("Security")
sechud = new/obj/item/borg/sight/hud/sec(src)
if("Medical")
healthhud = new/obj/item/borg/sight/hud/med(src)
else
return
// Handled camera lighting, when toggled.
// It will get the nearest camera from the eyeobj, lighting it.
+12 -1
View File
@@ -1,4 +1,7 @@
/mob/living/silicon/ai/Life()
if(client)
handle_regular_hud_updates()
if (src.stat == 2)
return
else //I'm not removing that shitton of tabs, unneeded as they are. -- Urist
@@ -9,7 +12,7 @@
src.cameraFollow = null
src.reset_view(null)
src.unset_machine()
src.updatehealth()
if (src.malfhack)
@@ -182,3 +185,11 @@
health = 100 - getOxyLoss() - getToxLoss() - getBruteLoss()
else
health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss()
/mob/living/silicon/ai/proc/handle_regular_hud_updates()
for(var/image/hud in client.images) //COPIED FROM the human handle_regular_hud_updates() proc
if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe
client.images.Remove(hud)
var/obj/item/borg/sight/hud/hud = (locate(/obj/item/borg/sight/hud) in src)
if(hud && hud.hud) hud.hud.process_hud(src)
@@ -73,6 +73,9 @@
var/base_icon = ""
var/crisis = 0
var/hiddenborg = 0
var/obj/item/borg/sight/hud/sec/sechud = null
var/obj/item/borg/sight/hud/med/healthhud = null
/mob/living/silicon/robot/New(loc,var/syndie = 0,var/unfinished = 0, var/alien = 0)
spark_system = new /datum/effect/effect/system/spark_spread()
@@ -456,6 +459,25 @@
else
C.toggled = 1
src << "\red You enable [C.name]."
/mob/living/silicon/robot/verb/control_hud()
set name = "Toggle Sensors"
set desc = "Toggles your sensors to display security records, medical records or nothing."
set category = "Robot Commands"
if(stat != 0)
return
var/hud = input("Please select a sensor module!", "Toggle Sensors", "None", null) in list("None","Security","Medical")
for(var/obj/item/borg/sight/hud/H in contents)
del(H)
switch(hud)
if("Security")
sechud = new/obj/item/borg/sight/hud/sec(src)
if("Medical")
healthhud = new/obj/item/borg/sight/hud/med(src)
else
return
/mob/living/silicon/robot/blob_act()
if (stat != 2)
@@ -120,7 +120,6 @@
New()
src.modules += new /obj/item/device/flashlight(src)
src.modules += new /obj/item/device/flash(src)
src.modules += new /obj/item/borg/sight/hud/med(src)
src.modules += new /obj/item/device/healthanalyzer(src)
src.modules += new /obj/item/device/reagent_scanner/adv(src)
src.modules += new /obj/item/roller_holder(src)
@@ -230,7 +229,6 @@
New()
src.modules += new /obj/item/device/flashlight/seclite(src)
src.modules += new /obj/item/device/flash(src)
src.modules += new /obj/item/borg/sight/hud/sec(src)
src.modules += new /obj/item/weapon/handcuffs/cyborg(src)
src.modules += new /obj/item/weapon/melee/baton/robot(src)
src.modules += new /obj/item/weapon/gun/energy/taser/cyborg(src)