Files
7862b168a1 Fixing cell power usage (Part 1) (#82197)
## About The Pull Request
Yeah i am not about to create 30 different PR's to address 1 issue at a
time. The changes are small enough to be grouped together in bulk.

This fixes the following issues specified in #82196
- Borg & exosuit RCD (Fixes #82193)
- Motorized wheelchair
- Canister shielding
- Electrolyser
- Potato cell
- Space heater
- Microwave

## Changelog
🆑
fix: Fixed cell energy usage for a bunch of stuff(Part 1). See PR 82197
for details
/🆑

---------

Co-authored-by: Pickle-Coding <58013024+Pickle-Coding@users.noreply.github.com>
2024-03-25 17:24:21 +01:00

32 lines
903 B
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