New chat client / messenger (#10654)

This commit is contained in:
Karolis
2021-01-11 11:04:16 +02:00
committed by GitHub
parent f99e4a29c0
commit 339c531ad7
31 changed files with 858 additions and 846 deletions

View File

@@ -98,7 +98,6 @@
/obj/item/modular_computer/Destroy()
kill_program(TRUE)
if(registered_id)
registered_id.chat_registered = FALSE
registered_id = null
for(var/obj/item/computer_hardware/CH in src.get_all_components())
uninstall_component(null, CH)
@@ -197,7 +196,7 @@
if(network_card)
return network_card.get_signal(specific_action)
else
return 0
return FALSE
/obj/item/modular_computer/proc/add_log(var/text)
if(!get_ntnet_status())
@@ -366,6 +365,7 @@
/obj/item/modular_computer/proc/enable_service(service, mob/user, var/datum/computer_file/program/S = null)
. = FALSE
if(!S)
S = hard_drive?.find_file_by_name(service)
@@ -382,9 +382,11 @@
return
// Start service
if(S.service_activate())
if(S.service_enable())
enabled_services += S
S.service_state = PROGRAM_STATE_ACTIVE
return TRUE
/obj/item/modular_computer/proc/disable_service(service, mob/user, var/datum/computer_file/program/S = null)
@@ -399,8 +401,8 @@
enabled_services -= S
// Stop service
S.service_deactivate()
S.service_state = PROGRAM_STATE_KILLED
S.service_disable()
S.service_state = PROGRAM_STATE_DISABLED
/obj/item/modular_computer/proc/output_message(var/message, var/message_range)
message_range += message_output_range
@@ -434,12 +436,13 @@
if(!istype(id))
output_error("No ID card found!")
return FALSE
if(id.chat_registered)
output_error("This card is already registered to another account!")
return FALSE
id.chat_registered = TRUE
registered_id = id
if(hard_drive)
for(var/datum/computer_file/program/P in hard_drive.stored_files)
P.event_registered()
output_notice("Registration successful!")
playsound(get_turf(src), 'sound/machines/ping.ogg', 10, 0)
return registered_id
@@ -448,12 +451,11 @@
if(!registered_id)
return FALSE
registered_id.chat_registered = FALSE
registered_id = null
if(hard_drive)
var/datum/computer_file/program/P = hard_drive.find_file_by_name("ntnrc_client")
P.event_unregistered()
for(var/datum/computer_file/program/P in hard_drive.stored_files)
P.event_unregistered()
registered_id = null
output_message(SPAN_NOTICE("\The [src] beeps: \"Successfully unregistered ID!\""))
playsound(get_turf(src), 'sound/machines/ping.ogg', 20, 0)
@@ -476,7 +478,6 @@
return TRUE
/obj/item/modular_computer/proc/silence_notifications()
for (var/datum/computer_file/program/P in hard_drive.stored_files)
if (istype(P))
P.event_silentmode()
silent = !silent
for (var/datum/computer_file/program/P in hard_drive.stored_files)
P.event_silentmode()

View File

@@ -3,8 +3,9 @@
visible_message(SPAN_WARNING("\The [src]'s screen flickers briefly and then goes dark."))
if(active_program)
active_program.event_powerfailure(FALSE)
for(var/datum/computer_file/program/PRG in idle_threads)
PRG.event_powerfailure(TRUE)
for(var/datum/computer_file/program/PRG in hard_drive.stored_files)
if(PRG != active_program)
PRG.event_powerfailure(TRUE)
shutdown_computer(FALSE)
power_has_failed = TRUE
update_icon()

View File

@@ -4,6 +4,7 @@
name = "Modular Computer"
desc = "A modular computer. You shouldn't see this."
var/lexical_name = "computer"
var/enabled = FALSE // Whether the computer is turned on.
var/screen_on = TRUE // Whether the computer is active/opened/it's screen is on.
var/working = TRUE // Whether the computer is working.

View File

@@ -1,5 +1,6 @@
/obj/item/modular_computer/handheld
name = "tablet computer"
lexical_name = "tablet"
desc = "A portable device for your needs on the go."
desc_info = "To deploy the charging cable on this device, either drag and drop it over a nearby APC, or click on the APC with the computer in hand."
icon = 'icons/obj/modular_tablet.dmi'

View File

@@ -1,6 +1,7 @@
/obj/item/modular_computer/laptop
anchored = TRUE
name = "laptop computer"
lexical_name = "laptop"
desc = "A portable computer."
desc_info = "You can alt-click the laptop while it's set down on surface to open it up and work with it. Left clicking while it is open will allow you to operate it."
hardware_flag = PROGRAM_LAPTOP

View File

@@ -1,5 +1,6 @@
/obj/item/modular_computer/handheld/pda
name = "PDA"
lexical_name = "tablet"
desc = "The latest in portable microcomputer solutions from Thinktronic Systems, LTD."
icon = 'icons/obj/pda.dmi'
icon_state = "pda"

View File

@@ -53,7 +53,7 @@
/obj/item/modular_computer/silicon/install_default_programs()
hard_drive.store_file(new /datum/computer_file/program/filemanager(src))
hard_drive.store_file(new /datum/computer_file/program/ntnetdownload(src))
hard_drive.store_file(new /datum/computer_file/program/chatclient(src))
hard_drive.store_file(new /datum/computer_file/program/chat_client(src))
hard_drive.remove_file(hard_drive.find_file_by_name("clientmanager"))
addtimer(CALLBACK(src, .proc/register_chat), 1 SECOND)
@@ -62,24 +62,6 @@
enable_computer(null, TRUE) // passing null because we don't want the UI to open
minimize_program()
/obj/item/modular_computer/silicon/verb/send_pda_message()
set category = "AI IM"
set name = "Send Direct Message"
set src in usr
if (usr.stat == DEAD)
to_chat(usr, "You can't send PDA messages because you are dead!")
return
var/datum/computer_file/program/chatclient/CL = hard_drive.find_file_by_name("ntnrc_client")
if(!istype(CL))
output_error("Chat client not installed!")
return
else if(CL.program_state == PROGRAM_STATE_KILLED)
run_program("ntnrc_client")
CL.direct_message()
if(CL.channel)
CL.add_message(CL.send_message())
/obj/item/modular_computer/silicon/robot/drone/install_default_programs()
hard_drive.store_file(new /datum/computer_file/program/filemanager(src))
hard_drive.store_file(new /datum/computer_file/program/ntnetdownload(src))

View File

@@ -1,5 +1,6 @@
/obj/item/modular_computer/handheld/wristbound
name = "wristbound computer"
lexical_name = "wristbound"
desc = "A portable wristbound device for your needs on the go. Quite comfortable."
desc_fluff = "A NanoTrasen design, this wristbound computer allows the user to quickly and safely access critical info, without taking their hands out of the equation."
icon = 'icons/obj/modular_wristbound.dmi'