Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] NTNet tweaks #3133

Merged
merged 4 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions mods/ntnet/code/NTNet-core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ GLOBAL_LIST_INIT(NTNet_machines, list())
GLOB.NTNet_machines += src
get_new_ntnet_id("PC")

/obj/machinery/alarm/Initialize()
. = ..()
GLOB.NTNet_machines += src
get_new_ntnet_id("AA")

/obj/machinery/camera/Initialize()
. = ..()
GLOB.NTNet_machines += src
get_new_ntnet_id("CM")

/datum/terminal/proc/get_remote_ID(ID)
for(var/obj/machinery/R as anything in SSmachines.get_all_machinery())
Expand Down
18 changes: 18 additions & 0 deletions mods/ntnet/code/NTNet-items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,29 @@
. = ..()
if(hasHUD(user, HUD_IT) && has_electronics && terminal())
to_chat(user, SPAN_INFO(SPAN_ITALIC("You may notice a small hologram that says: [NTNet_id]")))
else if(issilicon(user))
to_chat(user, SPAN_INFO(SPAN_ITALIC("Chosen device network ID: [NTNet_id]")))

/obj/machinery/alarm/examine(mob/user)
. = ..()
if(hasHUD(user, HUD_IT))
to_chat(user, SPAN_INFO(SPAN_ITALIC("You may notice a small hologram that says: [NTNet_id]")))
else if(issilicon(user))
to_chat(user, SPAN_INFO(SPAN_ITALIC("Chosen device network ID: [NTNet_id]")))

/obj/machinery/firealarm/examine(mob/user)
. = ..()
if(hasHUD(user, HUD_IT))
to_chat(user, SPAN_INFO(SPAN_ITALIC("You may notice a small hologram that says: [NTNet_id]")))
else if(issilicon(user))
to_chat(user, SPAN_INFO(SPAN_ITALIC("Chosen device network ID: [NTNet_id]")))

/obj/machinery/camera/examine(mob/user)
. = ..()
if(hasHUD(user, HUD_IT))
to_chat(user, SPAN_INFO(SPAN_ITALIC("You may notice a small hologram that says: [NTNet_id]")))
else if(issilicon(user))
to_chat(user, SPAN_INFO(SPAN_ITALIC("Chosen device network ID: [NTNet_id]")))

/obj/item/modular_computer/examine(mob/user)
. = ..()
Expand Down
122 changes: 121 additions & 1 deletion mods/ntnet/code/terminal/commands/connect.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
. += " Airlock timing: [REMOTE.normalspeed ? "<font color = '#00ff00'>STABLE</font>" : "<font color = '#ff0000'>OVERRIDEN</font>"].<br>"
. += " Safety protocols: [REMOTE.safe ? "<font color = '#00ff00'>STABLE</font>" : "<font color = '#ff0000'>OVERRIDEN</font>"].<br></pre>"
. += "Required Access: [length(REMOTE.req_access)>=1 ? "([jointext(REMOTE.req_access, ", ") ])" : "ACCESS NOT REQUIRED"].<hr>"
. += "Acces check: [has_access(REMOTE.req_access, user.GetAccess()) ? "<font color = '#00ff00'>GRANTED</font>" : "<font color = '#ff0000'>DENIED</font>"]."
. += "Access check: [has_access(REMOTE.req_access, user.GetAccess()) ? "<font color = '#00ff00'>GRANTED</font>" : "<font color = '#ff0000'>DENIED</font>"]."
return

if(!has_access(REMOTE.req_access, user.GetAccess())) // && !override)
Expand Down Expand Up @@ -137,6 +137,87 @@
else
return "ACCESS ERROR"

// Atmospheric Alarm
if (copytext(txt[2],1,3) == "AA")
var/NTID = txt[2]
var/obj/machinery/alarm/REMOTE = terminal.get_remote_ID(NTID)
if (length(txt)==2)
. += "Outputting data about Atmospheric Alarm([NTID]):<hr>"
. += "Name:[copytext(REMOTE.name,2)]<br>"
. += "Status:[REMOTE.locked ? "<font color = '#00ff00'>BLOCKED</font>" : "<font color = '#ff0000'>OPEN</font>"]<br><hr>"
. += "AI control:[REMOTE.aidisabled ? "<font color = '#ff0000'>OUT OF SERVICE</font>" : "<font color = '#00ff00'>ACTIVE</font>"]<br><hr>"
var/alarm_level
switch(REMOTE.danger_level)
if(1)
alarm_level = "<font color = '#fffa29'>MINOR</font>"
if(0)
alarm_level = "<font color ='#00ff00'>CLEAR</font>"
else
alarm_level = "<font color = '#ff0000'>SEVERE</font>"
var/alarm_mode
switch(REMOTE.mode)
if(6)
alarm_mode = "<font color = '#fffa29'>OFF</font>"
if(5)
alarm_mode = "<font color = '#fffa29'>FILL</font>"
if(4)
alarm_mode = "<font color = '#fffa29'>CYCLE</font>"
if(3)
alarm_mode = "<font color = '#ff0000'>SIPHONING</font>"
if(2)
alarm_mode = "<font color = '#fffa29'>REPLACEMENT</font>"
if(1)
alarm_mode = "<font color = '#00ff00'>SCRUBBING</font>"
else
alarm_mode = "<font color = '#ff0000'>NO DATA</font>"
. += "<pre>Local functional data:<br>"
. += " Current alarm level: [alarm_level].<br>"
. += " Current operating mode: [alarm_mode].<br>"
return


if ((length(txt)==3) && (has_access(REMOTE.req_access, user.GetAccess() || !REMOTE.locked)))
switch(txt[3])
//lock-unlock panel
if("-lock")
REMOTE.locked = 1
. += "Atmospheric Alarm panel <font color = '#00ff00'>BLOCKED</font>"
REMOTE.update_icon()
if("-unlock")
REMOTE.locked = 0
. += "Atmospheric Alarm <font color = '#ff0000'>OPEN</font>"
REMOTE.update_icon()
//Toggle Alarm mode
if("-mode-scrub")
REMOTE.mode = 1
REMOTE.apply_mode()
. += "Atmospheric Alarm mode set to <font color = '#00ff00'>SCRUBBING</font>"
if("-mode-replace")
REMOTE.mode = 2
REMOTE.apply_mode()
. += "Atmospheric Alarm mode set to <font color = '#fffa29'>REPLACEMENT</font>"
if("-mode-siphon")
REMOTE.mode = 3
REMOTE.apply_mode()
. += "Atmospheric Alarm mode set to <font color = '#ff0000'>SIPHONING</font>"
if("-mode-cycle")
REMOTE.mode = 4
REMOTE.apply_mode()
. += "Atmospheric Alarm mode set to <font color = '#fffa29'>CYCLE</font>"
if("-mode-fill")
REMOTE.mode = 5
REMOTE.apply_mode()
. += "Atmospheric Alarm mode set to <font color = '#fffa29'>FILL</font>"
if("-mode-off")
REMOTE.mode = 6
REMOTE.apply_mode()
. += "Atmospheric Alarm mode set to <font color = '#fffa29'>OFF</font>"

else
return "Wrong parametr"
return
else
return "ACCESS ERROR"

// FIREALARM
if (copytext(txt[2],1,3) == "FA")
Expand All @@ -159,5 +240,44 @@
REMOTE.detecting = !REMOTE.detecting
return "Automatic switched to: [REMOTE.detecting ? "<font color = '#00ff00'>ON</font>" : "<font color = '#ff0000'>OFF</font>"]."

// SECURITY CAMERA
if (copytext(txt[2],1,3) == "CM")
var/NTID = txt[2]
var/obj/machinery/camera/REMOTE = terminal.get_remote_ID(NTID)
if (length(txt)==2)
. += "Outputting data about security camera([NTID]):<hr>"
. += "Name: [REMOTE.name]<br> <hr>"
. += "Camera Alarm: [REMOTE.alarm_on ? "<font color = '#ff0000'>ON</font>" : "<font color = '#00ff00'>OFF</font>"]<br> <hr>"
var/camera_focus
switch(REMOTE.view_range)
if(2)
camera_focus = "<font color = '#fffa29'>DEFOCUSED</font>"
if(7)
camera_focus = "<font color ='#00ff00'>NOMINAL</font>"
else
camera_focus = "<font color = '#ff0000'>MISMATCHED</font>"
. += " Focus: [camera_focus].<br>"
return
else if (length(txt)==3)
switch(txt[3])
// triggering camera alarm
if("-alarm")
REMOTE.alarm_on = 1
return "Alarm Triggered"
// camera lights (can AI toggle it?)
if("-light_up")
REMOTE.light_disabled = 0
return "Light up"
if("-light_down")
REMOTE.light_disabled = 1
return "Light down"
// camera focus (AI vision range)
if("-defocus")
REMOTE.setViewRange(2)
return "Camera defocused"
if("-focus")
REMOTE.setViewRange(7)
return "Camera focused"

else
. += "Syntax mismach"
9 changes: 6 additions & 3 deletions mods/utility_items/code/wires.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@

/datum/wires/alarm/SolveWireFunction(function)
var/sf = ""
var/obj/machinery/power/apc/AIR = holder
switch(function)
if(AALARM_WIRE_IDSCAN)
sf = "Port A"
Expand All @@ -91,14 +92,15 @@
if(AALARM_WIRE_SYPHON)
sf = "Port C"
if(AALARM_WIRE_AI_CONTROL)
sf = "Port D"
sf = "Port D (NTNet ID = [AIR.NTNet_id])"
if(AALARM_WIRE_AALARM)
sf = "Port E"

return sf

/datum/wires/apc/SolveWireFunction(function)
var/sf = ""
var/obj/machinery/power/apc/APC = holder
switch(function)
if(APC_WIRE_IDSCAN)
sf = "Port A"
Expand All @@ -107,12 +109,13 @@
if(APC_WIRE_MAIN_POWER2)
sf = "Port C"
if(APC_WIRE_AI_CONTROL)
sf = "Port D"
sf = "Port D (NTNet ID = [APC.NTNet_id])"

return sf

/datum/wires/camera/SolveWireFunction(function)
var/sf = ""
var/obj/machinery/camera/CAM = holder
switch(function)
if(CAMERA_WIRE_FOCUS)
sf = "Port A"
Expand All @@ -123,7 +126,7 @@
if(CAMERA_WIRE_ALARM)
sf = "Port D"
if(CAMERA_WIRE_NOTHING1)
sf = "Port E"
sf = "Port E (NTNet ID = [CAM.NTNet_id])"
if(CAMERA_WIRE_NOTHING2)
sf = "Port F"

Expand Down