Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
20 changes: 19 additions & 1 deletion code/game/objects/items/stunbaton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 50, BIO = 0, RAD = 0, FIRE = 80, ACID = 80)

var/cooldown_check = 0

/// if the baton is on cooldown from being dropped
var/dropcheck = FALSE
Comment thread
JamieD1 marked this conversation as resolved.
///how long we can't use this baton for after slapping someone with it. Does not account for melee attack cooldown (default of 0.8 seconds).
var/cooldown = 1.2 SECONDS
///how long a clown stuns themself for, or someone is stunned for if they are hit to >90 stamina damage
Expand Down Expand Up @@ -58,6 +59,21 @@
if(status && prob(throw_hit_chance) && iscarbon(hit_atom))
baton_stun(hit_atom)

/obj/item/melee/baton/dropped(mob/user, silent)
Comment thread
JamieD1 marked this conversation as resolved.
. = ..()
dropcheck = TRUE
Comment thread
JamieD1 marked this conversation as resolved.
Outdated
status = FALSE
visible_message(span_warning("The safety strap on [src] is pulled as it is dropped, triggering its emergency shutoff!"))
addtimer(CALLBACK(src, .proc/recalibrate), 8 SECONDS)

/obj/item/melee/baton/proc/recalibrate()
dropcheck = FALSE
status = TRUE
Comment thread
JamieD1 marked this conversation as resolved.
Outdated
playsound(loc, "sparks", 75, 1, -1)
cell_last_used = 0
START_PROCESSING(SSobj, src)
update_icon()

/obj/item/melee/baton/loaded //this one starts with a cell pre-installed.
preload_cell_type = /obj/item/stock_parts/cell/high

Expand Down Expand Up @@ -124,6 +140,8 @@
return ..()

/obj/item/melee/baton/attack_self(mob/user)
if(dropcheck)
to_chat("[src]'s emergency shutoff is still active!")
if(cell && cell.charge > hitcost)
status = !status
to_chat(user, span_notice("[src] is now [status ? "on" : "off"]."))
Expand Down