Files
aedc5bae7a allowed is now signals based instead of hardcoded slots (#94871)
## About The Pull Request

ID cards/MMI mech access/simple mob access/pAIs now use signals instead
of checking specific slots with mob checks. We do this through mob's
``get_access`` proc that collects all access a mob has with a
collect_access signal.

## Why It's Good For The Game

It looks cleaner and we no longer individually check `check_access` for
every single item that may have access. It's cleaner to put it all
together and check in one go with all the access we've got. This also
makes it easier to add items that hold access that aren't necessarily
IDs but you want to be able to open stuff with.

## Changelog

🆑
refactor: ID checking for access has been reworked, please make a bug
report if anything that's supposed to grant access is not working.
/🆑

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
2026-01-16 14:16:22 -07:00

37 lines
1.1 KiB
Plaintext

///////////////////////
///// Power stuff /////
///////////////////////
/obj/vehicle/sealed/mecha/proc/has_charge(amount)
return (get_charge() >= amount)
/obj/vehicle/sealed/mecha/proc/get_charge()
return cell?.charge
/obj/vehicle/sealed/mecha/proc/use_energy(amount)
var/output = cell.use(amount)
if (output)
diag_hud_set_mechcell()
return output
/obj/vehicle/sealed/mecha/proc/give_power(amount)
if(!isnull(get_charge()))
cell.give(amount)
return TRUE
return FALSE
//////////////////////
///// Ammo stuff /////
//////////////////////
///Max the ammo stored in all ballistic weapons for this mech
/obj/vehicle/sealed/mecha/proc/max_ammo()
for(var/obj/item/I as anything in flat_equipment)
if(istype(I, /obj/item/mecha_parts/mecha_equipment/weapon/ballistic))
var/obj/item/mecha_parts/mecha_equipment/weapon/ballistic/gun = I
gun.projectiles_cache = gun.projectiles_cache_max
///Called when the mecha with an MMI in it tries opening a door.
/obj/vehicle/sealed/mecha/proc/retrieve_access(datum/source, list/player_access)
SIGNAL_HANDLER
player_access += accesses