Adds a new power storage type: The Megacell. Drastically reduces power cell consumption/storage. [MDB Ignore] (#84079)

## About The Pull Request
As the title says. A standard power cell now only stores 10 KJ and
drains power similar to how it did before the refactor to all power
appliances.

The new standard megacell stock part stores 1 MJ (what cells store right
now). APCs and SMESs have had their power cells replaced with these
megacell stock parts instead. Megacells can only be used in APCs and
SMESs. It shouldn't be possible to use megacells in any typical
appliance.

This shouldn't change anything about how much 'use' you can get out of a
power cell in regular practice. Most should operate the same and you
should still get the same amount of shots out of a laser gun, and we can
look at expanding what can be switched over to megacells, e.g. if we
want mechs to require significantly more power than a typical appliance.

Thanks to Meyhazah for the megacell icon sprites.

## Why It's Good For The Game
Power cell consumption is way too high ever since the power appliance
refactor that converted most things to be in joules. It's a bit
ridiculous for most of our machinery to drain the station's power supply
this early on.

The reason it's like this is because regular appliances (laser guns,
borgs, lights) all have a cell type that is identical to the APC/SMES
cell type. And it means that if we want to provide an easy way to charge
these appliances without making it easy to charge APCs/SMESs through a
power bug exploit, we need to introduce a new cell type to differentiate
between what supplies power and regular appliances that use power. This
is primarily what the megacell stock part does.

This moves us back to what it was originally like before the power
refactor, where recharging power cells wouldn't drain an exorbitant
amount of energy. However, it maintains the goal of the original
refactor which was to prevent people from cheesing power generation to
produce an infinite amount of power, as the power that APCs and SMESs
operate at is drastically different from the power that a regular
appliance uses.

## Changelog
🆑 Watermelon, Mayhazah
balance: Drastically reduces the power consumption and max charge of
power cells
balance: Added a new stock part called the battery, used primarily in
the construction of APCs and SMESs.
add: Suiciding with a cell/battery will shock you and potentially dust
you/shock the people around you if the charge is great enough.
/🆑

---------

Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
Co-authored-by: Pickle-Coding <58013024+Pickle-Coding@users.noreply.github.com>
This commit is contained in:
Watermelon914
2024-06-25 00:32:19 +00:00
committed by GitHub
parent f2ff72340b
commit 0db2a23faf
194 changed files with 3771 additions and 3566 deletions

View File

@@ -19,7 +19,7 @@
///The disk in this PDA. If set, this will be inserted on Initialize.
var/obj/item/computer_disk/inserted_disk
///The power cell the computer uses to run on.
var/obj/item/stock_parts/cell/internal_cell = /obj/item/stock_parts/cell
var/obj/item/stock_parts/power_store/internal_cell = /obj/item/stock_parts/power_store/cell
///A pAI currently loaded into the modular computer.
var/obj/item/pai_card/inserted_pai
///Does the console update the crew manifest when the ID is removed?
@@ -75,9 +75,9 @@
var/comp_light_color = COLOR_WHITE
///Power usage when the computer is open (screen is active) and can be interacted with.
var/base_active_power_usage = 125
var/base_active_power_usage = 2 WATTS
///Power usage when the computer is idle and screen is off.
var/base_idle_power_usage = 5
var/base_idle_power_usage = 1 WATTS
// Modular computers can run on various devices. Each DEVICE (Laptop, Console & Tablet)
// must have it's own DMI file. Icon states must be called exactly the same in all files, but may look differently
@@ -831,7 +831,7 @@
if(istype(tool, /obj/item/pai_card))
return pai_act(user, tool)
if(istype(tool, /obj/item/stock_parts/cell))
if(istype(tool, /obj/item/stock_parts/power_store/cell))
return cell_act(user, tool)
if(istype(tool, /obj/item/photo))
@@ -871,7 +871,7 @@
update_appearance(UPDATE_ICON)
return ITEM_INTERACT_SUCCESS
/obj/item/modular_computer/proc/cell_act(mob/user, obj/item/stock_parts/cell/new_cell)
/obj/item/modular_computer/proc/cell_act(mob/user, obj/item/stock_parts/power_store/cell/new_cell)
if(ismachinery(physical))
return ITEM_INTERACT_BLOCKING
if(internal_cell)

View File

@@ -8,7 +8,7 @@
icon_state_unpowered = null
icon_state_menu = null
hardware_flag = NONE
internal_cell = /obj/item/stock_parts/cell/crap
internal_cell = /obj/item/stock_parts/power_store/cell/crap
///The modular computer MACHINE that hosts us.
var/obj/machinery/modular_computer/machinery_computer

View File

@@ -137,7 +137,7 @@
///Try to recharge our internal cell if it isn't fully charged.
/obj/machinery/modular_computer/process(seconds_per_tick)
var/obj/item/stock_parts/cell/cell = get_cell()
var/obj/item/stock_parts/power_store/cell = get_cell()
if(isnull(cell) || cell.percent() >= 100)
return
charge_cell(idle_power_usage * seconds_per_tick, cell)