Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yautja Bracer Charging Rework #3456

Merged
merged 13 commits into from
Jul 24, 2023
30 changes: 26 additions & 4 deletions code/modules/cm_preds/yaut_bracers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
var/notification_sound = TRUE // Whether the bracer pings when a message comes or not
var/charge = 1500
var/charge_max = 1500
/// The amount charged per process
var/charge_rate = 30
/// Cooldown on draining power from APC
var/charge_cooldown = 3 MINUTES
/// Worldtime of last recharge
var/last_charge
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
var/cloaked = 0
var/cloak_timer = 0
var/cloak_malfunction = 0
Expand Down Expand Up @@ -75,11 +81,27 @@
if(!ishuman(loc))
STOP_PROCESSING(SSobj, src)
return
var/mob/living/carbon/human/H = loc
var/mob/living/carbon/human/hooman = loc
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved

charge = min(charge + 30, charge_max)
var/perc_charge = (charge / charge_max * 100)
H.update_power_display(perc_charge)
if(charge < charge_max)
var/charge_increase = charge_rate
if(is_ground_level(hooman.z))
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
charge_increase = charge_rate / 6
else if(is_mainship_level(hooman.z))
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
charge_increase = charge_rate / 3

charge = min(charge + charge_increase, charge_max)
var/perc_charge = (charge / charge_max * 100)
hooman.update_power_display(perc_charge)
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved

//Non-Yautja have a chance to get stunned with each power drain
harryob marked this conversation as resolved.
Show resolved Hide resolved
if(cloaked)
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
if(!HAS_TRAIT(hooman, TRAIT_YAUTJA_TECH) && !hooman.hunter_data.thralled)
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
if(prob(15))
decloak(hooman)
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
shock_user(hooman)
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
if(hooman.stat == DEAD)
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
decloak(hooman, TRUE)
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved

/// handles decloaking only on HUNTER gloves
/obj/item/clothing/gloves/yautja/proc/decloak()
Expand Down
120 changes: 83 additions & 37 deletions code/modules/power/apc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,9 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list(
var/turf/T = get_turf(src)
var/obj/structure/cable/N = T.get_cable_node()
if(prob(50) && electrocute_mob(usr, N, N))
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(5, 1, src)
s.start()
var/datum/effect_system/spark_spread/spark = new /datum/effect_system/spark_spread
spark.set_up(5, 1, src)
spark.start()
return
if(C.use(10))
user.visible_message(SPAN_NOTICE("[user] wires [src]'s frame."),
Expand All @@ -700,9 +700,9 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list(
to_chat(user, SPAN_WARNING("\The [src] lacks a terminal to remove."))
return
if (prob(50) && electrocute_mob(user, terminal.powernet, terminal))
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(5, 1, src)
s.start()
var/datum/effect_system/spark_spread/spark = new /datum/effect_system/spark_spread
spark.set_up(5, 1, src)
spark.start()
return
new /obj/item/stack/cable_coil(loc,10)
user.visible_message(SPAN_NOTICE("[user] removes [src]'s wiring and terminal."),
Expand Down Expand Up @@ -798,41 +798,87 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list(

//Human mob special interaction goes here.
if(ishuman(user))
var/mob/living/carbon/human/H = user
var/mob/living/carbon/human/grabber = user

if(H.species.flags & IS_SYNTHETIC && H.a_intent == INTENT_GRAB)
if(H.action_busy)
return

if(!do_after(H, 20, INTERRUPT_ALL, BUSY_ICON_GENERIC))
return
if(grabber.a_intent == INTENT_GRAB)

playsound(src.loc, 'sound/effects/sparks2.ogg', 25, 1)
//Synthpack recharge
if((grabber.species.flags & IS_SYNTHETIC) && istype(grabber.back, /obj/item/storage/backpack/marine/smartpack))
var/obj/item/storage/backpack/marine/smartpack/s_pack = grabber.back
if(grabber.action_busy)
return

if(stat & BROKEN)
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(3, 1, src)
s.start()
to_chat(H, SPAN_DANGER("The APC's power currents surge eratically, damaging your chassis!"))
H.apply_damage(10,0, BURN)
else if(cell && cell.charge > 0)
if(!istype(H.back, /obj/item/storage/backpack/marine/smartpack))
if(!do_after(grabber, 20, INTERRUPT_ALL, BUSY_ICON_GENERIC))
return

var/obj/item/storage/backpack/marine/smartpack/S = H.back
if(S.battery_charge < SMARTPACK_MAX_POWER_STORED)
var/charge_to_use = min(cell.charge, SMARTPACK_MAX_POWER_STORED - S.battery_charge)
if(!(cell.use(charge_to_use)))
playsound(src.loc, 'sound/effects/sparks2.ogg', 25, 1)

if(stat & BROKEN)
var/datum/effect_system/spark_spread/spark = new /datum/effect_system/spark_spread
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
spark.set_up(3, 1, src)
spark.start()
to_chat(grabber, SPAN_DANGER("The APC's power currents surge eratically, damaging your chassis!"))
grabber.apply_damage(10,0, BURN)
else if(cell && cell.charge > 0)
if(!istype(s_pack))
return
S.battery_charge += charge_to_use
to_chat(user, SPAN_NOTICE("You slot your fingers into the APC interface and siphon off some of the stored charge. [S.name] now has [S.battery_charge]/[SMARTPACK_MAX_POWER_STORED]"))
charging = APC_CHARGING

if(s_pack.battery_charge < SMARTPACK_MAX_POWER_STORED)
var/charge_to_use = min(cell.charge, SMARTPACK_MAX_POWER_STORED - s_pack.battery_charge)
if(!(cell.use(charge_to_use)))
return
s_pack.battery_charge += charge_to_use
to_chat(user, SPAN_NOTICE("You slot your fingers into the APC interface and siphon off some of the stored charge. [s_pack.name] now has [s_pack.battery_charge]/[SMARTPACK_MAX_POWER_STORED]"))
charging = APC_CHARGING
else
to_chat(user, SPAN_WARNING("[s_pack.name] is already fully charged."))
else
to_chat(user, SPAN_WARNING("[S.name] is already fully charged."))
else
to_chat(user, SPAN_WARNING("There is no charge to draw from that APC."))
return
else if(H.species.can_shred(H))
to_chat(user, SPAN_WARNING("There is no charge to draw from that APC."))
return

// Yautja Bracer Recharge
var/obj/item/clothing/gloves/yautja/bracer = grabber.gloves
if(istype(bracer))
if(grabber.action_busy)
return FALSE
if(bracer.last_charge > world.time)
to_chat(user, SPAN_WARNING("It is too soon for [bracer.name] to siphon power again."))
return FALSE
to_chat(user, SPAN_NOTICE("You rest your bracer against the APC interface and begin to siphon off some of the stored energy."))
if(!do_after(grabber, 20, INTERRUPT_ALL, BUSY_ICON_HOSTILE))
return FALSE

if(stat & BROKEN)
var/datum/effect_system/spark_spread/spark = new /datum/effect_system/spark_spread
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
spark.set_up(3, 1, src)
spark.start()
to_chat(grabber, SPAN_DANGER("The APC's power currents surge eratically, super-heating your bracer!"))
playsound(src.loc, 'sound/effects/sparks2.ogg', 25, 1)
grabber.apply_damage(10,0, BURN)
return FALSE
else if(cell && cell.charge > 0)
if(bracer.charge < bracer.charge_max)
var/charge_to_use = min(cell.charge, bracer.charge_max - bracer.charge)
if(!(cell.use(charge_to_use)))
return FALSE
playsound(src.loc, 'sound/effects/sparks2.ogg', 25, 1)
bracer.charge += charge_to_use
bracer.last_charge = (world.time + bracer.charge_cooldown)
to_chat(grabber, SPAN_YAUTJABOLD("[icon2html(bracer)] \The <b>[bracer]</b> beep: Power siphon complete. Charge at [bracer.charge]/[bracer.charge_max]."))
if(bracer.notification_sound)
playsound(bracer.loc, 'sound/items/pred_bracer.ogg', 75, 1)
charging = APC_CHARGING
set_broken() // Breaks the APC

return TRUE
else
to_chat(user, SPAN_WARNING("[bracer.name] is already fully charged."))
return FALSE
else
to_chat(user, SPAN_WARNING("There is no charge to draw from that APC."))
return FALSE
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved

else if(grabber.species.can_shred(grabber))
var/allcut = TRUE
for(var/wire = 1; wire < length(get_wire_descriptions()); wire++)
if(!isWireCut(wire))
Expand Down Expand Up @@ -1011,9 +1057,9 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list(
smoke.set_up(1, 0, loc)
smoke.attach(src)
smoke.start()
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(1, 1, src)
s.start()
var/datum/effect_system/spark_spread/spark = new /datum/effect_system/spark_spread
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
spark.set_up(1, 1, src)
spark.start()
visible_message(SPAN_WARNING("[src] suddenly lets out a blast of smoke and some sparks!"))

/obj/structure/machinery/power/apc/surplus()
Expand Down