From 8df58cfc75d6eccbe1dd2373bbd13e427c93bdee Mon Sep 17 00:00:00 2001
From: SatinIsle <98125273+SatinIsle@users.noreply.github.com>
Date: Wed, 19 Jun 2024 06:43:52 +0100
Subject: [PATCH] Unstable Size Gun (#16056)
* Size gun back firing
Added the ability to modify size guns with wirecutters to make them "unstable", which gives them a 50% chance of backfiring and changing the size of the user. This modification can be undone by using wirecutters again.
Added a variant of the sizegun that starts unstable.
* Backfiring consumes the remaining charge
---
code/modules/vore/resizing/sizegun_vr.dm | 49 ++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/code/modules/vore/resizing/sizegun_vr.dm b/code/modules/vore/resizing/sizegun_vr.dm
index 4bbaaff043..2bbd601035 100644
--- a/code/modules/vore/resizing/sizegun_vr.dm
+++ b/code/modules/vore/resizing/sizegun_vr.dm
@@ -15,6 +15,7 @@
origin_tech = list(TECH_BLUESPACE = 4)
modifystate = "sizegun-shrink"
battery_lock = 1
+ var/backfire = 0
var/size_set_to = 1
firemodes = list(
list(mode_name = "select size",
@@ -133,6 +134,54 @@
size_set_to = clamp((size_select/100), 0, 1000) //eheh
to_chat(usr, "You set the size to [size_select]%")
+/obj/item/weapon/gun/energy/sizegun/afterattack(atom/A, mob/living/user, adjacent, params)
+ if(adjacent) return //A is adjacent, is the user, or is on the user's person
+
+ if(backfire)
+ if(prob(50))
+ to_chat(user, "\The [src] backfires and consumes its entire charge!")
+ Fire(user, user)
+ power_supply.charge = 0
+ var/mob/living/M = loc // TGMC Ammo HUD
+ if(istype(M)) // TGMC Ammo HUD
+ M?.hud_used.update_ammo_hud(M, src)
+ return
+ else
+ return ..()
+ else
+ return ..()
+
+/obj/item/weapon/gun/energy/sizegun/attack(atom/A, mob/living/user, adjacent, params)
+ if(backfire)
+ if(prob(50))
+ to_chat(user, "\The [src] backfires and consumes its entire charge!")
+ Fire(user, user)
+ power_supply.charge = 0
+ var/mob/living/M = loc // TGMC Ammo HUD
+ if(istype(M)) // TGMC Ammo HUD
+ M?.hud_used.update_ammo_hud(M, src)
+ return
+ else
+ return ..()
+ else
+ return ..()
+
+
+/obj/item/weapon/gun/energy/sizegun/attackby(var/obj/item/A as obj, mob/user as mob)
+ if(A.has_tool_quality(TOOL_WIRECUTTER))
+ if(backfire)
+ to_chat(user, "You repair the damage to the \the [src].")
+ backfire = 0
+ name = "size gun"
+ else
+ to_chat(user, "You snip a wire on \the [src], making it less reliable.")
+ backfire = 1
+ name = "unstable size gun"
+ ..()
+
+/obj/item/weapon/gun/energy/sizegun/backfire
+ name = "unstable size gun"
+ backfire = 1
/obj/item/weapon/gun/energy/sizegun/mounted
name = "mounted size gun"