Skip to content
Draft
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
1 change: 1 addition & 0 deletions code/__DEFINES/~~iris_defines/keybindings.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define COMSIG_KB_CLIENT_IRC_DOWN "keybinding_client_irc_down"
9 changes: 9 additions & 0 deletions code/__DEFINES/~~iris_defines/ntnrc.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

/// Name used for the common chat all crew gets added to when they join.
#define NTNRC_COMMON_CHAT "#general"

/// Name used for the ai's special chatroom, yes we have the magic ai in spess 🪄✨
#define NTNRC_AI_CHAT "#ai-request"

/// Name used for the preference for the default NTNRC username.
#define NTRNC_USERNAME_PREF_NAME "NTNRC username"
1 change: 1 addition & 0 deletions code/__DEFINES/~~iris_defines/speech_channels.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define IRC_CHANNEL "IRC" // IRC
16 changes: 13 additions & 3 deletions code/modules/modular_computers/computers/item/computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,21 @@
* The program calling this proc.
* The message that the program wishes to display.
*/
/obj/item/modular_computer/proc/alert_call(datum/computer_file/program/call_source, alerttext, sound = 'sound/machines/beep/twobeep_high.ogg')

// IRIS EDIT BEGIN: changes alert_call to have the ability to send internal notifications (port from https://github.com/DopplerShift13/DopplerShift/pull/371)
/obj/item/modular_computer/proc/alert_call(datum/computer_file/program/call_source, alerttext, sound = 'sound/machines/beep/twobeep_high.ogg', internal = FALSE)
if(!call_source || !call_source.alert_able || call_source.alert_silenced || !alerttext) //Yeah, we're checking alert_able. No, you don't get to make alerts that the user can't silence.
return FALSE
playsound(src, sound, 50, TRUE)
physical.loc.visible_message(span_notice("[icon2html(physical, viewers(physical.loc))] \The [src] displays a [call_source.filedesc] notification: [alerttext]"))
if (!internal)
playsound(src, sound, 50, TRUE)
physical.loc.visible_message(span_notice("[icon2html(physical, viewers(physical.loc))] \The [src] displays a [call_source.filedesc] notification: [alerttext]"))
else
// internal notifications are a bit different: they're not outwardly broadcast to our loc surroundings
if (isliving(physical.loc))
var/mob/living/living_holder = physical.loc
to_chat(living_holder, span_notice("[icon2html(physical, viewers(physical.loc))] [alerttext]"))
living_holder.playsound_local(living_holder, sound, 50, TRUE)
// IRIS EDIT END

/obj/item/modular_computer/proc/ring(ringtone, list/balloon_alertees) // bring bring
if(!use_energy())
Expand Down
19 changes: 19 additions & 0 deletions code/modules/modular_computers/computers/item/computer_ui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,25 @@
//you can't close apps in emergency mode.
if(isnull(internal_cell) || internal_cell.charge)
active_program.kill_program(usr)
// IRIS EDIT ADDITION START - NTNRC_FOR_ALL (ported from https://github.com/DopplerShift13/DopplerShift/pull/205)
else // Slightly cursed code to let you swap between the chat client or messenger instead

if(istype(active_program, /datum/computer_file/program/chatclient))
var/datum/computer_file/program/messenger/our_messenger = locate() in stored_files
if(isnull(our_messenger))
return TRUE
open_program(usr, our_messenger)

else if(istype(active_program, /datum/computer_file/program/messenger))
var/datum/computer_file/program/chatclient/our_chat_client = locate() in stored_files
if(isnull(our_chat_client))
return TRUE
if(!get_ntnet_status()) // Can't swap to NTNRC without NTNet.
to_chat(usr, span_danger("\The [src]'s screen shows \"Unable to connect to NTNet. Please retry. If problem persists contact your system administrator.\" warning."))
return TRUE
open_program(usr, our_chat_client)

// IRIS EDIT ADDITION END - NTNRC_FOR_ALL
return TRUE
if("PC_shutdown")
shutdown_computer()
Expand Down
3 changes: 3 additions & 0 deletions code/modules/modular_computers/computers/item/pda.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
///Static list of default PDA apps to install on Initialize.
var/static/list/datum/computer_file/pda_programs = list(
/datum/computer_file/program/messenger,
/datum/computer_file/program/chatclient, // IRIS EDIT ADDITION - NTNRC_FOR_ALL (ported from https://github.com/DopplerShift13/DopplerShift/pull/205)
/datum/computer_file/program/nt_pay,
/datum/computer_file/program/notepad,
/datum/computer_file/program/crew_manifest,
Expand Down Expand Up @@ -324,6 +325,7 @@
has_pda_programs = FALSE
starting_programs = list(
/datum/computer_file/program/messenger,
/datum/computer_file/program/chatclient, // IRIS EDIT ADDITION - Chat client for AI
)

///Ref to the RoboTact app. Important enough to borgs to deserve a ref.
Expand All @@ -346,6 +348,7 @@
/datum/computer_file/program/atmosscan,
/datum/computer_file/program/crew_manifest,
/datum/computer_file/program/messenger, // NOVA EDIT ADDITION - Messenger for borgs
/datum/computer_file/program/chatclient, // IRIS EDIT ADDITION - Chat client for borgs
)

/obj/item/modular_computer/pda/silicon/Initialize(mapload)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@
channel.add_message(message, username)
var/mob/living/user = usr
user.log_talk(message, LOG_CHAT, tag = "as [username] to channel [channel.title]")
// IRIS ADDITION BEGIN: notification on NTNRC messages (port from https://github.com/DopplerShift13/DopplerShift/pull/371)
var/list/datum/computer_file/program/chatclient/clients_to_ping = list()
clients_to_ping += channel.active_clients
var/pretty_message = "\[[station_time_timestamp(format = "hh:mm")]\] <i>\[[LOWER_TEXT(channel.title)]\]</i> <b>[username]</b>: [message]"
for (var/datum/computer_file/program/chatclient/chatter in clients_to_ping)
if (chatter.computer)
chatter.computer.alert_call(src, pretty_message, sound = 'modular_iris/doppler_ports/chatroom_soul/sound/irc_chat_alert.ogg', internal = TRUE)
// IRIS ADDITION END
return TRUE
if("PRG_joinchannel")
var/new_target = text2num(params["id"])
Expand Down Expand Up @@ -160,6 +168,11 @@
if("PRG_setpassword")
if(!authed)
return
// IRIS EDIT ADDITION START - NTNRC_FOR_ALL (ported from https://github.com/DopplerShift13/DopplerShift/pull/205)
if(channel.strong) // Block setting passwords on important channels
computer.visible_message(span_warning("Warning. May not set a password on common channels."))
return
// IRIS EDIT ADDITION END - NTNRC_FOR_ALL
var/new_password = sanitize(params["new_password"])
if(!authed)
return
Expand Down
4 changes: 4 additions & 0 deletions code/modules/tgui_input/say_modal/speech.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
if(DO_CHANNEL)
client.mob.do_verb(entry)
// NOVA EDIT ADDITION END
// IRIS EDIT ADDITION START - NTNRC (ported from https://github.com/DopplerShift13/DopplerShift/pull/371)
if(IRC_CHANNEL)
client.mob.irc_verb(entry)
// IRIS EDIT ADDITION END
return FALSE

/**
Expand Down
12 changes: 12 additions & 0 deletions modular_iris/doppler_ports/chatroom_soul/code/chatroom_keybinds.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/datum/keybinding/client/communication/IRC
hotkey_keys = list("Shift;")
name = IRC_CHANNEL
full_name = "IRC"
keybind_signal = COMSIG_KB_CLIENT_IRC_DOWN

/datum/keybinding/client/communication/IRC/down(client/user)
. = ..()
if(.)
return
winset(user, null, "command=[user.tgui_say_create_open_command(IRC_CHANNEL)]")
return TRUE
57 changes: 57 additions & 0 deletions modular_iris/doppler_ports/chatroom_soul/code/irc_checks.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/mob/living/proc/irc_checks(message)
if(!length(message))
return FALSE

if(GLOB.say_disabled) //This is here to try to identify lag problems
to_chat(usr, span_danger("Speech is currently admin-disabled."))
return FALSE

//quickly calc our name stub again: duplicate this in say.dm override
var/name_stub = " (<b>[usr]</b>)"
if(length(message) > (MAX_MESSAGE_LEN - length(name_stub)))
to_chat(usr, message)
to_chat(usr, span_warning("^^^----- The preceding message has been DISCARDED for being over the maximum length of [MAX_MESSAGE_LEN]. It has NOT been sent! -----^^^"))
return FALSE

if(usr.stat != CONSCIOUS || usr.incapacitated)
to_chat(usr, span_notice("You cannot use your PDA in your current condition."))
return FALSE

// check to make sure we've actually got a modular computer on us and that it is like, usable
var/obj/item/modular_computer/our_computer
var/obj/item/modular_computer/holding_computer = usr.is_holding_item_of_type(/obj/item/modular_computer)
if (holding_computer)
our_computer = holding_computer
else
if (ishuman(usr))
var/mob/living/carbon/human/human_user = usr
if (istype(human_user.belt, /obj/item/modular_computer))
our_computer = human_user.belt
else if (istype(human_user.wear_id, /obj/item/modular_computer))
our_computer = human_user.wear_id
else if (issilicon(usr))
//really easy
var/mob/living/silicon/robor_user = usr
our_computer = robor_user.modularInterface

if (!our_computer)
to_chat(usr, span_notice("You need a PDA or another modular computer on you to use this!"))
return FALSE

if (!our_computer.enabled)
to_chat(usr, span_notice("Your PDA needs to be on to use this!"))
return FALSE

// is our chat client open or in idle threads?
var/capable = FALSE
if (istype(our_computer.active_program, /datum/computer_file/program/chatclient))
capable = TRUE

if (locate(/datum/computer_file/program/chatclient) in our_computer.idle_threads)
capable = TRUE

if (!capable)
to_chat(usr, span_notice("Your NTNRC app needs to be open or idling in the background to use this!"))
return FALSE

return our_computer
26 changes: 26 additions & 0 deletions modular_iris/doppler_ports/chatroom_soul/code/irc_verbs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/mob/verb/irc_verb(message as message)
set name = "IRC"
set category = "IC"
set instant = TRUE

if(GLOB.say_disabled)
to_chat(usr, span_danger("Speech is currently admin-disabled."))
return

if(message)
QUEUE_OR_CALL_VERB_FOR(VERB_CALLBACK(src, TYPE_VERB_REF(/mob/living, irc_actual_verb), message), SSspeech_controller)

/mob/living/verb/irc_actual_verb(message as message)
var/obj/item/modular_computer/our_computer = irc_checks(message) // yeah our check returns a modular computer object, so what, HUH???
if (!message || !our_computer)
return

if (!try_speak(message)) // ensure we pass the vibe check (filters, etc)
return

// we now have a modular computer and checks have promised us that it is a viable one, so use it
//get the program reference from stored files
var/datum/computer_file/program/chatclient/chat = locate() in our_computer.stored_files
// let's just flub a UI_act, janky but keeps it all contained (this probably will not work)
// really jank and we probably shouldn't do this (somehow it works)
chat.ui_act("PRG_speak", list("message" = message), null, null)
Binary file not shown.
30 changes: 30 additions & 0 deletions modular_iris/doppler_ports/ntnrc_for_all/code/ai_chat.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@


/// Conversation subtype that doesn't allow for the addition of any single operator. Netadmin mode can still override.
/datum/ntnet_conversation/ai

/// Override to make the AI an operator
/datum/ntnet_conversation/ai/changeop(datum/computer_file/program/chatclient/newop, silent = FALSE)
var/mob/living/silicon/ai/station_ai

for(var/mob/living/silicon/ai/ai_player in GLOB.alive_player_list)
if(!is_station_level(ai_player.z))
continue
station_ai = ai_player

if(!station_ai)
return // no one to pass operator to

var/obj/item/modular_computer/pda/silicon/ai_pda = station_ai.modularInterface
var/datum/computer_file/program/chatclient/ai_chat
for(var/datum/computer_file/program/chatclient/app_in_stored_files in ai_pda.stored_files)
ai_chat = app_in_stored_files

channel_operator = ai_chat
add_status_message("[ai_chat.username] is the station AI and channel operator.")

/// make the chat app update operators when a new AI is spawned
/datum/job/ai/after_spawn(mob/living/spawned, client/player_client)
. = ..()
var/datum/ntnet_conversation/ai_channel = SSmodular_computers.get_chat_channel_by_id(1) // the ai channel is loaded on ID '1'
ai_channel.changeop()
7 changes: 7 additions & 0 deletions modular_iris/doppler_ports/ntnrc_for_all/code/common_chat.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

/// Conversation subtype that doesn't allow for the addition of any single operator. Netadmin mode can still override.
/datum/ntnet_conversation/common

/// Override to block adding an operator.
/datum/ntnet_conversation/common/changeop(datum/computer_file/program/chatclient/newop, silent = FALSE)
return
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

/// Enables the chat client to run without using up power.
/datum/computer_file/program/chatclient
program_flags = PROGRAM_ON_NTNET_STORE | PROGRAM_REQUIRES_NTNET | PROGRAM_RUNS_WITHOUT_POWER
power_cell_use = 0

/datum/computer_file/program/chatclient/on_start(mob/living/user)
. = ..()
if(!.)
return

// If we're already in the common chat, start with it open.
if((src in SSmodular_computers.common_chat.active_clients) || (src in SSmodular_computers.common_chat.offline_clients))
active_channel = SSmodular_computers.common_chat.id
18 changes: 18 additions & 0 deletions modular_iris/doppler_ports/ntnrc_for_all/code/pda_prefs_edits.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

/// Apply our ntnrc client username prefs
/obj/item/modular_computer/pda/update_pda_prefs(client/owner_client)
. = ..()
if(isnull(owner_client))
return

var/datum/computer_file/program/chatclient/our_chat_client = locate() in stored_files
if(isnull(our_chat_client))
return

var/default_username = owner_client.prefs.read_preference(/datum/preference/name/ntnrc_username)
if(isnull(default_username))
return

our_chat_client.username = default_username
SSmodular_computers.common_chat.add_client(our_chat_client)
open_program(null, our_chat_client, FALSE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

/datum/controller/subsystem/modular_computers
/// Reference to the common chat used for all crew
var/datum/ntnet_conversation/ai/ai_chat
var/datum/ntnet_conversation/common/common_chat

/datum/controller/subsystem/modular_computers/Initialize()
. = ..()
ai_chat = new(title = NTNRC_AI_CHAT, strong = TRUE)
common_chat = new(title = NTNRC_COMMON_CHAT, strong = TRUE)
20 changes: 20 additions & 0 deletions modular_iris/doppler_ports/ntnrc_for_all/code/username_prefs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@


/// The username to default to for NTNRC
/datum/preference/name/ntnrc_username
explanation = NTRNC_USERNAME_PREF_NAME
group = "_usernames" // Underscore puts it high up, but below `_real_names`
savefile_key = "chat_client_username"


/datum/preference/name/ntnrc_username/create_default_value()
return pick(GLOB.hacker_aliases)

/datum/preference/name/ntnrc_username/is_valid(value)
return !isnull(permissive_sanitize_name(value))

/datum/preference/name/ntnrc_username/deserialize(input, datum/preferences/preferences)
return permissive_sanitize_name(input)

/datum/preference/name/ntnrc_username/serialize(input)
return permissive_sanitize_name(input)
28 changes: 28 additions & 0 deletions modular_iris/doppler_ports/ntnrc_for_all/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Title: NTNRC For All

MODULE ID: NTNRC_FOR_ALL

### Description:

Implements a general NTNRC channel every crewmember is added to by default, and related username pref.

### TG Proc Changes:

- `/datum/computer_file/program/chatclient/ui_act(...)` - Blocked passwords from being set on `strong` channels.
- `/obj/item/modular_computer/ui_act(...)` - Emergency mode exit program swaps between NTNRC and messenger.

### Defines:

- `code\__DEFINES\~iris_defines\ntnrc.dm`

### Master file additions

N/A

### Included files that are not contained in this module:

N/A

### Credits:

- Ephe
12 changes: 12 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,12 @@
#include "code\__DEFINES\~~iris_defines\hud.dm"
#include "code\__DEFINES\~~iris_defines\is_helpers.dm"
#include "code\__DEFINES\~~iris_defines\jobs.dm"
#include "code\__DEFINES\~~iris_defines\keybindings.dm"
#include "code\__DEFINES\~~iris_defines\logging.dm"
#include "code\__DEFINES\~~iris_defines\mobs.dm"
#include "code\__DEFINES\~~iris_defines\ntnrc.dm"
#include "code\__DEFINES\~~iris_defines\species_clothing_paths.dm"
#include "code\__DEFINES\~~iris_defines\speech_channels.dm"
#include "code\__DEFINES\~~iris_defines\_globalvars\cargo.dm"
#include "code\__DEFINES\~~iris_defines\dcs\signals\mob_holder_specials.dm"
#include "code\__DEFINES\~~iris_defines\dcs\signals\votes.dm"
Expand Down Expand Up @@ -6968,6 +6971,15 @@
#include "modular_iris\code\game\objects\items\storage\garment.dm"
#include "modular_iris\code\modules\clothing\suits\labcoat.dm"
#include "modular_iris\doppler_ports\autotransfer\shuttle.dm"
#include "modular_iris\doppler_ports\chatroom_soul\code\chatroom_keybinds.dm"
#include "modular_iris\doppler_ports\chatroom_soul\code\irc_checks.dm"
#include "modular_iris\doppler_ports\chatroom_soul\code\irc_verbs.dm"
#include "modular_iris\doppler_ports\ntnrc_for_all\code\ai_chat.dm"
#include "modular_iris\doppler_ports\ntnrc_for_all\code\common_chat.dm"
#include "modular_iris\doppler_ports\ntnrc_for_all\code\ntnrc_client_edits.dm"
#include "modular_iris\doppler_ports\ntnrc_for_all\code\pda_prefs_edits.dm"
#include "modular_iris\doppler_ports\ntnrc_for_all\code\ss_modular_computers_edits.dm"
#include "modular_iris\doppler_ports\ntnrc_for_all\code\username_prefs.dm"
#include "modular_iris\doppler_ports\quirks\undersized\gun.dm"
#include "modular_iris\doppler_ports\quirks\undersized\held_undersized_examine.dm"
#include "modular_iris\doppler_ports\quirks\undersized\held_undersized_id.dm"
Expand Down
3 changes: 3 additions & 0 deletions tgui/packages/tgui-say/ChannelIterator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ describe('ChannelIterator', () => {
expect(channelIterator.next()).toBe('LOOC');
expect(channelIterator.next()).toBe('Do');
// NOVA EDIT ADDITION END
// IRIS EDIT ADDITION START
expect(channelIterator.next()).toBe('IRC'); // ported from https://github.com/DopplerShift13/DopplerShift/pull/371
// IRIS EDIT ADDITION END
expect(channelIterator.next()).toBe('OOC');
expect(channelIterator.next()).toBe('Say'); // Admin is blacklisted so it should be skipped
});
Expand Down
Loading