From 5db00d7095300901e86f3a31dedd31541944b9e8 Mon Sep 17 00:00:00 2001
From: Samman166 <67894653+Samman166@users.noreply.github.com>
Date: Fri, 24 Mar 2023 18:15:22 -0230
Subject: [PATCH] Stun batons and Stun prods that are turned on cannot be
stored (#20303)
* active batons and stunprods cannot be stored
* now checks if baton was turned off by removing its cell or running out of charge
* won't fit in bags of holding now
* Update code/game/objects/items/weapons/stunbaton.dm
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
* Reworked to not use weight class but instead can_store and mob_can_equip
* removed W_class_on var that I added, it's redundandt now that this does not use weight class
* Update code/game/objects/items/weapons/stunbaton.dm
Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
* Update code/game/objects/items/weapons/stunbaton.dm
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
* disable_warning = TRUE
* Update code/game/objects/items/weapons/stunbaton.dm
Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
---------
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
---
code/game/objects/items/weapons/stunbaton.dm | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm
index db4cba35cb0..70d1c425e49 100644
--- a/code/game/objects/items/weapons/stunbaton.dm
+++ b/code/game/objects/items/weapons/stunbaton.dm
@@ -81,6 +81,18 @@
/obj/item/melee/baton/get_cell()
return cell
+/obj/item/melee/baton/mob_can_equip(mob/user, slot, disable_warning = TRUE)
+ if(turned_on && (slot == slot_belt || slot == slot_s_store))
+ to_chat(user, "You can't equip [src] while it's active!")
+ return FALSE
+ return ..(user, slot, disable_warning = TRUE) // call parent but disable warning
+
+/obj/item/melee/baton/can_enter_storage(obj/item/storage/S, mob/user)
+ if(turned_on)
+ to_chat(user, "[S] can't hold [src] while it's active!")
+ return FALSE
+ return TRUE
+
/**
* Removes the specified amount of charge from the batons power cell.
*