From e4bb0438d0fa28e3a4786fdcaa27c563c281392b Mon Sep 17 00:00:00 2001 From: "C.L" Date: Sat, 10 Sep 2022 01:16:06 -0400 Subject: [PATCH] Variation! Fixes some exploits - Makes it so you can't remove the cell and keep firing the gun. - Makes the modifier addition be a var so you can have it do variants! - Adds a check so you can't take your gun out if the generator doesn't have a cell. --- .../items/devices/personal_shield_generator_vr.dm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/devices/personal_shield_generator_vr.dm b/code/game/objects/items/devices/personal_shield_generator_vr.dm index cff54a33d53..5089bc68f56 100644 --- a/code/game/objects/items/devices/personal_shield_generator_vr.dm +++ b/code/game/objects/items/devices/personal_shield_generator_vr.dm @@ -21,6 +21,7 @@ var/has_weapon = 1 var/shield_active = 0 // If the shield gen is active. var/energy_modifier = 25 // 40 damage absorbed per 1000 charge. If the charge used is > the cell's remaining charge, the excess is dealt to the user! + var/modifier_type = /datum/modifier/shield_projection //What type of modifier will it add? Used for variant modifiers! /obj/item/device/personal_shield_generator/get_cell() return bcell @@ -119,6 +120,8 @@ return W.forceMove(src) bcell = W + if(active_weapon) + active_weapon.power_supply = bcell to_chat(user, "You install a cell in \the [src].") update_icon() @@ -131,6 +134,9 @@ bcell.update_icon() bcell.forceMove(get_turf(src.loc)) bcell = null + if(active_weapon) + reattach_gun() //Put the gun back if it's out. No shooting if we don't have a cell! + active_weapon.power_supply = null //No power cell anymore! to_chat(user, "You remove the cell from \the [src].") update_icon() else @@ -173,7 +179,8 @@ else shield_active = !shield_active to_chat(user, "You activate the shield!") - user.add_modifier(/datum/modifier/shield_projection) + user.remove_modifiers_of_type(/datum/modifier/shield_projection) //Just to make sure they aren't using two at once! + user.add_modifier(modifier_type) //TESTING. START_PROCESSING(SSobj, src) //Let's only bother draining power when we're being used! update_icon() @@ -186,10 +193,15 @@ if(user.last_special > world.time) return user.last_special = world.time + 10 //No spamming! + if(!active_weapon) to_chat(user, "The gun is missing!") return + if(!bcell) + to_chat(user, "The gun requires a power supply!") + return + if(active_weapon.loc != src) reattach_gun(user) //Remove from their hands and back onto the defib unit return