pAIs, Computers and ntIRC (#8757)

#8005 just revived.

Tasks to acomplish while here:

Fix merge conflicts

    Add ntIRC direct messaging

Things I migth consider adding in future PR:

    Porting IRC to VueUI
    Porting File Manager to VueUI.
This commit is contained in:
Karolis
2020-05-08 13:58:34 +03:00
committed by GitHub
parent 691a11cf00
commit 1c00ae02d3
72 changed files with 6149 additions and 4768 deletions
@@ -0,0 +1,44 @@
/datum/computer_file/program/manifest
filename = "manifest"
filedesc = "Crew Manifest"
program_icon_state = "generic"
extended_desc = "This program is used for viewing the crew manifest."
size = 3
requires_ntnet = 1
available_on_ntnet = 1
/datum/computer_file/program/manifest/ui_interact(mob/user)
var/datum/vueui/ui = SSvueui.get_open_ui(user, src)
if (!ui)
ui = new /datum/vueui/modularcomputer(user, src, "manifest", 450, 600, "Crew Manifest")
ui.open()
/datum/computer_file/program/manifest/vueui_transfer(oldobj)
SSvueui.transfer_uis(oldobj, src, "manifest", 450, 600, "Crew Manifest")
return TRUE
// Gaters data for ui
/datum/computer_file/program/manifest/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui)
. = ..()
data = . || data || list()
// Gather data for computer header
var/headerdata = get_header_data(data["_PC"])
if(headerdata)
data["_PC"] = headerdata
. = data
VUEUI_SET_CHECK(data["manifest"], SSrecords.get_manifest_list(), ., data)
/datum/computer_file/program/manifest/Topic(href, href_list)
. = ..()
if(!istype(computer, /obj/item/modular_computer/silicon))
return
var/obj/item/modular_computer/silicon/true_computer = computer
if(!istype(true_computer.computer_host, /mob/living/silicon/pai))
return
var/mob/living/silicon/pai/host = true_computer.computer_host
host.radio.Topic(href, href_list)
@@ -15,6 +15,7 @@
var/datum/ntnet_conversation/channel
var/operator_mode = FALSE // Channel operator mode
var/netadmin_mode = FALSE // Administrator mode (invisible to other users + bypasses passwords)
var/list/directmessagechannels = list()
color = LIGHT_COLOR_GREEN
/datum/computer_file/program/chatclient/New()
@@ -60,9 +61,12 @@
channel = C
if(href_list["PRG_leavechannel"])
. = TRUE
if(channel)
if(channel && !channel.direct)
channel.remove_client(src)
channel = null
if(href_list["PRG_backtomain"])
. = TRUE
channel = null
if(href_list["PRG_newchannel"])
. = TRUE
var/mob/living/user = usr
@@ -98,10 +102,16 @@
var/new_name = sanitize(input(user, "Enter new nickname or leave blank to cancel:"))
if(!new_name)
return TRUE
if(channel)
channel.add_status_message("[username] is now known as [new_name].")
var/comp_name = ckey(new_name)
for(var/cl in ntnet_global.chat_clients)
var/datum/computer_file/program/chatclient/C = cl
if(ckey(C.username) == comp_name || comp_name == "cancel")
alert(user, "This nickname is already taken.")
return TRUE
for(var/datum/ntnet_conversation/channel in ntnet_global.chat_channels)
if(src in channel.clients)
channel.add_status_message("[username] is now known as [new_name].")
username = new_name
if(href_list["PRG_savelog"])
. = TRUE
if(!channel)
@@ -156,6 +166,30 @@
channel.password = ""
else
channel.password = newpassword
if(href_list["PRG_directmessage"])
. = TRUE
var/clients = list()
var/names = list()
for(var/cl in ntnet_global.chat_clients)
var/datum/computer_file/program/chatclient/C = cl
clients[C.username] = C
names += C.username
names -= username // Remove ourselves
names += "== Cancel =="
var/picked = input(usr, "Select with whom you would like to start a conversation.") in names
if(picked == "== Cancel ==")
return
var/datum/computer_file/program/chatclient/otherClient = clients[picked]
if(picked)
if(directmessagechannels[otherClient])
channel = directmessagechannels[otherClient]
return
var/datum/ntnet_conversation/C = new /datum/ntnet_conversation("", TRUE)
C.begin_direct(src, otherClient)
channel = C
directmessagechannels[otherClient] = C
otherClient.directmessagechannels[src] = C
/datum/computer_file/program/chatclient/process_tick()
..()
@@ -176,11 +210,14 @@
ui_header = "ntnrc_idle.gif"
/datum/computer_file/program/chatclient/kill_program(var/forced = FALSE)
if(channel)
channel.remove_client(src)
channel = null
channel = null
ntnet_global.chat_clients -= src
..(forced)
/datum/computer_file/program/chatclient/run_program(var/mob/user)
ntnet_global.chat_clients += src
return ..(user)
/datum/nano_module/program/computer_chatclient
name = "NTNet Relay Chat Client"
@@ -198,7 +235,7 @@
data["adminmode"] = C.netadmin_mode
if(C.channel)
data["title"] = C.channel.title
data["title"] = C.channel.get_title(C)
var/list/messages[0]
for(var/M in C.channel.messages)
messages.Add(list(list(
@@ -208,19 +245,21 @@
var/list/clients[0]
for(var/datum/computer_file/program/chatclient/cl in C.channel.clients)
clients.Add(list(list(
"name" = cl.username
"name" = cl.username,
"active" = cl.program_state > PROGRAM_STATE_KILLED
)))
data["clients"] = clients
C.operator_mode = (C.channel.operator == C) ? 1 : 0
data["is_operator"] = C.operator_mode || C.netadmin_mode
data["is_direct"] = C.channel.direct
else // Channel selection screen
var/list/all_channels[0]
for(var/datum/ntnet_conversation/conv in ntnet_global.chat_channels)
if(conv && conv.title)
if(conv && conv.title && conv.can_see(program))
all_channels.Add(list(list(
"chan" = conv.title,
"id" = conv.id
"chan" = conv.get_title(C),
"id" = conv.id,
"con" = (program in conv.clients)
)))
data["all_channels"] = all_channels
@@ -11,6 +11,7 @@
requires_ntnet = TRUE
requires_ntnet_feature = NTNET_SYSTEMCONTROL
requires_access_to_run = PROGRAM_ACCESS_LIST_ONE
usage_flags = PROGRAM_ALL_REGULAR | PROGRAM_STATIONBOUND
var/records_type = RECORD_GENERAL | RECORD_MEDICAL | RECORD_SECURITY | RECORD_VIRUS | RECORD_WARRANT | RECORD_LOCKED
var/edit_type = RECORD_GENERAL | RECORD_MEDICAL | RECORD_SECURITY | RECORD_VIRUS | RECORD_WARRANT | RECORD_LOCKED
@@ -77,6 +78,12 @@
program_icon_state = "employment_record"
color = LIGHT_COLOR_BLUE
/datum/computer_file/program/records/pai
available_on_ntnet = 1
extended_desc = "This program is used to view crew records."
usage_flags = PROGRAM_SILICON_PAI
edit_type = 0
/datum/computer_file/program/records/New()
. = ..()
listener = new(src)
@@ -339,4 +346,4 @@
var/datum/computer_file/program/records/t = target
if(istype(t) && !t.isEditing)
if(t.active == r || t.active_virus == r)
SSvueui.check_uis_for_change(t)
SSvueui.check_uis_for_change(t)