mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-29 06:56:23 +01:00
General update.
NanoUI interface sorted. Accessible by AI, borgs, and through consoles. Automatic alarm resets in case of lost sources.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#define ALARM_RESET_DELAY 100 // How long will the alarm/trigger remain active once origin/source has been found to be gone?
|
||||
|
||||
/datum/alarm_source
|
||||
var/source = null // The source trigger
|
||||
var/source_name = "" // The name of the source should it be lost (for example a destroyed camera)
|
||||
@@ -7,8 +9,8 @@
|
||||
|
||||
/datum/alarm_source/New(var/atom/source)
|
||||
src.source = source
|
||||
source_name = source.name
|
||||
start_time = world.time
|
||||
source_name = source.get_source_name()
|
||||
|
||||
/datum/alarm
|
||||
var/atom/origin //Used to identify the alarm area.
|
||||
@@ -16,24 +18,42 @@
|
||||
var/list/sources_assoc = new() //Associative list of source triggers. Used to efficiently acquire the alarm source.
|
||||
var/list/cameras //List of cameras that can be switched to, if the player has that capability.
|
||||
var/area/last_area //The last acquired area, used should origin be lost (for example a destroyed borg containing an alarming camera).
|
||||
var/area/last_name //The last acquired name, used should origin be lost
|
||||
var/area/last_camera_area //The last area in which cameras where fetched, used to see if the camera list should be updated.
|
||||
var/end_time //Used to set when this alarm should clear, in case the origin is lost.
|
||||
|
||||
/datum/alarm/New(var/atom/origin, var/atom/source, var/duration)
|
||||
src.origin = origin
|
||||
last_area = alarm_area()
|
||||
|
||||
cameras() // Sets up both cameras and last alarm area.
|
||||
set_duration(source, duration)
|
||||
|
||||
/datum/alarm/proc/process()
|
||||
// Has origin gone missing?
|
||||
if(!origin && !end_time)
|
||||
end_time = world.time + ALARM_RESET_DELAY
|
||||
for(var/datum/alarm_source/AS in sources)
|
||||
// Has the alarm passed its best before date?
|
||||
if((AS.end_time && world.time > AS.end_time) || (AS.duration && world.time > (AS.start_time + AS.duration)))
|
||||
sources -= AS
|
||||
// Has the source gone missing? Then reset the normal duration and set end_time
|
||||
if(!AS.source && !AS.end_time) // end_time is used instead of duration to ensure the reset doesn't remain in the future indefinetely.
|
||||
AS.duration = 0
|
||||
AS.end_time = world.time + ALARM_RESET_DELAY
|
||||
|
||||
/datum/alarm/proc/set_duration(var/atom/source, var/duration)
|
||||
var/datum/alarm_source/AS = sources[source]
|
||||
var/datum/alarm_source/AS = sources_assoc[source]
|
||||
if(!AS)
|
||||
AS = new/datum/alarm_source(source)
|
||||
sources += AS
|
||||
sources_assoc[source] = AS
|
||||
// Currently only non-0 durations can be altered (normal alarms VS EMP blasts)
|
||||
if(AS.duration)
|
||||
duration = SecondsToTicks(duration)
|
||||
AS.duration = duration
|
||||
|
||||
/datum/alarm/proc/clear(var/source)
|
||||
var/datum/alarm_source/AS = sources[source]
|
||||
var/datum/alarm_source/AS = sources_assoc[source]
|
||||
sources -= AS
|
||||
sources_assoc -= source
|
||||
|
||||
@@ -44,22 +64,51 @@
|
||||
last_area = origin.get_alarm_area()
|
||||
return last_area
|
||||
|
||||
/datum/alarm/proc/cameras()
|
||||
/datum/alarm/proc/alarm_name()
|
||||
if(!origin)
|
||||
return list()
|
||||
return last_name
|
||||
|
||||
last_name = origin.get_alarm_name()
|
||||
return last_name
|
||||
|
||||
/datum/alarm/proc/cameras()
|
||||
// If the alarm origin has changed area, for example a borg containing an alarming camera, reset the list of cameras
|
||||
if(cameras && (last_camera_area != alarm_area()))
|
||||
cameras = null
|
||||
|
||||
// The list of cameras is also reset by /proc/invalidateCameraCache()
|
||||
if(!cameras)
|
||||
cameras = origin.get_alarm_cameras()
|
||||
cameras = origin ? origin.get_alarm_cameras() : last_area.get_alarm_cameras()
|
||||
|
||||
last_camera_area = last_area
|
||||
return cameras
|
||||
|
||||
|
||||
/******************
|
||||
* Assisting procs *
|
||||
******************/
|
||||
/atom/proc/get_alarm_area()
|
||||
return get_area(src)
|
||||
|
||||
/area/get_alarm_area()
|
||||
return src
|
||||
|
||||
/atom/proc/get_alarm_name()
|
||||
var/area/A = get_area(src)
|
||||
return A.name
|
||||
|
||||
/area/get_alarm_name()
|
||||
return name
|
||||
|
||||
/mob/get_alarm_name()
|
||||
return name
|
||||
|
||||
/atom/proc/get_source_name()
|
||||
return name
|
||||
|
||||
/obj/machinery/camera/get_source_name()
|
||||
return c_tag
|
||||
|
||||
/atom/proc/get_alarm_cameras()
|
||||
var/area/A = get_area(src)
|
||||
return A.get_cameras()
|
||||
@@ -76,3 +125,5 @@
|
||||
|
||||
/mob/living/silicon/robot/syndicate/get_alarm_cameras()
|
||||
return list()
|
||||
|
||||
#undef ALARM_LOSS_DELAY
|
||||
|
||||
@@ -1,64 +1,82 @@
|
||||
#define ALARM_ORIGIN_LOST "Origin Lost"
|
||||
#define ALARM_RAISED 1
|
||||
#define ALARM_CLEARED 0
|
||||
|
||||
/datum/alarm_handler
|
||||
var/category = ""
|
||||
var/list/datum/alarm/alarms = new // All alarms, to handle cases when origin has been deleted with one or more active alarms
|
||||
var/list/datum/alarm/alarms_assoc = new // Associative list of alarms, to efficiently acquire them based on origin.
|
||||
var/list/datum/alarm/alarms = new // All alarms, to handle cases when an origin has been deleted with one or more active alarms
|
||||
var/list/datum/alarm/alarms_assoc = new // Associative list of alarms, to efficiently acquire them based on origin.
|
||||
var/list/listeners = new // A list of all objects interested in alarm changes.
|
||||
|
||||
/datum/alarm_handler/proc/process()
|
||||
/*
|
||||
for(var/datum/alarm/A in alarms)
|
||||
var/datum/alarm_source/AS = A.source
|
||||
// Alarm owner has been deleted. Clean up in at most 15 seconds
|
||||
if(!AS.owner && !AS.end_time)
|
||||
AS.end_time = world.time + SecondsToTicks(15)
|
||||
if(AS.duration || AS.end_time)
|
||||
if(world.time > (AS.start_time + AS.duration) || world.time > AS.end_time)
|
||||
//Somethingthing..
|
||||
*/
|
||||
A.process()
|
||||
check_alarm_cleared(A)
|
||||
|
||||
/datum/alarm_handler/proc/triggerAlarm(var/atom/origin, var/atom/source, var/duration = 0)
|
||||
var/new_alarm
|
||||
//Proper origin and source mandatory
|
||||
if(!origin || !source)
|
||||
return
|
||||
|
||||
new_alarm = 0
|
||||
//see if there is already an alarm of this origin
|
||||
var/alarm_key = origin.get_alarm_key()
|
||||
var/datum/alarm/existing = alarms_assoc[alarm_key]
|
||||
var/datum/alarm/existing = alarms_assoc[origin]
|
||||
if(existing)
|
||||
existing.set_duration(source, duration)
|
||||
else
|
||||
existing = new/datum/alarm(origin, source, duration)
|
||||
new_alarm = 1
|
||||
|
||||
alarms |= existing
|
||||
alarms_assoc[alarm_key] = existing
|
||||
alarms_assoc[origin] = existing
|
||||
if(new_alarm)
|
||||
alarms = dd_sortedObjectList(alarms)
|
||||
notify_listeners(existing, ALARM_RAISED)
|
||||
|
||||
/datum/alarm_handler/proc/cancelAlarm(var/atom/origin, var/source)
|
||||
return new_alarm
|
||||
|
||||
/datum/alarm_handler/proc/clearAlarm(var/atom/origin, var/source)
|
||||
//Proper origin and source mandatory
|
||||
if(!origin || !source)
|
||||
return
|
||||
|
||||
var/alarm_key = origin.get_alarm_key()
|
||||
|
||||
var/datum/alarm/existing = alarms_assoc[alarm_key]
|
||||
var/datum/alarm/existing = alarms_assoc[origin]
|
||||
if(existing)
|
||||
existing.clear(source)
|
||||
if (!existing.sources.len)
|
||||
alarms -= existing
|
||||
alarms_assoc -= alarm_key
|
||||
return check_alarm_cleared(existing)
|
||||
|
||||
/atom/proc/get_alarm_key()
|
||||
return src
|
||||
/datum/alarm_handler/proc/check_alarm_cleared(var/datum/alarm/alarm)
|
||||
if ((alarm.end_time && world.time > alarm.end_time) || !alarm.sources.len)
|
||||
alarms -= alarm
|
||||
alarms_assoc -= alarm.origin
|
||||
notify_listeners(alarm, ALARM_CLEARED)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/turf/get_alarm_key()
|
||||
return get_area(src)
|
||||
/datum/alarm_handler/proc/register(var/object, var/procName)
|
||||
listeners[object] = procName
|
||||
|
||||
/datum/alarm_handler/proc/unregister(var/object)
|
||||
listeners -= object
|
||||
|
||||
/datum/alarm_handler/proc/notify_listeners(var/alarm, var/was_raised)
|
||||
for(var/listener in listeners)
|
||||
call(listener, listeners[listener])(src, alarm, was_raised)
|
||||
|
||||
/********
|
||||
* DEBUG *
|
||||
********/
|
||||
/obj/item/device/alarm_debug
|
||||
name = "An alarm debug tool - Self"
|
||||
desc = "Alarm Up. Alarm Reset."
|
||||
icon = 'icons/obj/radio.dmi'
|
||||
icon_state = "beacon"
|
||||
item_state = "signaler"
|
||||
var/obj/nano_module/alarm_monitor/ai/alarm_monitor
|
||||
|
||||
/obj/item/device/alarm_debug/New()
|
||||
..()
|
||||
alarm_monitor = new(src)
|
||||
|
||||
/obj/item/device/alarm_debug/loc
|
||||
name = "An alarm debug tool - Loc"
|
||||
@@ -67,46 +85,33 @@
|
||||
set name = "Alarm"
|
||||
set category = "Debug"
|
||||
usr << "Raising alarm"
|
||||
camera_alarm.triggerAlarm(src, src)
|
||||
fire_alarm.triggerAlarm(src, src)
|
||||
|
||||
/obj/item/device/alarm_debug/verb/reset()
|
||||
set name = "Reset"
|
||||
set category = "Debug"
|
||||
usr << "Raising alarm"
|
||||
camera_alarm.triggerAlarm(src, src)
|
||||
|
||||
/obj/item/device/alarm_debug/verb/tell_me()
|
||||
set name = "Tell"
|
||||
set category = "Debug"
|
||||
usr << "Telling about alarms"
|
||||
|
||||
var/list/datum/alarm/alarms = camera_alarm.alarms
|
||||
var/list/datum/alarm/alarms_assoc = camera_alarm.alarms_assoc
|
||||
|
||||
world << "List"
|
||||
for(var/datum/alarm/A in alarms)
|
||||
world << "Origin: [A.origin ? A.origin : ALARM_ORIGIN_LOST]"
|
||||
world << "Alarm area: [A.alarm_area()]"
|
||||
for(var/source in A.sources)
|
||||
world << "Source: [source]"
|
||||
|
||||
world << "Assoc"
|
||||
|
||||
for(var/atom/origin in alarms_assoc)
|
||||
world << "Origin: [origin ? origin : ALARM_ORIGIN_LOST]"
|
||||
var/datum/alarm/A = alarms_assoc[origin]
|
||||
world << "Alarm area: [A.alarm_area()]"
|
||||
for(var/source in A.sources)
|
||||
world << "Source: [source]"
|
||||
usr << "Clearing alarm"
|
||||
fire_alarm.clearAlarm(src, src)
|
||||
|
||||
/obj/item/device/alarm_debug/loc/alarm()
|
||||
set name = "Alarm"
|
||||
set category = "Debug"
|
||||
usr << "Raising alarm"
|
||||
camera_alarm.triggerAlarm(src.loc, src)
|
||||
fire_alarm.triggerAlarm(src.loc, src)
|
||||
|
||||
/obj/item/device/alarm_debug/loc/reset()
|
||||
set name = "Reset"
|
||||
set category = "Debug"
|
||||
usr << "Clearing alarm"
|
||||
camera_alarm.cancelAlarm(src.loc, src)
|
||||
fire_alarm.clearAlarm(src.loc, src)
|
||||
|
||||
/obj/item/device/alarm_debug/verb/nano()
|
||||
set name = "Nano"
|
||||
set category = "Debug"
|
||||
alarm_monitor.ui_interact(usr)
|
||||
|
||||
/obj/item/device/alarm_debug/attack_self(var/mob/user)
|
||||
alarm_monitor.ui_interact(user)
|
||||
|
||||
#undef ALARM_RAISED
|
||||
#undef ALARM_CLEARED
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/datum/alarm_handler/fire_alarm
|
||||
/datum/alarm_handler/fire
|
||||
category = "Fire"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
var/list/ai_list = list()
|
||||
var/list/ai_verbs_default = list(
|
||||
/mob/living/silicon/ai/proc/ai_alerts,
|
||||
/mob/living/silicon/ai/proc/ai_announcement,
|
||||
/mob/living/silicon/ai/proc/ai_call_shuttle,
|
||||
// /mob/living/silicon/ai/proc/ai_recall_shuttle,
|
||||
@@ -23,10 +22,7 @@ var/list/ai_verbs_default = list(
|
||||
/mob/living/silicon/ai/proc/sensor_mode,
|
||||
/mob/living/silicon/ai/proc/show_laws_verb,
|
||||
/mob/living/silicon/ai/proc/toggle_acceleration,
|
||||
/mob/living/silicon/ai/proc/toggle_camera_light,
|
||||
/mob/living/silicon/ai/proc/nano_rcon,
|
||||
/mob/living/silicon/ai/proc/nano_crew_monitor,
|
||||
/mob/living/silicon/ai/proc/nano_power_monitor
|
||||
/mob/living/silicon/ai/proc/toggle_camera_light
|
||||
)
|
||||
|
||||
//Not sure why this is necessary...
|
||||
@@ -83,9 +79,11 @@ var/list/ai_verbs_default = list(
|
||||
|
||||
/mob/living/silicon/ai/proc/add_ai_verbs()
|
||||
src.verbs |= ai_verbs_default
|
||||
src.verbs |= ai_verbs_subsystems
|
||||
|
||||
/mob/living/silicon/ai/proc/remove_ai_verbs()
|
||||
src.verbs -= ai_verbs_default
|
||||
src.verbs -= ai_verbs_subsystems
|
||||
|
||||
/mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0)
|
||||
announcement = new()
|
||||
@@ -166,8 +164,6 @@ var/list/ai_verbs_default = list(
|
||||
hud_list[IMPTRACK_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[SPECIALROLE_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
|
||||
init_subsystems()
|
||||
|
||||
ai_list += src
|
||||
..()
|
||||
return
|
||||
@@ -325,13 +321,6 @@ var/list/ai_verbs_default = list(
|
||||
if(malf && malf.apcs >= 3)
|
||||
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/(malf.apcs/3), 0)] seconds")
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_alerts()
|
||||
set category = "AI Commands"
|
||||
set name = "Show Alerts"
|
||||
|
||||
//PsiFix
|
||||
//nano_alarm.ui_interact(usr)
|
||||
|
||||
// this verb lets the ai see the stations manifest
|
||||
/mob/living/silicon/ai/proc/ai_roster()
|
||||
set category = "AI Commands"
|
||||
@@ -428,7 +417,7 @@ var/list/ai_verbs_default = list(
|
||||
if (href_list["switchcamera"])
|
||||
switchCamera(locate(href_list["switchcamera"])) in cameranet.cameras
|
||||
if (href_list["showalerts"])
|
||||
ai_alerts()
|
||||
subsystem_alarm_monitor()
|
||||
//Carn: holopad requests
|
||||
if (href_list["jumptoholopad"])
|
||||
var/obj/machinery/hologram/holopad/H = locate(href_list["jumptoholopad"])
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
var/obj/nano_module/crew_monitor/crew_monitor
|
||||
var/obj/nano_module/rcon/rcon
|
||||
var/obj/nano_module/power_monitor/power_monitor
|
||||
|
||||
/mob/living/silicon/ai/proc/init_subsystems()
|
||||
crew_monitor = new(src)
|
||||
rcon = new(src)
|
||||
power_monitor = new(src)
|
||||
|
||||
/mob/living/silicon/ai/proc/nano_crew_monitor()
|
||||
set category = "AI Subystems"
|
||||
set name = "Crew Monitor"
|
||||
|
||||
crew_monitor.ui_interact(usr)
|
||||
|
||||
/mob/living/silicon/ai/proc/nano_power_monitor()
|
||||
set category = "AI Subystems"
|
||||
set name = "Power Monitor"
|
||||
|
||||
power_monitor.ui_interact(usr)
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/nano_rcon()
|
||||
set category = "AI Subystems"
|
||||
set name = "RCON"
|
||||
|
||||
rcon.ui_interact(usr)
|
||||
@@ -0,0 +1,44 @@
|
||||
var/list/ai_verbs_subsystems = list(
|
||||
/mob/living/silicon/ai/proc/subsystem_alarm_monitor,
|
||||
/mob/living/silicon/ai/proc/subsystem_crew_monitor,
|
||||
/mob/living/silicon/ai/proc/subsystem_power_monitor,
|
||||
/mob/living/silicon/ai/proc/subsystem_rcon
|
||||
)
|
||||
|
||||
/mob/living/silicon/ai
|
||||
var/
|
||||
var/obj/nano_module/crew_monitor/crew_monitor
|
||||
var/obj/nano_module/rcon/rcon
|
||||
var/obj/nano_module/power_monitor/power_monitor
|
||||
|
||||
/mob/living/silicon/ai/init_subsystems()
|
||||
..()
|
||||
del(alarm_monitor)
|
||||
alarm_monitor = new/obj/nano_module/alarm_monitor/ai(src)
|
||||
crew_monitor = new(src)
|
||||
rcon = new(src)
|
||||
power_monitor = new(src)
|
||||
|
||||
/mob/living/silicon/ai/proc/subsystem_alarm_monitor()
|
||||
set name = "Alarm Monitor"
|
||||
set category = "AI Subystems"
|
||||
|
||||
alarm_monitor.ui_interact(usr)
|
||||
|
||||
/mob/living/silicon/ai/proc/subsystem_crew_monitor()
|
||||
set category = "AI Subystems"
|
||||
set name = "Crew Monitor"
|
||||
|
||||
crew_monitor.ui_interact(usr)
|
||||
|
||||
/mob/living/silicon/ai/proc/subsystem_power_monitor()
|
||||
set category = "AI Subystems"
|
||||
set name = "Power Monitor"
|
||||
|
||||
power_monitor.ui_interact(usr)
|
||||
|
||||
/mob/living/silicon/ai/proc/subsystem_rcon()
|
||||
set category = "AI Subystems"
|
||||
set name = "RCON"
|
||||
|
||||
rcon.ui_interact(usr)
|
||||
@@ -437,22 +437,12 @@ var/list/robot_verbs_default = list(
|
||||
updatename()
|
||||
updateicon()
|
||||
|
||||
/mob/living/silicon/robot/verb/cmd_robot_alerts()
|
||||
set category = "Robot Commands"
|
||||
set name = "Show Alerts"
|
||||
robot_alerts()
|
||||
|
||||
// this verb lets cyborgs see the stations manifest
|
||||
/mob/living/silicon/robot/verb/cmd_station_manifest()
|
||||
set category = "Robot Commands"
|
||||
set name = "Show Crew Manifest"
|
||||
show_station_manifest()
|
||||
|
||||
|
||||
/mob/living/silicon/robot/proc/robot_alerts()
|
||||
//PsiFix
|
||||
//nano_alarm.ui_interact(usr)
|
||||
|
||||
/mob/living/silicon/robot/proc/self_diagnosis()
|
||||
if(!is_component_functioning("diagnosis unit"))
|
||||
return null
|
||||
@@ -1004,30 +994,31 @@ var/list/robot_verbs_default = list(
|
||||
|
||||
/mob/living/silicon/robot/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
return 1
|
||||
if(usr != src)
|
||||
return
|
||||
return 1
|
||||
|
||||
if (href_list["showalerts"])
|
||||
robot_alerts()
|
||||
return
|
||||
subsystem_alarm_monitor()
|
||||
return 1
|
||||
|
||||
if (href_list["mod"])
|
||||
var/obj/item/O = locate(href_list["mod"])
|
||||
if (istype(O) && (O.loc == src))
|
||||
O.attack_self(src)
|
||||
return 1
|
||||
|
||||
if (href_list["act"])
|
||||
var/obj/item/O = locate(href_list["act"])
|
||||
if (!istype(O))
|
||||
return
|
||||
return 1
|
||||
|
||||
if(!((O in src.module.modules) || (O == src.module.emag)))
|
||||
return
|
||||
return 1
|
||||
|
||||
if(activated(O))
|
||||
src << "Already activated"
|
||||
return
|
||||
return 1
|
||||
if(!module_state_1)
|
||||
module_state_1 = O
|
||||
O.layer = 20
|
||||
@@ -1049,6 +1040,7 @@ var/list/robot_verbs_default = list(
|
||||
else
|
||||
src << "You need to disable a module first!"
|
||||
installed_modules()
|
||||
return 1
|
||||
|
||||
if (href_list["deact"])
|
||||
var/obj/item/O = locate(href_list["deact"])
|
||||
@@ -1067,6 +1059,7 @@ var/list/robot_verbs_default = list(
|
||||
else
|
||||
src << "Module isn't activated"
|
||||
installed_modules()
|
||||
return 1
|
||||
|
||||
if (href_list["lawc"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawc"])
|
||||
@@ -1075,6 +1068,7 @@ var/list/robot_verbs_default = list(
|
||||
if ("No") lawcheck[L+1] = "Yes"
|
||||
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
||||
checklaws()
|
||||
return 1
|
||||
|
||||
if (href_list["lawi"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawi"])
|
||||
@@ -1083,9 +1077,11 @@ var/list/robot_verbs_default = list(
|
||||
if ("No") ioncheck[L] = "Yes"
|
||||
// src << text ("Switching Law [L]'s report status to []", lawcheck[L+1])
|
||||
checklaws()
|
||||
return 1
|
||||
|
||||
if (href_list["laws"]) // With how my law selection code works, I changed statelaws from a verb to a proc, and call it through my law selection panel. --NeoFite
|
||||
statelaws()
|
||||
return 1
|
||||
return
|
||||
|
||||
/mob/living/silicon/robot/proc/radio_menu()
|
||||
@@ -1218,9 +1214,11 @@ var/list/robot_verbs_default = list(
|
||||
|
||||
/mob/living/silicon/robot/proc/add_robot_verbs()
|
||||
src.verbs |= robot_verbs_default
|
||||
src.verbs |= robot_verbs_subsystems
|
||||
|
||||
/mob/living/silicon/robot/proc/remove_robot_verbs()
|
||||
src.verbs -= robot_verbs_default
|
||||
src.verbs -= robot_verbs_subsystems
|
||||
|
||||
// Uses power from cyborg's cell. Returns 1 on success or 0 on failure.
|
||||
// Properly converts using CELLRATE now! Amount is in Joules.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
var/list/robot_verbs_subsystems = list(
|
||||
/mob/living/silicon/robot/proc/subsystem_alarm_monitor
|
||||
)
|
||||
|
||||
/mob/living/silicon/robot/proc/subsystem_alarm_monitor()
|
||||
set name = "Alarm Monitor"
|
||||
set category = "Robot Subystems"
|
||||
|
||||
alarm_monitor.ui_interact(usr)
|
||||
@@ -22,6 +22,9 @@
|
||||
var/obj/item/device/camera/siliconcam/aiCamera = null //photography
|
||||
var/local_transmit //If set, can only speak to others of the same type within a short range.
|
||||
|
||||
// Subsystems
|
||||
var/obj/nano_module/alarm_monitor = null
|
||||
|
||||
var/sensor_mode = 0 //Determines the current HUD.
|
||||
|
||||
#define SEC_HUD 1 //Security HUD mode
|
||||
@@ -30,6 +33,7 @@
|
||||
/mob/living/silicon/New()
|
||||
..()
|
||||
add_language("Galactic Common")
|
||||
init_subsystems()
|
||||
|
||||
/mob/living/silicon/proc/SetName(pickedName as text)
|
||||
real_name = pickedName
|
||||
@@ -244,7 +248,8 @@
|
||||
return 1
|
||||
|
||||
/mob/living/silicon/Topic(href, href_list)
|
||||
..()
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if (href_list["lawr"]) // Selects on which channel to state laws
|
||||
var/list/channels = list(MAIN_CHANNEL)
|
||||
@@ -283,3 +288,6 @@
|
||||
adjustBruteLoss(30)
|
||||
|
||||
updatehealth()
|
||||
|
||||
/mob/living/silicon/proc/init_subsystems()
|
||||
alarm_monitor = new/obj/nano_module/alarm_monitor/borg(src)
|
||||
|
||||
+16
-18
@@ -792,27 +792,25 @@ note dizziness decrements automatically in the mob's Life() proc.
|
||||
/mob/Stat()
|
||||
..()
|
||||
|
||||
if(statpanel("MC")) //not looking at that panel
|
||||
|
||||
if(client && client.holder)
|
||||
if(client && client.holder)
|
||||
if(statpanel("Status"))
|
||||
stat(null,"Location:\t([x], [y], [z])")
|
||||
stat(null,"CPU:\t[world.cpu]")
|
||||
stat(null,"Instances:\t[world.contents.len]")
|
||||
|
||||
if(master_controller)
|
||||
stat(null,"MasterController-[last_tick_duration] ([master_controller.processing?"On":"Off"]-[controller_iteration])")
|
||||
stat(null,"Air-[master_controller.air_cost]\tSun-[master_controller.sun_cost]")
|
||||
stat(null,"Mob-[master_controller.mobs_cost]\t#[mob_list.len]")
|
||||
stat(null,"Dis-[master_controller.diseases_cost]\t#[active_diseases.len]")
|
||||
stat(null,"Mch-[master_controller.machines_cost]\t#[machines.len]")
|
||||
stat(null,"Obj-[master_controller.objects_cost]\t#[processing_objects.len]")
|
||||
stat(null,"Net-[master_controller.networks_cost]\tPnet-[master_controller.powernets_cost]")
|
||||
stat(null,"NanoUI-[master_controller.nano_cost]\t#[nanomanager.processing_uis.len]")
|
||||
stat(null,"Event-[master_controller.events_cost]\t# [event_manager.active_events.len]")
|
||||
alarm_manager.stat_entry()
|
||||
stat(null,"Tick-[master_controller.ticker_cost]\tALL-[master_controller.total_cost]")
|
||||
else
|
||||
stat(null,"MasterController-ERROR")
|
||||
if(statpanel("MC") && master_controller)
|
||||
stat(null,"MasterController-[last_tick_duration] ([master_controller.processing?"On":"Off"]-[controller_iteration])")
|
||||
stat(null,"Air-[master_controller.air_cost]\tSun-[master_controller.sun_cost]")
|
||||
stat(null,"Mob-[master_controller.mobs_cost]\t#[mob_list.len]")
|
||||
stat(null,"Dis-[master_controller.diseases_cost]\t#[active_diseases.len]")
|
||||
stat(null,"Mch-[master_controller.machines_cost]\t#[machines.len]")
|
||||
stat(null,"Obj-[master_controller.objects_cost]\t#[processing_objects.len]")
|
||||
stat(null,"Net-[master_controller.networks_cost]\tPnet-[master_controller.powernets_cost]")
|
||||
stat(null,"NanoUI-[master_controller.nano_cost]\t#[nanomanager.processing_uis.len]")
|
||||
stat(null,"Event-[master_controller.events_cost]\t#[event_manager.active_events.len]")
|
||||
alarm_manager.stat_entry()
|
||||
stat(null,"Tick-[master_controller.ticker_cost]\tALL-[master_controller.total_cost]")
|
||||
else
|
||||
stat(null,"MasterController-ERROR")
|
||||
|
||||
if(listed_turf && client)
|
||||
if(!TurfAdjacent(listed_turf))
|
||||
|
||||
@@ -547,3 +547,16 @@ proc/is_blind(A)
|
||||
say_dead_direct("The ghost of <span class='name'>[name]</span> now [pick("skulks","lurks","prowls","creeps","stalks")] among the dead. [message]")
|
||||
else
|
||||
say_dead_direct("<span class='name'>[name]</span> no longer [pick("skulks","lurks","prowls","creeps","stalks")] in the realm of the dead. [message]")
|
||||
|
||||
/mob/proc/switch_to_camera(var/obj/machinery/camera/C)
|
||||
if (!C.can_use() || stat || (get_dist(C, src) > 1 || machine != src || blinded || !canmove))
|
||||
return 0
|
||||
check_eye(src)
|
||||
return 1
|
||||
|
||||
/mob/living/silicon/ai/switch_to_camera(var/obj/machinery/camera/C)
|
||||
if(!C.can_use() || !is_in_chassis())
|
||||
return 0
|
||||
|
||||
eyeobj.setLoc(C)
|
||||
return 1
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/obj/nano_module/alarm_monitor
|
||||
name = "Alarm monitor"
|
||||
var/list_cameras = 0 // Whether or not to list camera references. A future goal would be to merge this with the enginering/security camera console.
|
||||
var/list/datum/alarm_handler/alarm_handlers // The particular list of alarm handlers this alarm monitor should present to the user.
|
||||
|
||||
/obj/nano_module/alarm_monitor/ai
|
||||
list_cameras = 1
|
||||
|
||||
/obj/nano_module/alarm_monitor/ai/New()
|
||||
..()
|
||||
alarm_handlers = alarm_manager.all_handlers
|
||||
|
||||
/obj/nano_module/alarm_monitor/borg/New()
|
||||
..()
|
||||
alarm_handlers = alarm_manager.all_handlers
|
||||
|
||||
/obj/nano_module/alarm_monitor/engineering/New()
|
||||
..()
|
||||
alarm_handlers = list(atmosphere_alarm, fire_alarm, power_alarm)
|
||||
|
||||
/obj/nano_module/alarm_monitor/security/New()
|
||||
..()
|
||||
alarm_handlers = list(camera_alarm, motion_alarm)
|
||||
|
||||
/obj/nano_module/alarm_monitor/proc/register(var/object, var/procName)
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
AH.register(object, procName)
|
||||
|
||||
/obj/nano_module/alarm_monitor/proc/unregister(var/object)
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
AH.unregister(object)
|
||||
|
||||
/obj/nano_module/alarm_monitor/proc/active_alarms()
|
||||
var/list/all_alarms = new()
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
var/list/alarms = AH.alarms
|
||||
all_alarms += alarms
|
||||
|
||||
return all_alarms
|
||||
|
||||
/obj/nano_module/alarm_monitor/Topic(href, href_list)
|
||||
if(..()) return 1
|
||||
|
||||
/obj/nano_module/alarm_monitor/ai/Topic(ref, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["switchTo"])
|
||||
var/obj/machinery/camera/C = locate(href_list["switchTo"]) in cameranet.cameras
|
||||
if(!C)
|
||||
|
||||
return
|
||||
|
||||
usr.switch_to_camera(C)
|
||||
return 1
|
||||
|
||||
/obj/nano_module/alarm_monitor/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
|
||||
var/categories[0]
|
||||
for(var/datum/alarm_handler/AH in alarm_handlers)
|
||||
categories[++categories.len] = list("category" = AH.category, "alarms" = list())
|
||||
for(var/datum/alarm/A in AH.alarms)
|
||||
var/cameras[0]
|
||||
var/lost_sources[0]
|
||||
|
||||
if(list_cameras)
|
||||
for(var/obj/machinery/camera/C in A.cameras())
|
||||
cameras[++cameras.len] = C.nano_structure()
|
||||
for(var/datum/alarm_source/AS in A.sources)
|
||||
if(!AS.source)
|
||||
lost_sources[++lost_sources.len] = AS.source_name
|
||||
|
||||
categories[categories.len]["alarms"] += list(list(
|
||||
"name" = sanitize(A.alarm_name()),
|
||||
"origin_lost" = A.origin == null,
|
||||
"has_cameras" = cameras.len,
|
||||
"cameras" = cameras,
|
||||
"lost_sources" = sanitize(english_list(lost_sources, nothing_text = "", and_text = ", "))))
|
||||
data["categories"] = categories
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "alarm_monitor.tmpl", "Alarm Monitoring Console", 800, 800)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
@@ -1,5 +1,5 @@
|
||||
/obj/nano_module/rcon
|
||||
name = "RCON interface"
|
||||
name = "Power RCON"
|
||||
|
||||
var/list/known_SMESs = null
|
||||
var/list/known_breakers = null
|
||||
|
||||
Reference in New Issue
Block a user