Skip to content

Commit

Permalink
Adherent Discharge
Browse files Browse the repository at this point in the history
  • Loading branch information
Lexanx committed Dec 21, 2023
1 parent 0e2948b commit 5e9f77b
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 1 deletion.
58 changes: 58 additions & 0 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -570,3 +570,61 @@ GLOBAL_LIST_INIT(click_catchers, create_click_catcher())

/obj/screen/click_catcher/IsAutoclickable()
return TRUE

// [SIERRA-ADD]
/mob/living/carbon/human/AltClickOn(atom/A)
if(get_dist(src, A) > 1)
return
if(!stat && mind && ismob(A) && (A != src) && (src.species.name == SPECIES_ADHERENT))
var/mob/living/carbon/human/adherent = src
var/obj/item/organ/internal/cell/adherent/adherent_core = adherent.internal_organs_by_name[BP_CELL]
if(adherent_core.ready_to_charge)
var/mob/living/carbon/human/target_human = A
var/mob/living/target = A
var/obj/item/cell/target_cell
var/obj/item/cell/adherent_cell
var/obj/item/organ/internal/cell/acell = locate() in adherent.internal_organs
if(acell && acell.cell)
adherent_cell = acell.cell

if(adherent_cell && adherent_cell.charge <= 2000)
to_chat(src, SPAN_WARNING("Your cell charge is too low for this action."))
return

if(ishuman(target_human))
var/obj/item/organ/internal/cell/cell = locate() in target_human.internal_organs
if(cell && cell.cell)
target_cell = cell.cell
else if(isrobot(target))
var/mob/living/silicon/robot/robot = target
target_cell = robot.get_cell()

target.visible_message(SPAN_WARNING("There is a loud crack and the smell of ozone as \the [adherent] touches \the [target]."))
playsound(loc, 'sound/effects/snap.ogg', 50, 1)

if(target_cell)
if(target_cell.maxcharge > (target_cell.charge + 2000))
target_cell.charge += 2000
else
target_cell.charge = target_cell.maxcharge
to_chat(target, SPAN_NOTICE("<b>Your [target_cell] has been charged.</b>"))
adherent_cell.charge -= 2000
if(istype(target_human) && target_human.species.name == SPECIES_ADHERENT)
next_click = world.time + 2 SECONDS
return
if(isrobot(target))
target.apply_damage(100, DAMAGE_BURN, def_zone = src.zone_sel.selecting)
visible_message(SPAN_DANGER("[adherent] touches [target] with bright electrical arc connecting them."))
to_chat(target, SPAN_DANGER("<b>You detect damage to your components!</b>"))
else if(ishuman(target))
target.electrocute_act(100, src, def_zone = src.zone_sel.selecting)
visible_message(SPAN_DANGER("With bright electrical flash [adherent] touches [target] using it's tentacles."))
else
target.apply_damage(100, DAMAGE_BURN, def_zone = src.zone_sel.selecting)
visible_message(SPAN_DANGER("With bright electrical flash [adherent] touches [target] using it's tentacles."))
admin_attack_log(src, target, "Has electrocuted", "Has been electrocuted", "electrocuted")
target.throw_at(get_step(target,get_dir(src,target)), 5, 10)
next_click = world.time + 2 SECONDS
return
..()
// [SIERRA-ADD]
20 changes: 20 additions & 0 deletions code/modules/mob/living/carbon/human/human_powers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,23 @@
return
var/list/rgb = rgb2num(new_skin)
change_skin_color(rgb[1], rgb[2], rgb[3])

// [SIERRA-ADD]
/mob/living/carbon/human/proc/toggle_emergency_discharge()
set category = "Abilities"
set name = "Toggle emergency discharge"
set desc = "Allows you to overload your piezo capacitors."

var/mob/living/carbon/human/adherent = src
var/obj/item/organ/internal/cell/adherent/adherent_core = adherent.internal_organs_by_name[BP_CELL]
if(!adherent_core.ready_to_charge)
adherent_core.ready_to_charge = TRUE
to_chat(src, SPAN_WARNING("The emergency discharge is ready for use."))
to_chat(src, SPAN_GOOD("You are ready to discharge, use alt+click on target to electrocute them."))
adherent.visible_message(SPAN_WARNING("You hear silent crackle sounds from [adherent] tentacles"))
playsound(loc, 'sound/effects/discharge_on.ogg', 40, 1)
return

adherent_core.ready_to_charge = FALSE
to_chat(src, SPAN_WARNING("You have relieved the tension of your tentacles."))
// [SIERRA-ADD]
4 changes: 3 additions & 1 deletion code/modules/organs/internal/species/adherent.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@
icon = 'icons/mob/human_races/species/adherent/organs.dmi'
icon_state = "cell"
cell = /obj/item/cell/hyper

// [SIERRA-ADD]
var/ready_to_charge
// [SIERRA-ADD]
/obj/item/organ/internal/powered/cooling_fins
name = "cooling fins"
gender = PLURAL
Expand Down
6 changes: 6 additions & 0 deletions code/modules/species/station/adherent.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@
"Jet" = "_black"
)

// [SIERRA-ADD]
inherent_verbs = list(
/mob/living/carbon/human/proc/toggle_emergency_discharge
)
// [SIERRA-ADD]

/datum/species/adherent/New()
equip_adjust = list(
"[slot_l_hand_str]" = list("[NORTH]" = list("x" = 0, "y" = 14), "[EAST]" = list("x" = 0, "y" = 14), "[SOUTH]" = list("x" = 0, "y" = 14), "[WEST]" = list("x" = 0, "y" = 14)),
Expand Down
Binary file added sound/effects/discharge_on.ogg
Binary file not shown.

0 comments on commit 5e9f77b

Please sign in to comment.