mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 00:27:31 +01:00
Renames vars on pdas and removes ntnet_relays glob (#79595)
## About The Pull Request - replaces the ntnet_relays global list with ``get_machines_by_type`` - renames ``transfer_access`` var on PDA to ``download_access`` & ``required_access`` to ``run_access`` to better describe what they do, because on more than one ocassion I've confused myself with the two terms and ended up doing something unintentional (see: https://github.com/tgstation/tgstation/pull/74269) ## Why It's Good For The Game Kills a useless global list and makes pda code a little less confusing. ## Changelog Nothing player-facing.
This commit is contained in:
@@ -9,10 +9,11 @@
|
||||
|
||||
///How much power running this program costs.
|
||||
var/power_cell_use = PROGRAM_BASIC_CELL_USE
|
||||
/// List of required accesses to *run* the program. Any match will do.
|
||||
var/list/required_access = list()
|
||||
/// List of required access to download or file host the program. Any match will do.
|
||||
var/list/transfer_access = list()
|
||||
///List of required accesses to *run* the program. Any match will do.
|
||||
///This also acts as download_access if that is not set, making this more draconic and restrictive.
|
||||
var/list/run_access = list()
|
||||
///List of required access to download or file host the program. Any match will do.
|
||||
var/list/download_access = list()
|
||||
/// User-friendly name of this program.
|
||||
var/filedesc = "Unknown Program"
|
||||
/// Short description of this program's function.
|
||||
@@ -52,7 +53,7 @@
|
||||
|
||||
/datum/computer_file/program/clone()
|
||||
var/datum/computer_file/program/temp = ..()
|
||||
temp.required_access = required_access
|
||||
temp.run_access = run_access
|
||||
temp.filedesc = filedesc
|
||||
temp.program_icon_state = program_icon_state
|
||||
temp.requires_ntnet = requires_ntnet
|
||||
@@ -115,33 +116,32 @@
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
*Check if the user can run program. Only humans and silicons can operate computer. Automatically called in on_start()
|
||||
*ID must be inserted into a card slot to be read. If the program is not currently installed (as is the case when
|
||||
*NT Software Hub is checking available software), a list can be given to be used instead.
|
||||
*Arguments:
|
||||
*user is a ref of the mob using the device.
|
||||
*loud is a bool deciding if this proc should use to_chats
|
||||
*access_to_check is an access level that will be checked against the ID
|
||||
*transfer, if TRUE and access_to_check is null, will tell this proc to use the program's transfer_access in place of access_to_check
|
||||
*access can contain a list of access numbers to check against. If access is not empty, it will be used istead of checking any inserted ID.
|
||||
*/
|
||||
/datum/computer_file/program/proc/can_run(mob/user, loud = FALSE, access_to_check, transfer = FALSE, list/access)
|
||||
* Checks if the user can run program. Only humans and silicons can operate computer. Automatically called in on_start()
|
||||
* ID must be inserted into a card slot to be read. If the program is not currently installed (as is the case when
|
||||
* NT Software Hub is checking available software), a list can be given to be used instead.
|
||||
* Args:
|
||||
* user is a ref of the mob using the device.
|
||||
* loud is a bool deciding if this proc should use to_chats
|
||||
* access_to_check is an access level that will be checked against the ID
|
||||
* downloading: Boolean on whether it's downloading the app or not. If it is, it will check download_access instead of run_access.
|
||||
* access can contain a list of access numbers to check against. If access is not empty, it will be used istead of checking any inserted ID.
|
||||
*/
|
||||
/datum/computer_file/program/proc/can_run(mob/user, loud = FALSE, access_to_check, downloading = FALSE, list/access)
|
||||
if(issilicon(user) && !ispAI(user))
|
||||
return TRUE
|
||||
|
||||
if(isAdminGhostAI(user))
|
||||
return TRUE
|
||||
|
||||
if(computer && (computer.obj_flags & EMAGGED) && (available_on_syndinet || !transfer)) //emagged can run anything on syndinet, and can bypass execution locks, but not download.
|
||||
if(computer && (computer.obj_flags & EMAGGED) && (available_on_syndinet || !downloading)) //emagged can run anything on syndinet, and can bypass execution locks, but not download.
|
||||
return TRUE
|
||||
|
||||
// Defaults to required_access
|
||||
if(!access_to_check)
|
||||
if(transfer && length(transfer_access))
|
||||
access_to_check = transfer_access
|
||||
if(downloading && length(download_access))
|
||||
access_to_check = download_access
|
||||
else
|
||||
access_to_check = required_access
|
||||
if(!length(access_to_check)) // No required_access, allow it.
|
||||
access_to_check = run_access
|
||||
if(!length(access_to_check)) // No access requirements, allow it.
|
||||
return TRUE
|
||||
|
||||
if(!length(access))
|
||||
|
||||
Reference in New Issue
Block a user