mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-21 06:25:59 +00:00
* PDA update (Messenger works while dead, Microwave works, etc). (#80069) This is an update that touches many more things all at once (compared to my other PRs) meant to make PDAs in general feel more consistent and not take away from one of the experiences we want to encourage: interaction between players. 1. Replaced all checks of a 'pda' with a 'modular pc'. This means technically (though not done in-game currently) other modpcs can hold an uplink, and microwaves can charge laptops. 2. Speaking of microwave, they now don't break and require deconstruction if the cell is removed mid-charge. 3. When a Mod PC is out of power, it will now allow the Messenger to work (which now also doesn't consume any additional power), if the app exists on the PC. Here's a video demonstration https://github.com/tgstation/tgstation/assets/53777086/7ae12f81-a271-49b8-95fa-2ba54d2e2d1f 4. Flashlights can't be turned on while the cell is dead 5. I replaced a bunch of program vars with ``program_flags`` and renamed ``usage_flags`` to ``can_run_on_flags``. 6. Added a debug modPC that has every app installed by default. Mafia had some issues in the past that were unknown because Mafia wasn't preinstalled with any tablet so was never in create & destroy nor in any other unit test. This was just an easy solution I had, but PDAs should get more in-depth unit tests in the future for running apps n stuff- I just wanted to make sure no other apps were broken/harddeling. Currently when a PDA dies, its only use is to reply to PDA messages sent to you, since you can still reply to them. Instead of just fixing it and telling players to cope, I thought it would be nice to allow PDA Messenger to still work, as it is a vital app. You can call it some emergency power mode or whatever, I don't really mind the reason behind why it is this way. When I made cells used more on PDAs, my main goal was to encourage upgrading your PDA and/or limiting how many apps you use at once, I did not want this to hit on players who use it as a form of interaction. This is the best of both worlds, I think. The rest of the changes is just for modularity, if some downstream wants to add tablets, phone computers, or whatever the hell else, they can still get just as far as PDAs should be able to get to, hopefully. 🆑 add: PDAs with a dead power cell are now limited to using their Messenger app. fix: Microwaves now stop charging PDAs if the cell was removed mid-charge. fix: Microwaves can now charge laptops. fix: PDA Flashlights can't be turned on while the PDA is dead. fix: You can now hold a laptop up to a camera (if it has a notekeeper app installed) like PDAs already could. /🆑 --------- Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com> * ok --------- Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
92 lines
3.3 KiB
Plaintext
92 lines
3.3 KiB
Plaintext
///The maximum amount of logs that can be generated before they start overwriting eachother.
|
|
#define MAX_LOG_COUNT 300
|
|
|
|
SUBSYSTEM_DEF(modular_computers)
|
|
name = "Modular Computers"
|
|
flags = SS_NO_FIRE
|
|
|
|
///List of all logs generated by ModPCs through the round.
|
|
///Stops at MAX_LOG_COUNT and must be purged to keep logging.
|
|
var/list/modpc_logs = list()
|
|
|
|
///List of all programs available to download from the NTNet store.
|
|
var/list/available_station_software = list()
|
|
///List of all programs that can be downloaded from an emagged NTNet store.
|
|
var/list/available_antag_software = list()
|
|
///List of all chat channels created by Chat Client.
|
|
var/list/chat_channels = list()
|
|
|
|
///Boolean on whether the IDS warning system is enabled
|
|
var/intrusion_detection_enabled = TRUE
|
|
///Boolean to show a message warning if there's an active intrusion for Wirecarp users.
|
|
var/intrusion_detection_alarm = FALSE
|
|
var/next_picture_id = 0
|
|
|
|
/datum/controller/subsystem/modular_computers/Initialize()
|
|
build_software_lists()
|
|
initialized = TRUE
|
|
return SS_INIT_SUCCESS
|
|
|
|
///Finds all downloadable programs and adds them to their respective downloadable list.
|
|
/datum/controller/subsystem/modular_computers/proc/build_software_lists()
|
|
for(var/datum/computer_file/program/prog as anything in subtypesof(/datum/computer_file/program))
|
|
// Has no TGUI file so is not meant to be a downloadable thing.
|
|
if(!initial(prog.tgui_id) || !initial(prog.filename))
|
|
continue
|
|
prog = new prog
|
|
|
|
if(prog.program_flags & PROGRAM_ON_NTNET_STORE)
|
|
available_station_software.Add(prog)
|
|
if(prog.program_flags & PROGRAM_ON_SYNDINET_STORE)
|
|
available_antag_software.Add(prog)
|
|
|
|
///Attempts to find a new file through searching the available stores with its name.
|
|
/datum/controller/subsystem/modular_computers/proc/find_ntnet_file_by_name(filename)
|
|
for(var/datum/computer_file/program/programs as anything in available_station_software + available_antag_software)
|
|
if(filename == programs.filename)
|
|
return programs
|
|
return null
|
|
|
|
///Attempts to find a chatorom using the ID of the channel.
|
|
/datum/controller/subsystem/modular_computers/proc/get_chat_channel_by_id(id)
|
|
for(var/datum/ntnet_conversation/chan as anything in chat_channels)
|
|
if(chan.id == id)
|
|
return chan
|
|
return null
|
|
|
|
/**
|
|
* Records a message into the station logging system for the network
|
|
* Arguments:
|
|
* * log_string - The message being logged
|
|
*/
|
|
/datum/controller/subsystem/modular_computers/proc/add_log(log_string)
|
|
var/list/log_text = list()
|
|
log_text += "\[[station_time_timestamp()]\]"
|
|
log_text += "*SYSTEM* - "
|
|
log_text += log_string
|
|
log_string = log_text.Join()
|
|
|
|
modpc_logs.Add(log_string)
|
|
|
|
// We have too many logs, remove the oldest entries until we get into the limit
|
|
if(modpc_logs.len > MAX_LOG_COUNT)
|
|
modpc_logs = modpc_logs.Copy(modpc_logs.len - MAX_LOG_COUNT, 0)
|
|
|
|
/**
|
|
* Removes all station logs and leaves it with an alert that it's been wiped.
|
|
*/
|
|
/datum/controller/subsystem/modular_computers/proc/purge_logs()
|
|
modpc_logs = list()
|
|
add_log("-!- LOGS DELETED BY SYSTEM OPERATOR -!-")
|
|
|
|
/**
|
|
* Returns a name which a /datum/picture can be assigned to.
|
|
* Use this function to get asset names and to avoid cache duplicates/overwriting.
|
|
*/
|
|
/datum/controller/subsystem/modular_computers/proc/get_next_picture_name()
|
|
var/next_uid = next_picture_id
|
|
next_picture_id++
|
|
return "ntos_picture_[next_uid].png"
|
|
|
|
#undef MAX_LOG_COUNT
|