Modular computers (PDAs) now shutdown when out of power (#96932)

## About The Pull Request

This PR refactors modular computers (PDAs) so that they actually respect
their power cells and shut down when they hit 0% charge.

Previously, PDA power mechanics were essentially non-functional. While
the flashlight would drain more power, it would never actually turn off
when the battery died. Additionally, there was broken code intended to
make the messenger program immune to power requirements. That immunity
code was so buggy that it made all the power mechanics get ignored.

To fix this, I gutted the broken immunity code. The marginal power draw
of the messenger program is so tiny that it doesn't need exceptions.
Now, when a modular computer runs out of power, everything, including
the flashlight, shuts off completely.

## Why It's Good For The Game

Right now, the power mechanics for modular computers are effectively
LARP that does nothing.

Players now have a tangible reason to conserve power and seek out
upgraded power cells if they plan on heavily utilizing their PDA's
features. It's balanced so that you'd have to be quite careless with the
flashlight to completely drain a standard battery. It adds consequence
without being overly punishing to the average crewmember.

## Changelog

🆑
balance: Modular computers (PDAs) now shutdown when out of power
fix: PDA flashlights now turn off when out of power
sound: Added a terminal off switch sound to PDAs when power runs out
/🆑
This commit is contained in:
Tim
2026-07-16 16:04:44 +02:00
committed by GitHub
parent 822c2c3985
commit 01534749dd
6 changed files with 7 additions and 17 deletions
@@ -87,8 +87,6 @@
* * background - Whether the app is running in the background.
*/
/datum/computer_file/program/proc/event_powerfailure()
if(program_flags & PROGRAM_RUNS_WITHOUT_POWER)
return
kill_program()
/**
@@ -8,7 +8,7 @@
/// (PROGRAM_ALL | PROGRAM_CONSOLE | PROGRAM_LAPTOP | PROGRAM_PDA)
var/can_run_on_flags = PROGRAM_ALL
/// Program-specific bitflags that tells the ModPC what the app is able to do special.
/// (PROGRAM_REQUIRES_NTNET|PROGRAM_ON_NTNET_STORE|PROGRAM_ON_SYNDINET_STORE|PROGRAM_UNIQUE_COPY|PROGRAM_HEADER|PROGRAM_RUNS_WITHOUT_POWER)
/// (PROGRAM_REQUIRES_NTNET|PROGRAM_ON_NTNET_STORE|PROGRAM_ON_SYNDINET_STORE|PROGRAM_UNIQUE_COPY|PROGRAM_HEADER)
var/program_flags = PROGRAM_ON_NTNET_STORE
///How much power running this program costs.
var/power_cell_use = PROGRAM_BASIC_CELL_USE
@@ -14,7 +14,7 @@
size = 0
undeletable = TRUE // It comes by default in tablets, can't be downloaded, takes no space and should obviously not be able to be deleted.
power_cell_use = NONE
program_flags = PROGRAM_HEADER | PROGRAM_RUNS_WITHOUT_POWER | PROGRAM_CIRCUITS_RUN_WHEN_CLOSED
program_flags = PROGRAM_HEADER | PROGRAM_CIRCUITS_RUN_WHEN_CLOSED
can_run_on_flags = PROGRAM_PDA
ui_header = "ntnrc_idle.gif"
tgui_id = "NtosMessenger"