From bb7a2c43a8ae9b1d5e7a38c44fda869d01582c69 Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Sun, 31 May 2020 20:23:57 +0200 Subject: [PATCH 1/5] First of many changes Adds the possibility for stationside clockwork obelisks to create stable gateways with unlimited uses, linking between the station and reebe. The gateway scripture no longer can teleport cultists from or to reebe. Spatial gateway from obelisks still works, but it is FAR less power efficient. These gateways are closed via either hitting them with a nullrod, destroying their obelisk, or a cultist initiating their close sequence via a 80ds doafter with the slab used on the gateway. --- .../clock_effects/spatial_gateway.dm | 61 +++++++++++++++++-- .../clock_structures/clockwork_obelisk.dm | 52 +++++++++++++++- 2 files changed, 106 insertions(+), 7 deletions(-) diff --git a/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm b/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm index 36aaa27716..1d27467ee6 100644 --- a/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm +++ b/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm @@ -14,6 +14,8 @@ var/uses = 1 //How many objects or mobs can go through the portal var/obj/effect/clockwork/spatial_gateway/linked_gateway //The gateway linked to this one var/timerid + var/is_stable = FALSE + var/busy = FALSE //If someone is already working on closing the gateway, only needed for stable gateways but in the parent to not need typecasting /obj/effect/clockwork/spatial_gateway/Initialize() . = ..() @@ -31,11 +33,16 @@ clockwork_desc = "A gateway in reality. It can both send and receive objects." else clockwork_desc = "A gateway in reality. It can only [sender ? "send" : "receive"] objects." - timerid = QDEL_IN(src, lifetime) + if(is_stable) + return + timerid = QDEL_IN(src, lifetime) //We only need this if the gateway is not stable //set up a gateway with another gateway /obj/effect/clockwork/spatial_gateway/proc/setup_gateway(obj/effect/clockwork/spatial_gateway/gatewayB, set_duration, set_uses, two_way) - if(!gatewayB || !set_duration || !uses) + if(!gatewayB) + return FALSE + + if((!set_duration || !uses) && !is_stable) return FALSE linked_gateway = gatewayB gatewayB.linked_gateway = src @@ -55,7 +62,7 @@ /obj/effect/clockwork/spatial_gateway/examine(mob/user) . = ..() if(is_servant_of_ratvar(user) || isobserver(user)) - . += "It has [uses] use\s remaining." + . += " [is_stable ? "It is stabilised and can be used as much as is neccessary." : "It has [uses] use\s remaining."]" //ATTACK GHOST IGNORING PARENT RETURN VALUE /obj/effect/clockwork/spatial_gateway/attack_ghost(mob/user) @@ -122,9 +129,9 @@ /obj/effect/clockwork/spatial_gateway/Bumped(atom/movable/AM) ..() if(!QDELETED(AM)) - pass_through_gateway(AM, FALSE) + pass_through_gateway(AM) -/obj/effect/clockwork/spatial_gateway/proc/pass_through_gateway(atom/movable/A, no_cost) +/obj/effect/clockwork/spatial_gateway/proc/pass_through_gateway(atom/movable/A, no_cost = FALSE) if(!linked_gateway) qdel(src) return FALSE @@ -198,6 +205,10 @@ return procure_gateway(invoker, time_duration, gateway_uses, two_way) var/istargetobelisk = istype(target, /obj/structure/destructible/clockwork/powered/clockwork_obelisk) var/issrcobelisk = istype(src, /obj/structure/destructible/clockwork/powered/clockwork_obelisk) + if(!issrcobelisk && target.z != invoker.z && (is_reebe(invoker.z) || is_reebe(target.z)) && !GLOB.ratvar_awakens) //You need obilisks to get from and to reebe. Costs alot of power, unless you use stable gateways. + to_chat(invoker, "The distance between reebe and the mortal realm is far too vast to bridge with a gateway your slab can create, my child. \ + Use an obilisk instead!") + return procure_gateway(invoker, time_duration, gateway_uses, two_way) if(issrcobelisk) if(!anchored) to_chat(invoker, "[src] is no longer secured!") @@ -227,3 +238,43 @@ S1.setup_gateway(S2, time_duration, gateway_uses, two_way) S2.visible_message("The air in front of [target] ripples before suddenly tearing open!") return TRUE + +//Stable Gateway: Used to travel to and from reebe without any further powercost. Needs a clockwork obilisk to keep active, but stays active as long as it is not deactivated via an null rod or a slab, or the obilisk is destroyed +/obj/effect/clockwork/spatial_gateway/stable + name = "stable gateway" + is_stable = TRUE + //TODO: Icon for the gateway that looks a bit different + +/obj/effect/clockwork/spatial_gateway/stable/ex_act(severity) + if(severity == 1) + start_shutdown() //Yes, you can chain devastation-level explosions to delay a gateway shutdown, if you somehow manage to do it without breaking the obelisk. Is it worth it? Probably not. + return TRUE + return FALSE + +/obj/effect/clockwork/spatial_gateway/stable/attackby(obj/item/I, mob/living/user, params) + if(!istype(I, /obj/item/clockwork/slab) || !is_servant_of_ratvar(user) || busy) + return ..() + user.visible_message("The rift begins to ripple as [user] points [user.p_their()] slab at it!", " You begin to shutdown the stabilised gateway with your slab.") + linked_gateway.visible_message("") + busy = TRUE + linked_gateway.busy = TRUE + if(do_after(user, 80, target = src)) //Eight seconds to initiate the closing, then another two before is closes. + to_chat(user, "You successfully set the gateway to shutdown in another two seconds.") + start_shutdown() + busy = FALSE + linked_gateway.busy = FALSE + return TRUE + //TODO: Add effect for this, maybe reuse the void blaster one from that PR? + +/obj/effect/clockwork/spatial_gateway/stable/proc/start_shutdown() + deltimer(timerid) + deltimer(linked_gateway.timerid) + timerid = QDEL_IN(src, 20) + linked_gateway.timerid = QDEL_IN(linked_gateway, 20) + animate(src, alpha = 0, transform = matrix()*2, time = 20, flags = ANIMATION_END_NOW) + animate(linked_gateway, alpha = 0, transform = matrix()*2, time = 20, flags = ANIMATION_END_NOW) + src.visible_message("[src] begins to destabilise!") + linked_gateway.visible_message("[linked_gateway] begins to destabilise!") + +/obj/effect/clockwork/spatial_gateway/stable/pass_through_gateway(atom/movable/A, no_cost = TRUE) + return ..() \ No newline at end of file diff --git a/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm b/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm index 058bd9d24e..09b716acfc 100644 --- a/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm +++ b/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm @@ -41,6 +41,11 @@ affected += try_use_power(MIN_CLOCKCULT_POWER*4) return affected +/obj/structure/destructible/clockwork/powered/clockwork_obelisk/Destroy() + for(var/obj/effect/clockwork/spatial_gateway/SG in loc) + SG.ex_act(EXPLODE_DEVASTATE) + return ..() + /obj/structure/destructible/clockwork/powered/clockwork_obelisk/attack_hand(mob/living/user) . = ..() if(.) @@ -48,7 +53,7 @@ if(!is_servant_of_ratvar(user) || !can_access_clockwork_power(src, hierophant_cost) || !anchored) to_chat(user, "You place your hand on [src], but it doesn't react.") return - var/choice = alert(user,"You place your hand on [src]...",,"Hierophant Broadcast","Spatial Gateway","Cancel") + var/choice = alert(user,"You place your hand on [src]...",,/*"Hierophant Broadcast",*/"Spatial Gateway","Stable Reebe Gateway","Cancel") //TODO: Find a good way to do this because choice does only support up to six args, not seven as needed switch(choice) if("Hierophant Broadcast") if(active) @@ -91,12 +96,32 @@ clockwork_say(user, text2ratvar("Spatial Gateway, activate!")) return adjust_clockwork_power(gateway_cost) //if we didn't return above, ie, successfully create a gateway, we give the power back + if("Stable Reebe Gateway") + if(active) + to_chat(user, "[src] is already sustaining a gateway!") + return + if(!user.can_speak_vocal()) + to_chat(user, "You need to be able to speak to open a stable gateway!") + return + if(is_reebe(z)) + to_chat(user, "You are already on reebe, child...") + return + if(!try_use_power(gateway_cost)) //Maybe set it a bit higher than a normal portal? Eh should be fine, balance will tell.. + to_chat(user, "[src] lacks the power to open a stable gateway!") + return + if(procure_reebe_gateway(user)) + process() + if(!active) + active = TRUE + clockwork_say(user, text2ratvar("Stable Gateway, activate!")) + return + adjust_clockwork_power(gateway_cost) //Same as before /obj/structure/destructible/clockwork/powered/clockwork_obelisk/process() if(!anchored) return var/obj/effect/clockwork/spatial_gateway/SG = locate(/obj/effect/clockwork/spatial_gateway) in loc - if(SG && SG.timerid) //it's a valid gateway, we're active + if(SG && (SG.timerid || SG.is_stable)) //it's a valid gateway, we're active icon_state = active_icon density = FALSE active = TRUE @@ -104,3 +129,26 @@ icon_state = inactive_icon density = TRUE active = FALSE + +//Special proc used for station-reebe stable gateways created by Obilisks on the station. Not done as subtype of the proc because it's quite a bit different.\ + Chooses one random non-active obilisk on reebe to link to. +/obj/structure/destructible/clockwork/powered/clockwork_obelisk/proc/procure_reebe_gateway(mob/living/user) + var/list/possible_reebe_obilisks = list() + for(var/obj/structure/destructible/clockwork/powered/clockwork_obelisk/O in GLOB.all_clockwork_objects) + if(is_reebe(O.z) && !O.active && O.anchored) + possible_reebe_obilisks += O + + if(!possible_reebe_obilisks.len) + to_chat(user, "There are no eligible Obilisks on reebe!") + return FALSE + var/obj/structure/destructible/clockwork/powered/clockwork_obelisk/target = pick(possible_reebe_obilisks) + + target.active = TRUE + src.active = TRUE + user.visible_message("The air in front of [user] ripples before suddenly tearing open!", \ + "With a word, you open a stable rift between reebe and the mortal realm.") + var/obj/effect/clockwork/spatial_gateway/stable/S1 = new(get_turf(src)) + var/obj/effect/clockwork/spatial_gateway/stable/S2 = new(get_turf(target)) + S1.setup_gateway(S2, 1, 1, TRUE) //The two 1s are irrelevant since it's a stable gateway + S2.visible_message("The air in front of [target] ripples before suddenly tearing open!") + return TRUE From b98f2532d52f024b4c3e7bf5247b6eaf52deaddb Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Sun, 31 May 2020 20:25:21 +0200 Subject: [PATCH 2/5] little thing --- .../antagonists/clockcult/clock_structures/clockwork_obelisk.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm b/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm index 09b716acfc..79d514799d 100644 --- a/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm +++ b/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm @@ -53,7 +53,7 @@ if(!is_servant_of_ratvar(user) || !can_access_clockwork_power(src, hierophant_cost) || !anchored) to_chat(user, "You place your hand on [src], but it doesn't react.") return - var/choice = alert(user,"You place your hand on [src]...",,/*"Hierophant Broadcast",*/"Spatial Gateway","Stable Reebe Gateway","Cancel") //TODO: Find a good way to do this because choice does only support up to six args, not seven as needed + var/choice = alert(user,"You place your hand on [src]...",,/*"Hierophant Broadcast",*/"Spatial Gateway","Stable Reebe Gateway","Cancel") //TODO: Find a good way to do this because choice / alert does only support up to six args, not seven as needed switch(choice) if("Hierophant Broadcast") if(active) From 0b0fbc1272dab22fd49c3b538e229d69e6382193 Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Sun, 12 Jul 2020 18:36:59 +0200 Subject: [PATCH 3/5] Updates stable gateways Changes some stuff around, makes gateways automatically stable if they are a reebe-station obelisk-obelisk gateway --- .../clock_effects/spatial_gateway.dm | 26 ++++++++--- .../clock_structures/clockwork_obelisk.dm | 45 +------------------ 2 files changed, 20 insertions(+), 51 deletions(-) diff --git a/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm b/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm index 1d27467ee6..32436133cd 100644 --- a/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm +++ b/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm @@ -229,14 +229,22 @@ gateway_uses = round(gateway_uses * (2 * efficiency), 1) time_duration = round(time_duration * (2 * efficiency), 1) CO.active = TRUE //you'd be active in a second but you should update immediately - invoker.visible_message("The air in front of [invoker] ripples before suddenly tearing open!", \ - "With a word, you rip open a [two_way ? "two-way":"one-way"] rift to [input_target_key]. It will last for [DisplayTimeText(time_duration)] and has [gateway_uses] use[gateway_uses > 1 ? "s" : ""].") - var/obj/effect/clockwork/spatial_gateway/S1 = new(issrcobelisk ? get_turf(src) : get_step(get_turf(invoker), invoker.dir)) - var/obj/effect/clockwork/spatial_gateway/S2 = new(istargetobelisk ? get_turf(target) : get_step(get_turf(target), target.dir)) + if(issrcobelisk && istargetobelisk && src.z != target.z && (is_reebe(src.z) || is_reebe(target.z))) + invoker.visible_message("The air in front of [invoker] ripples before suddenly tearing open!", \ + "With a word, you rip open a stable two-way rift between reebe and the mortal realm.") + var/obj/effect/clockwork/spatial_gateway/stable/stable_S1 = new(get_turf(src)) + var/obj/effect/clockwork/spatial_gateway/stable/stable_S2 = new(get_turf(target)) + stable_S1.setup_gateway(stable_S2) + stable_S2.visible_message("The air in front of [target] ripples before suddenly tearing open!") + else + invoker.visible_message("The air in front of [invoker] ripples before suddenly tearing open!", \ + "With a word, you rip open a [two_way ? "two-way":"one-way"] rift to [input_target_key]. It will last for [DisplayTimeText(time_duration)] and has [gateway_uses] use[gateway_uses > 1 ? "s" : ""].") + var/obj/effect/clockwork/spatial_gateway/S1 = new(issrcobelisk ? get_turf(src) : get_step(get_turf(invoker), invoker.dir)) + var/obj/effect/clockwork/spatial_gateway/S2 = new(istargetobelisk ? get_turf(target) : get_step(get_turf(target), target.dir)) - //Set up the portals now that they've spawned - S1.setup_gateway(S2, time_duration, gateway_uses, two_way) - S2.visible_message("The air in front of [target] ripples before suddenly tearing open!") + //Set up the portals now that they've spawned + S1.setup_gateway(S2, time_duration, gateway_uses, two_way) + S2.visible_message("The air in front of [target] ripples before suddenly tearing open!") return TRUE //Stable Gateway: Used to travel to and from reebe without any further powercost. Needs a clockwork obilisk to keep active, but stays active as long as it is not deactivated via an null rod or a slab, or the obilisk is destroyed @@ -251,6 +259,9 @@ return TRUE return FALSE +/obj/effect/clockwork/spatial_gateway/stable/setup_gateway(/obj/effect/clockwork/spatial_gateway/stable/gatewayB, set_duration = 1, set_uses = 1, two_way = TRUE) //Reduced setup call due to some things being irrelevant for stable gateways + return ..() + /obj/effect/clockwork/spatial_gateway/stable/attackby(obj/item/I, mob/living/user, params) if(!istype(I, /obj/item/clockwork/slab) || !is_servant_of_ratvar(user) || busy) return ..() @@ -266,6 +277,7 @@ return TRUE //TODO: Add effect for this, maybe reuse the void blaster one from that PR? + /obj/effect/clockwork/spatial_gateway/stable/proc/start_shutdown() deltimer(timerid) deltimer(linked_gateway.timerid) diff --git a/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm b/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm index 79d514799d..d9c3b047ca 100644 --- a/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm +++ b/code/modules/antagonists/clockcult/clock_structures/clockwork_obelisk.dm @@ -53,7 +53,7 @@ if(!is_servant_of_ratvar(user) || !can_access_clockwork_power(src, hierophant_cost) || !anchored) to_chat(user, "You place your hand on [src], but it doesn't react.") return - var/choice = alert(user,"You place your hand on [src]...",,/*"Hierophant Broadcast",*/"Spatial Gateway","Stable Reebe Gateway","Cancel") //TODO: Find a good way to do this because choice / alert does only support up to six args, not seven as needed + var/choice = alert(user,"You place your hand on [src]...",,"Hierophant Broadcast","Spatial Gateway","Cancel") //TODO: Find a good way to do this because choice / alert does only support up to six args, not seven as needed switch(choice) if("Hierophant Broadcast") if(active) @@ -96,26 +96,6 @@ clockwork_say(user, text2ratvar("Spatial Gateway, activate!")) return adjust_clockwork_power(gateway_cost) //if we didn't return above, ie, successfully create a gateway, we give the power back - if("Stable Reebe Gateway") - if(active) - to_chat(user, "[src] is already sustaining a gateway!") - return - if(!user.can_speak_vocal()) - to_chat(user, "You need to be able to speak to open a stable gateway!") - return - if(is_reebe(z)) - to_chat(user, "You are already on reebe, child...") - return - if(!try_use_power(gateway_cost)) //Maybe set it a bit higher than a normal portal? Eh should be fine, balance will tell.. - to_chat(user, "[src] lacks the power to open a stable gateway!") - return - if(procure_reebe_gateway(user)) - process() - if(!active) - active = TRUE - clockwork_say(user, text2ratvar("Stable Gateway, activate!")) - return - adjust_clockwork_power(gateway_cost) //Same as before /obj/structure/destructible/clockwork/powered/clockwork_obelisk/process() if(!anchored) @@ -129,26 +109,3 @@ icon_state = inactive_icon density = TRUE active = FALSE - -//Special proc used for station-reebe stable gateways created by Obilisks on the station. Not done as subtype of the proc because it's quite a bit different.\ - Chooses one random non-active obilisk on reebe to link to. -/obj/structure/destructible/clockwork/powered/clockwork_obelisk/proc/procure_reebe_gateway(mob/living/user) - var/list/possible_reebe_obilisks = list() - for(var/obj/structure/destructible/clockwork/powered/clockwork_obelisk/O in GLOB.all_clockwork_objects) - if(is_reebe(O.z) && !O.active && O.anchored) - possible_reebe_obilisks += O - - if(!possible_reebe_obilisks.len) - to_chat(user, "There are no eligible Obilisks on reebe!") - return FALSE - var/obj/structure/destructible/clockwork/powered/clockwork_obelisk/target = pick(possible_reebe_obilisks) - - target.active = TRUE - src.active = TRUE - user.visible_message("The air in front of [user] ripples before suddenly tearing open!", \ - "With a word, you open a stable rift between reebe and the mortal realm.") - var/obj/effect/clockwork/spatial_gateway/stable/S1 = new(get_turf(src)) - var/obj/effect/clockwork/spatial_gateway/stable/S2 = new(get_turf(target)) - S1.setup_gateway(S2, 1, 1, TRUE) //The two 1s are irrelevant since it's a stable gateway - S2.visible_message("The air in front of [target] ripples before suddenly tearing open!") - return TRUE From c6ea2981f4a6424e3398008b907d35a7b5556170 Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Sun, 12 Jul 2020 18:57:47 +0200 Subject: [PATCH 4/5] oop --- .../antagonists/clockcult/clock_effects/spatial_gateway.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm b/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm index 32436133cd..293625d9a7 100644 --- a/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm +++ b/code/modules/antagonists/clockcult/clock_effects/spatial_gateway.dm @@ -259,8 +259,8 @@ return TRUE return FALSE -/obj/effect/clockwork/spatial_gateway/stable/setup_gateway(/obj/effect/clockwork/spatial_gateway/stable/gatewayB, set_duration = 1, set_uses = 1, two_way = TRUE) //Reduced setup call due to some things being irrelevant for stable gateways - return ..() +/obj/effect/clockwork/spatial_gateway/stable/setup_gateway(obj/effect/clockwork/spatial_gateway/stable/gatewayB) //Reduced setup call due to some things being irrelevant for stable gateways + return ..(gatewayB, 1, 1, TRUE) //Uses and time irrelevant due to is_stable /obj/effect/clockwork/spatial_gateway/stable/attackby(obj/item/I, mob/living/user, params) if(!istype(I, /obj/item/clockwork/slab) || !is_servant_of_ratvar(user) || busy) From 8f1e19150097b8a00e5d3226551f2b02a5896043 Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Tue, 14 Jul 2020 00:39:21 +0200 Subject: [PATCH 5/5] stealthy cogging APC locks after cogging, drain gets averted by prioritized powerallocation --- .../clockcult/clock_items/integration_cog.dm | 1 + code/modules/power/apc.dm | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/code/modules/antagonists/clockcult/clock_items/integration_cog.dm b/code/modules/antagonists/clockcult/clock_items/integration_cog.dm index 0ce70336fe..ab8e30c8bb 100644 --- a/code/modules/antagonists/clockcult/clock_items/integration_cog.dm +++ b/code/modules/antagonists/clockcult/clock_items/integration_cog.dm @@ -30,6 +30,7 @@ var/obj/item/stock_parts/cell/cell = apc.cell if(cell && (cell.charge / cell.maxcharge > COG_MAX_SIPHON_THRESHOLD)) cell.use(1) + apc.cog_drained++ adjust_clockwork_power(2) //Power is shared, so only do it once; this runs very quickly so it's about 10 W/second else adjust_clockwork_power(1) //Continue generating power when the cell has run dry; 5 W/second diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index dc091cb451..36330ad92e 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -38,6 +38,8 @@ #define APC_CHARGING 1 #define APC_FULLY_CHARGED 2 +#define MAXIMUM_COG_REGAIN 100 //How much charge drained by an integration cog can be priority-recharged in one processing-tick + // the Area Power Controller (APC), formerly Power Distribution Unit (PDU) // one per area, needs wire connection to power network through a terminal @@ -94,6 +96,7 @@ var/mob/living/silicon/ai/occupier = null var/transfer_in_progress = FALSE //Is there an AI being transferred out of us? var/obj/item/clockwork/integration_cog/integration_cog //Is there a cog siphoning power? + var/cog_drained = 0 //How much of the cell's charge was drained by an integration cog, recovering this amount takes priority over the normal APC cell recharge calculations, but comes after powering Essentials. var/longtermpower = 10 var/auto_name = 0 var/failure_timer = 0 @@ -499,6 +502,7 @@ cell.forceMove(T) cell.update_icon() cell = null + cog_drained = 0 //No more cell means no more averting celldrain charging = APC_NOT_CHARGING update_icon() return @@ -701,7 +705,7 @@ START_PROCESSING(SSfastprocess, W) playsound(src, 'sound/machines/clockcult/steam_whoosh.ogg', 50, FALSE) opened = APC_COVER_CLOSED - locked = FALSE + locked = TRUE //Clockies get full APC access on cogged APCs, but they can't lock or unlock em unless they steal some ID to give all of them APC access, soo this is pretty much just QoL for them and makes cogs a tiny bit more stealthy update_icon() return else if(panel_open && !opened && is_wire_tool(W)) @@ -1314,6 +1318,11 @@ cur_used -= lastused_light lighting_satisfied = TRUE + //If drained by an integration cog: Forcefully avert as much of the powerdrain as possible, though a maximum of MAXIMUM_COG_REGAIN + if(cur_excess && cog_drained && cell) + var/cog_regain = cell.give(min(min(cog_drained, cur_excess), MAXIMUM_COG_REGAIN)) + cur_excess -= cog_regain + cog_drained = max(0, cog_drained - cog_regain) // next: take from or charge to the cell, depending on how much is left if(cell && !shorted) @@ -1576,6 +1585,8 @@ #undef APC_UPOVERLAY_LOCKED #undef APC_UPOVERLAY_OPERATING +#undef MAXIMUM_COG_REGAIN + /*Power module, used for APC construction*/ /obj/item/electronics/apc name = "power control module"