#define COG_MAX_SIPHON_THRESHOLD 0.25 //The cog will not siphon power if the APC's cell is at this % of power
//Can be used on an open APC to replace its guts with clockwork variants, and begin passively siphoning power from it
/obj/item/clockwork/integration_cog
name = "integration cog"
desc = "A small cogwheel that fits in the palm of your hand."
clockwork_desc = "A small cogwheel that can be inserted into an open APC to siphon power from it passively.
\
It can be used on a locked APC to open its cover!
\
Siphons 5 W of power per second while in an APC."
icon_state = "wall_gear"
w_class = WEIGHT_CLASS_TINY
flags_1 = NOBLUDGEON_1
var/obj/machinery/power/apc/apc
/obj/item/clockwork/integration_cog/Initialize()
. = ..()
transform *= 0.5 //little cog!
/obj/item/clockwork/integration_cog/Destroy()
STOP_PROCESSING(SSfastprocess, src)
. = ..()
/obj/item/clockwork/integration_cog/process()
if(!apc)
if(istype(loc, /obj/machinery/power/apc))
apc = loc
else
STOP_PROCESSING(SSfastprocess, src)
else
var/obj/item/stock_parts/cell/cell = apc.cell
if(cell && (cell.charge / cell.maxcharge > COG_MAX_SIPHON_THRESHOLD))
cell.use(1)
adjust_clockwork_power(1) //Power is shared, so only do it once; this runs very quickly so it's about 1W/second
#undef COG_MAX_SIPHON_THRESHOLD