mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-16 02:17:06 +01:00
a small addition
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
var/global/ntnrc_uid = 0
|
||||
/datum/ntnet_conversation/
|
||||
var/id = null
|
||||
/datum/ntnet_conversation
|
||||
var/id
|
||||
var/title = "Untitled Conversation"
|
||||
var/datum/computer_file/program/chatclient/operator // "Administrator" of this channel. Creator starts as channel's operator,
|
||||
var/list/messages = list()
|
||||
@@ -18,8 +18,14 @@ var/global/ntnrc_uid = 0
|
||||
operator = "NanoTrasen Information Technology Division" // assign a fake operator
|
||||
..()
|
||||
|
||||
/datum/ntnet_conversation/proc/add_message(var/message, var/username, var/mob/user)
|
||||
log_ntirc("[user.client.ckey]/([username]) : [message]",ckey=key_name(user),conversation=title)
|
||||
/datum/ntnet_conversation/proc/add_message(var/message, var/username, var/mob/user, var/reply_ref)
|
||||
log_ntirc("[user.client.ckey]/([username]) : [message]", ckey=key_name(user), conversation=title)
|
||||
|
||||
for(var/datum/computer_file/program/chatclient/C in clients)
|
||||
if(C.username == username || !C.computer.screen_on)
|
||||
continue
|
||||
if(C.computer.active_program == C || (C in C.computer.idle_threads))
|
||||
C.computer.output_message(FONT_SMALL("<b>([title]) [username]:</b> [message]"), 0)
|
||||
|
||||
message = "[worldtime2text()] [username]: [message]"
|
||||
messages.Add(message)
|
||||
@@ -45,6 +51,12 @@ var/global/ntnrc_uid = 0
|
||||
if(!operator)
|
||||
changeop(C)
|
||||
|
||||
for(var/datum/computer_file/program/chatclient/CC in clients)
|
||||
if(CC == C || !CC.computer.screen_on)
|
||||
continue
|
||||
if(CC.computer.active_program == CC || (CC in CC.computer.idle_threads))
|
||||
CC.computer.output_message(FONT_SMALL("<b>([title]) A new client ([C.username]) has entered the chat.</b>"), 0)
|
||||
|
||||
/datum/ntnet_conversation/proc/remove_client(var/datum/computer_file/program/chatclient/C)
|
||||
if(!istype(C) || !(C in clients))
|
||||
return
|
||||
@@ -57,6 +69,12 @@ var/global/ntnrc_uid = 0
|
||||
var/datum/computer_file/program/chatclient/newop = pick(clients)
|
||||
changeop(newop)
|
||||
|
||||
for(var/datum/computer_file/program/chatclient/CC in clients)
|
||||
if(CC == C || !CC.computer.screen_on)
|
||||
continue
|
||||
if(CC.computer.active_program == CC || (CC in CC.computer.idle_threads))
|
||||
CC.computer.output_message(FONT_SMALL("<b>([title]) A client ([C.username]) has left the chat.</b>"), 0)
|
||||
|
||||
|
||||
/datum/ntnet_conversation/proc/changeop(var/datum/computer_file/program/chatclient/newop)
|
||||
if(istype(newop))
|
||||
@@ -68,4 +86,10 @@ var/global/ntnrc_uid = 0
|
||||
return 0 // Not Authorised
|
||||
|
||||
add_status_message("[client.username] has changed channel title from [title] to [newtitle]")
|
||||
title = newtitle
|
||||
title = newtitle
|
||||
|
||||
for(var/datum/computer_file/program/chatclient/C in clients)
|
||||
if(C == client || !C.computer.screen_on)
|
||||
continue
|
||||
if(C.computer.active_program == src || (C in C.computer.idle_threads))
|
||||
C.computer.output_message(FONT_SMALL("([title]) A new client ([C.username]) has entered the chat."), 0)
|
||||
@@ -2,7 +2,7 @@ var/global/datum/ntnet/ntnet_global = new()
|
||||
|
||||
|
||||
// This is the NTNet datum. There can be only one NTNet datum in game at once. Modular computers read data from this.
|
||||
/datum/ntnet/
|
||||
/datum/ntnet
|
||||
var/list/relays = list()
|
||||
var/list/logs = list()
|
||||
var/list/available_station_software = list()
|
||||
@@ -17,14 +17,14 @@ var/global/datum/ntnet/ntnet_global = new()
|
||||
var/setting_maxlogcount = 100
|
||||
|
||||
// These only affect wireless. LAN (consoles) are unaffected since it would be possible to create scenario where someone turns off NTNet, and is unable to turn it back on since it refuses connections
|
||||
var/setting_softwaredownload = 1
|
||||
var/setting_peertopeer = 1
|
||||
var/setting_communication = 1
|
||||
var/setting_systemcontrol = 1
|
||||
var/setting_disabled = 0 // Setting to 1 will disable all wireless, independently on relays status.
|
||||
var/setting_softwaredownload = TRUE
|
||||
var/setting_peertopeer = TRUE
|
||||
var/setting_communication = TRUE
|
||||
var/setting_systemcontrol = TRUE
|
||||
var/setting_disabled = FALSE // Setting to 1 will disable all wireless, independently on relays status.
|
||||
|
||||
var/intrusion_detection_enabled = 1 // Whether the IDS warning system is enabled
|
||||
var/intrusion_detection_alarm = 0 // Set when there is an IDS warning due to malicious (antag) software.
|
||||
var/intrusion_detection_enabled = TRUE // Whether the IDS warning system is enabled
|
||||
var/intrusion_detection_alarm = FALSE // Set when there is an IDS warning due to malicious (antag) software.
|
||||
|
||||
|
||||
// If new NTNet datum is spawned, it replaces the old one.
|
||||
@@ -62,18 +62,18 @@ var/global/datum/ntnet/ntnet_global = new()
|
||||
// Checks whether NTNet operates. If parameter is passed checks whether specific function is enabled.
|
||||
/datum/ntnet/proc/check_function(var/specific_action = 0)
|
||||
if(!relays || !relays.len) // No relays found. NTNet is down
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
var/operating = 0
|
||||
var/operating = FALSE
|
||||
|
||||
// Check all relays. If we have at least one working relay, network is up.
|
||||
for(var/obj/machinery/ntnet_relay/R in relays)
|
||||
if(R.operable())
|
||||
operating = 1
|
||||
operating = TRUE
|
||||
break
|
||||
|
||||
if(setting_disabled)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(specific_action == NTNET_SOFTWAREDOWNLOAD)
|
||||
return (operating && setting_softwaredownload)
|
||||
@@ -123,7 +123,7 @@ var/global/datum/ntnet/ntnet_global = new()
|
||||
|
||||
// Resets the IDS alarm
|
||||
/datum/ntnet/proc/resetIDS()
|
||||
intrusion_detection_alarm = 0
|
||||
intrusion_detection_alarm = FALSE
|
||||
|
||||
/datum/ntnet/proc/toggleIDS()
|
||||
resetIDS()
|
||||
@@ -137,7 +137,7 @@ var/global/datum/ntnet/ntnet_global = new()
|
||||
// Updates maximal amount of stored logs. Use this instead of setting the number, it performs required checks.
|
||||
/datum/ntnet/proc/update_max_log_count(var/lognumber)
|
||||
if(!lognumber)
|
||||
return 0
|
||||
return FALSE
|
||||
// Trim the value if necessary
|
||||
lognumber = between(MIN_NTNET_LOGS, lognumber, MAX_NTNET_LOGS)
|
||||
setting_maxlogcount = lognumber
|
||||
@@ -159,4 +159,4 @@ var/global/datum/ntnet/ntnet_global = new()
|
||||
add_log("Configuration Updated. Wireless network firewall now [setting_communication ? "allows" : "disallows"] instant messaging and similar communication services.")
|
||||
if(NTNET_SYSTEMCONTROL)
|
||||
setting_systemcontrol = !setting_systemcontrol
|
||||
add_log("Configuration Updated. Wireless network firewall now [setting_systemcontrol ? "allows" : "disallows"] remote control of station's systems.")
|
||||
add_log("Configuration Updated. Wireless network firewall now [setting_systemcontrol ? "allows" : "disallows"] remote control of station's systems.")
|
||||
@@ -7,11 +7,11 @@
|
||||
idle_power_usage = 100
|
||||
icon_state = "ntnet"
|
||||
icon = 'icons/obj/machines/telecomms.dmi'
|
||||
anchored = 1
|
||||
density = 1
|
||||
var/datum/ntnet/NTNet = null // This is mostly for backwards reference and to allow varedit modifications from ingame.
|
||||
var/enabled = 1 // Set to 0 if the relay was turned off
|
||||
var/dos_failure = 0 // Set to 1 if the relay failed due to (D)DoS attack
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
var/datum/ntnet/NTNet // This is mostly for backwards reference and to allow varedit modifications from ingame.
|
||||
var/enabled = TRUE // Set to FALSE if the relay was turned off
|
||||
var/dos_failure = FALSE // Set to TRUE if the relay failed due to (D)DoS attack
|
||||
var/list/dos_sources = list() // Backwards reference for qdel() stuff
|
||||
|
||||
// Denial of Service attack variables
|
||||
@@ -27,30 +27,24 @@
|
||||
// TODO: Implement more logic here. For now it's only a placeholder.
|
||||
/obj/machinery/ntnet_relay/operable()
|
||||
if(!..(EMPED))
|
||||
return 0
|
||||
return FALSE
|
||||
if(dos_failure)
|
||||
return 0
|
||||
return FALSE
|
||||
if(!enabled)
|
||||
return 0
|
||||
return 1
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/ntnet_relay/update_icon()
|
||||
icon_state = initial(icon_state)
|
||||
|
||||
cut_overlays()
|
||||
|
||||
if (panel_open)
|
||||
if(panel_open)
|
||||
icon_state += "_o"
|
||||
|
||||
if (!operable())
|
||||
if(!operable())
|
||||
icon_state += "_off"
|
||||
|
||||
else if (dos_failure)
|
||||
else if(dos_failure)
|
||||
add_overlay("ntnet_o_problem")
|
||||
|
||||
else if (!enabled)
|
||||
else if(!enabled)
|
||||
add_overlay("ntnet_o_error")
|
||||
|
||||
else
|
||||
add_overlay("ntnet_o_ok")
|
||||
|
||||
@@ -65,12 +59,12 @@
|
||||
|
||||
// If DoS traffic exceeded capacity, crash.
|
||||
if((dos_overload > dos_capacity) && !dos_failure)
|
||||
dos_failure = 1
|
||||
dos_failure = TRUE
|
||||
update_icon()
|
||||
ntnet_global.add_log("Quantum relay switched from normal operation mode to overload recovery mode.")
|
||||
// If the DoS buffer reaches 0 again, restart.
|
||||
if((dos_overload == 0) && dos_failure)
|
||||
dos_failure = 0
|
||||
dos_failure = FALSE
|
||||
update_icon()
|
||||
ntnet_global.add_log("Quantum relay switched from overload recovery mode to normal operation mode.")
|
||||
..()
|
||||
@@ -94,10 +88,10 @@
|
||||
|
||||
/obj/machinery/ntnet_relay/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
return TRUE
|
||||
if(href_list["restart"])
|
||||
dos_overload = 0
|
||||
dos_failure = 0
|
||||
dos_overload = FALSE
|
||||
dos_failure = FALSE
|
||||
update_icon()
|
||||
ntnet_global.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.")
|
||||
else if(href_list["toggle"])
|
||||
@@ -127,22 +121,22 @@
|
||||
D.error = "Connection to quantum relay severed"
|
||||
return ..()
|
||||
|
||||
/obj/machinery/ntnet_relay/attackby(var/obj/item/W as obj, var/mob/user as mob)
|
||||
/obj/machinery/ntnet_relay/attackby(obj/item/W, mob/user)
|
||||
if(W.isscrewdriver())
|
||||
playsound(src.loc, W.usesound, 50, 1)
|
||||
playsound(get_turf(src), W.usesound, 50, TRUE)
|
||||
panel_open = !panel_open
|
||||
to_chat(user, "You [panel_open ? "open" : "close"] the maintenance hatch")
|
||||
to_chat(user, SPAN_NOTICE("You [panel_open ? "open" : "close"] the maintenance hatch."))
|
||||
return
|
||||
if(W.iscrowbar())
|
||||
if(!panel_open)
|
||||
to_chat(user, "Open the maintenance panel first.")
|
||||
to_chat(user, SPAN_WARNING("Open the maintenance panel first."))
|
||||
return
|
||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
to_chat(user, "You disassemble \the [src]!")
|
||||
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, 1)
|
||||
to_chat(user, SPAN_NOTICE("You disassemble \the [src]!"))
|
||||
|
||||
for(var/atom/movable/A in component_parts)
|
||||
A.forceMove(src.loc)
|
||||
new/obj/machinery/constructable_frame/machine_frame(src.loc)
|
||||
A.forceMove(get_turf(src))
|
||||
new /obj/machinery/constructable_frame/machine_frame(get_turf(src))
|
||||
qdel(src)
|
||||
return
|
||||
..()
|
||||
..()
|
||||
Reference in New Issue
Block a user