Files
Bubberstation/code/modules/modular_computers/computers/item/computer_power.dm
SkyratBot 5afc46835b [MIRROR] Removes tablet cell parts [MDB IGNORE] (#17498)
* Removes tablet cell parts (#71078)

## About The Pull Request

Removes cell parts and cell part cells, now tablets directly stole a
power cell in them, and uses regular stock cells like every other
machine in the game. This also makes it less confusing because people
are more used to stock cells over computer cells. Because cells
generally hold more power than computer ones, I bumped up the active
power usage from 50 to 75.

## Why It's Good For The Game

We are nearly finished removing all parts, holy cr*p

## Changelog

🆑
balance: Tablets now use regular cells instead of computer cells.
balance: Tablets no longer need a power cell component to hold power
cells.
/🆑

* Removes tablet cell parts

* Feex

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
2022-11-16 08:14:17 -08:00

55 lines
1.8 KiB
Plaintext

// Tries to draw power from charger or, if no operational charger is present, from power cell.
/obj/item/modular_computer/proc/use_power(amount = 0)
if(check_power_override())
return TRUE
if(ismachinery(loc))
var/obj/machinery/machine_holder = loc
if(machine_holder.powered())
machine_holder.use_power(amount)
return TRUE
if(!internal_cell || !internal_cell.charge)
return FALSE
if(!internal_cell.use(amount JOULES))
internal_cell.use(min(amount JOULES, internal_cell.charge)) //drain it anyways.
return FALSE
return TRUE
/obj/item/modular_computer/proc/give_power(amount)
if(internal_cell)
return internal_cell.give(amount)
return 0
// Used in following function to reduce copypaste
/obj/item/modular_computer/proc/power_failure()
if(enabled) // Shut down the computer
if(active_program)
active_program.event_powerfailure(0)
for(var/datum/computer_file/program/programs as anything in idle_threads)
programs.event_powerfailure(background = TRUE)
shutdown_computer(0)
// Handles power-related things, such as battery interaction, recharging, shutdown when it's discharged
/obj/item/modular_computer/proc/handle_power(delta_time)
var/power_usage = screen_on ? base_active_power_usage : base_idle_power_usage
for(var/obj/item/computer_hardware/H in all_components)
if(H.enabled)
power_usage += H.power_usage
if(use_power(power_usage))
last_power_usage = power_usage
return TRUE
else
power_failure()
return FALSE
///Used by subtypes for special cases for power usage, returns TRUE if it should stop the use_power chain.
/obj/item/modular_computer/proc/check_power_override()
return FALSE
//Integrated (Silicon) tablets don't drain power, because the tablet is required to state laws, so it being disabled WILL cause problems.
/obj/item/modular_computer/tablet/integrated/check_power_override()
return TRUE