From 7fb0e7157a87f4f09acfc692d044c22b1c1154e5 Mon Sep 17 00:00:00 2001
From: Contrabang <91113370+Contrabang@users.noreply.github.com>
Date: Sun, 9 Jul 2023 05:47:13 -0400
Subject: [PATCH] exploit gone (#21605)
---
code/game/objects/items/weapons/powerfist.dm | 2 +-
code/modules/atmospherics/gasmixtures/gas_mixture.dm | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/code/game/objects/items/weapons/powerfist.dm b/code/game/objects/items/weapons/powerfist.dm
index 5b8a6f90fd0..83ac2e942cc 100644
--- a/code/game/objects/items/weapons/powerfist.dm
+++ b/code/game/objects/items/weapons/powerfist.dm
@@ -89,7 +89,7 @@
if(!tank)
to_chat(user, "[src] can't operate without a source of gas!")
return
- if(tank && !tank.air_contents.remove(gasperfist * fisto_setting))
+ if(tank && !tank.air_contents.boolean_remove(gasperfist * fisto_setting))
to_chat(user, "[src]'s piston-ram lets out a weak hiss, it needs more gas!")
playsound(loc, 'sound/effects/refill.ogg', 50, 1)
return
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 2310e116872..3f62b0cdd37 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -111,6 +111,12 @@ What are the archived variables for?
return TRUE
+ /// Only removes the gas if we have more than the amount
+/datum/gas_mixture/proc/boolean_remove(amount)
+ if(amount > total_moles())
+ return FALSE
+ return remove(amount)
+
///Proportionally removes amount of gas from the gas_mixture.
///Returns: gas_mixture with the gases removed
/datum/gas_mixture/proc/remove(amount)