# Request Emergency Temporary Access - RETA ![image](https://hackmd.io/_uploads/BkZPP2nKge.png) ## Summary Paramedics currently start with broad department access. This proposal replaces that by granting temporary department access only when an emergency is called. When a player presses "Call X" on a Requests Console, responders called receive temporary access to the common work areas of that department. They do not receive access to sub rooms or high risk areas. - Access lasts 5 minutes (configurable) - Access is removed when the timer expires or the emergency is resolved - No mapping changes are required (uses existing request consoles) - Removes their broad round start access but gives them external access to rescue bodies in space by default --- ## Problem Paramedics currently have broad access far beyond their role. This creates issues: - They can freely enter Cargo, Science, Mining, and other departments. - They overlap with other jobs by taking equipment or using consoles without permission. - They are disproportionately strong as antagonists because they can move almost anywhere. - Maps are not designed with the assumption that non-command staff have this much access. --- ## Alternatives Considered | Proposed | Issue | | -------- | -------- | | Keep current access | Preserves all of the problems | | Restrict paramedics to medical and maintenance | Prevents them from responding effectively to emergencies and punishes them | | Access key item | Still grants broad standing access once obtained, with little accountability and an item to be stolen | | Mapping changes | Rejected by maptainers as too costly and inconsistent | --- ## Proposed Fix: ![image](https://hackmd.io/_uploads/B1Eu9w0Yxe.png) Access is no longer given to paramedics at roundstart. Instead, they gain temporary tokens when a Request Console is used. ### How it Works - A crew member presses one of these buttons on a request console - "Call Medical" - "Call Security" - "Call Engineering" - The console sends the normal department-wide announcement. - Responders in that department receive a temporary access token for the general department flag. - The token lasts 5 minutes (configurable). - Repeat calls blocked instead of stacking or spammed. - Access is removed when the timer expires or the emergency is resolved. ### Example ![image](https://hackmd.io/_uploads/r1xNOv0Fle.png) ``` [Security] The Automated Announcement System coldly states, "SECURITY EMERGENCY in Research Lab! (Called by Sloan Keppel, Scientist) RETA door access granted to responders." [Science] The Automated Announcement System coldly states, "RETA activated (Called by Sloan Keppel, Scientist). Security personnel now have temporary access to your areas." ``` ### Granted vs Not Granted ![image](https://hackmd.io/_uploads/Hkbe6jnKel.png) | Department (call origin) | Granted | Not Granted | |---|---|---| | Engineering | `ACCESS_ENGINEERING`, `ACCESS_ATMOSPHERICS` | `ACCESS_CE`, `ACCESS_ATMOSPHERICS`, `ACCESS_ENGINE_EQUIP`, `ACCESS_EXTERNAL_AIRLOCKS`, `ACCESS_MINISAT`, `ACCESS_TCOMMS`, `ACCESS_TECH_STORAGE`, `ACCESS_CONSTRUCTION`, `ACCESS_EVA`, `ACCESS_KEYCARD_AUTH` | | Science | `ACCESS_SCIENCE` | `ACCESS_RD`, `ACCESS_GENETICS`, `ACCESS_XENOBIOLOGY`, `ACCESS_ROBOTICS`, `ACCESS_ORDNANCE`, `ACCESS_ORDNANCE_STORAGE`, `ACCESS_RESEARCH`, `ACCESS_MINISAT`, `ACCESS_TECH_STORAGE`, `ACCESS_AI_UPLOAD`, `ACCESS_TELEPORTER` | | Cargo | `ACCESS_CARGO` | `ACCESS_QM`, `ACCESS_SHIPPING`, `ACCESS_VAULT`, `ACCESS_AUX_BASE`, `ACCESS_MINING`, `ACCESS_MINING_STATION`, `ACCESS_MECH_MINING`, `ACCESS_BIT_DEN` | | Service | `ACCESS_SERVICE`, `ACCESS_KITCHEN`, `ACCESS_BAR`, `ACCESS_HYDROPONICS`, | `ACCESS_CHAPEL_OFFICE`, `ACCESS_LIBRARY`, `ACCESS_THEATRE`, `ACCESS_JANITOR` | | Medical | `ACCESS_MEDICAL`,`ACCESS_SURGERY` | `ACCESS_CMO`, `ACCESS_PHARMACY`, `ACCESS_VIROLOGY`, `ACCESS_PSYCHOLOGY`, `ACCESS_MORGUE_SECURE`, `ACCESS_PLUMBING`, `ACCESS_MECH_MEDICAL` | | Security | `ACCESS_SECURITY`, `ACCESS_BRIG`, `ACCESS_BRIG_ENTRANCE` | `ACCESS_HOS`, `ACCESS_ARMORY`, `ACCESS_WEAPONS`, `ACCESS_DETECTIVE`, `ACCESS_MECH_SECURITY`, `ACCESS_COURT`, `ACCESS_RC_ANNOUNCE` | | Mining | `ACCESS_MINING`, `ACCESS_MINING_STATION`, `ACCESS_CARGO` | `ACCESS_MECH_MINING`, `ACCESS_AUX_BASE`, `ACCESS_BIT_DEN` | | Command / Bridge | `ACCESS_COMMAND`, `ACCESS_BRIDGE`, (Admin Verb only!) | `ACCESS_CAPTAIN`, `ACCESS_RC_ANNOUNCE`, `ACCESS_KEYCARD_AUTH`, `ACCESS_TELEPORTER`, `ACCESS_AI_UPLOAD`, `ACCESS_GATEWAY` | --- ## Balance - A player or AI must press the request button for access to be granted. - Only public and work areas open, not private or high-risk areas. - Access is temporary and expires automatically. - No mapping work is needed. - Tokens are stored per mob and checked only when a door is used. Expiry is handled by timers, not polling. - Admins have a verb to trigger it with the ability to allow multiple departments to be added for fixing round issues or roleplay situations. --- ## Abuse Prevention - A department cannot call itself. - An engineer pressing "Call Engineering" from any department does not grant engineers any access. That engineer can still call Medical or Security. - Cooldown is department-wide. - Pressing one console stops that department’s button on all consoles in the same department with a cooldown. - Multiple calls within the cooldown refresh existing timers instead of stacking. - All calls are logged with the caller ID and job if known. Can monitor for misuse. --- ## Why This Works - Removes paramedics’ broad “Doctor+” access. - Keeps them effective as emergency responders. - Responders must be called in OR access upgraded. - Keeps sensitive areas secure. - Prevents spam or stacking through cooldown. - Scales across all maps without mapper work. --- ## For Changelog :cl: add: RETA System - Request Consoles give temporary access to responders when used for some areas. Paramedics lose broad access but get external space access. qol: Request consoles now show name and job role on call message & Cooldown on spamming calls admin: Gives admins "RETA door access" verb for giving department wide area access on maps. unit tests: RETA system validation checks to ensure works. logging: Seperate RETA log file for debugging and audits important things to game log as well config: New config settings for RETA /:cl: ## Wiki Documentation https://wiki.tgstation13.org/Guide_To_RETA ## Pull Request https://github.com/tgstation/tgstation/pull/92753 # Technical Nerdy Bits AKA how I went insane trying to make this... ## Key Features - **Automatic Access Granting**: Responders receive temporary access to emergency locations automatically - **Multi-Department Support**: Supports all major departments including Command (admin-only) - **Smart Access Control**: Grants only essential access, not full departmental permissions - **New Player Integration**: Automatically applies active grants to newly spawned players - **Radio Announcements**: Dual announcement system for both responders and calling departments - **Performance Optimized**: Efficient scanning of living players only - **Comprehensive Logging**: Separate RETA log file for detailed tracking ## How It Works ### Emergency Call Flow 1. **Emergency Trigger**: Request Console emergency call or admin manual trigger 2. **Department Detection**: System identifies calling department from console location 3. **Access Validation**: Prevents self-calls and checks cooldowns 4. **Responder Scanning**: Finds all living players with matching department job trims 5. **Access Granting**: Applies temporary access to responder ID cards 6. **Announcements**: Sends emergency alerts to responders and confirmations to callers 7. **Automatic Cleanup**: Access expires after configured duration (default: 5 minutes) ### Access Grant Mechanics - **Target-based**: Finds personnel in the responding department - **Origin-based**: Grants access to the calling department's areas - **Temporary**: Access automatically expires and is cleaned up - **Non-destructive**: Does not interfere with permanent access - **Persistent**: Active grants automatically apply to new ID cards ## System Constraints ### Usage Restrictions - **Living Players Only**: Only scans active, living players with clients - **Job Trim Matching**: Requires proper job assignment for department detection ### Request Console Limitations - **Location Dependent**: Console department determined by area name - **Limited Emergency Types**: Only Security, Engineering, and Medical emergencies - **Area Mapping Required**: Unmapped areas (like random maintenance) won't trigger RETA ## Configuration Add these entries to your `config.txt`: ```ini ## Enable the Request Emergency Temporary Access system RETA_ENABLED ## Duration in deciseconds for temporary access (default: 3000 = 5 minutes) RETA_DURATION_DS 3000 ## Cooldown in deciseconds between calls (default: 150 = 15 seconds) RETA_DEPT_COOLDOWN_DS 150 ``` ## Admin Interface For roleplay or debugging purposes, Admins have a shiny new tool! ### Manual RETA Trigger - **Location**: Admin Events category - **Verb**: "RETA Door Access" - **Functionality**: - Select calling department - Multi-select responding departments using interface - Bypasses cooldowns and console limitations - Includes Command (Bridge) department access - Logs to admin chat who dunnit and what they did, behave! | Which area needs help? | Which departments are going? | Temp access timer? | | -------- | -------- | -------- | | ![image](https://hackmd.io/_uploads/SkK4FPAYex.png)| ![image](https://hackmd.io/_uploads/S1GIYw0Klx.png)| ![image](https://hackmd.io/_uploads/rkFUKv0tee.png) | UI is tweaked further since those screenshots. ### Features - **Multi-Department Selection**: Can grant multiple departments access simultaneously - **Command Access**: Only available through admin interface - **Enhanced Announcements**: Uses "CENTCOM" caller identification - **Detailed Feedback**: Reports success/failure with responder counts ## Area Name Mapping The system maps area names to departments: | Area Name Contains | Maps to Department | | -------------------------------- | ------------------ | | "engineering", "engine" | Engineering | | "science", "research" | Science | | "cargo", "supply" | Cargo | | "mining", "mine" | Mining | | "service", "civilian", "library" | Service | | "medical", "medbay" | Medical | | "security", "sec" | Security | | "command", "bridge" | Command | **Unmapped areas** (like random maintenance rooms) will trigger emergency announcements but won't grant RETA access. ## Radio Announcements ### Emergency Alerts (to responders) **With Access Granted:** ``` "MEDICAL EMERGENCY in Mining! RETA door access granted to responders." ``` **Without Access Granted:** ``` "MEDICAL EMERGENCY in Bridge!" ``` ### Confirmation Messages (to calling department) ``` "RETA activated (Called by John Doe, Paramedic). Medical personnel now have temporary access to your areas." ``` ## Technical Implementation ### Core Files - **`code/modules/reta/reta_system.dm`** - Main system logic and department grants - **`code/modules/reta/reta_id_card.dm`** - ID card temporary access functionality - **`code/modules/reta/reta_debug.dm`** - Admin debug verbs and manual triggers - **`code/_globalvars/reta.dm`** - Global variable definitions - **`code/controllers/configuration/entries/reta.dm`** - Configuration system ### Integration Files (Modified) - **`code/game/machinery/requests_console.dm`** - Emergency call integration - **`code/game/objects/items/cards_ids.dm`** - Access system integration - **`code/datums/id_trim/jobs.dm`** - Paramedic access reduction ### Testing - **`code/modules/unit_tests/reta_system.dm`** - Unit tests yay ### Key Data Structures ```dm /// Global registry of currently active grants GLOBAL_LIST_EMPTY(reta_active_grants) /// Global department access definitions GLOBAL_LIST_EMPTY(reta_dept_grants) /// Global job trim mappings by department GLOBAL_LIST_EMPTY(reta_job_trims) ``` ## Logging ### Dedicated Log File All RETA activity is logged to a separate `reta.log` file for detailed tracking: ``` [2025-08-28 10:30:45] RETA: Engineering called Medical emergency, granted access to 3 responder IDs for 300 seconds [2025-08-28 10:30:45] RETA: Granted Medical access to ID 'John Doe (Paramedic)' for 300 seconds [2025-08-28 10:35:45] RETA: Cleaned up expired Medical grant for Engineering department ``` ### Debug Logging Set to DEBUG mode for detailed player scanning information: ``` [2025-08-28 10:30:45] RETA: DEBUG: Looking for Medical personnel with trims: [list of job trims] [2025-08-28 10:30:45] RETA: DEBUG: Found eligible Medical card: [card details] ``` ## Performance Considerations ### Optimizations - Living Players Only: Scans only alive, connected players - Efficient Scanning: O(n) where n = living players, not all entities - Lazy Evaluation: Skips processing when no active grants exist - Memory Management: Automatic cleanup of expired grants - No persistent storage requirements - No impact on existing access checking - - Minimal memory footprint ## Troubleshooting ### Common Issues **"No access granted" despite emergency call:** - Check if calling area maps to a department - Verify responders are alive and online - Confirm responders don't already have required access **Emergency announces access but no access granted:** - Request console in unmapped area - All eligible responders already have access - No personnel online in responding department **Admin manual trigger not working:** - Verify admin has R_ADMIN permissions - Check RETA system is enabled in config - Ensure department names match exactly - Ummmm, Pray for help? ## Potential Improvements - Request Console Integration: Add Command/Janitor emergency types - Area Detection: Improve unmapped area handling - Access Refinement: Granular access control per emergency type - Visual Indicators: Optional door highlighting - Integration: Hud or scanner emergency integration