From 738910e1238dc399fbeb7d3152149734dad9d9d4 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Fri, 9 Mar 2018 12:47:14 +0200 Subject: [PATCH] Fixed being able to gain karma by welding fixed walls --- Barotrauma/BarotraumaShared/Source/Map/Structure.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs index 3a61cb9ce..c1047f7a8 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs @@ -687,9 +687,10 @@ namespace Barotrauma { if (Submarine != null && Submarine.GodMode) return; if (!prefab.Body) return; - if (!MathUtils.IsValid(damage)) return; + damage = MathHelper.Clamp(damage, 0.0f, prefab.Health); + if (GameMain.Server != null && damage != sections[sectionIndex].damage) { GameMain.Server.CreateEntityEvent(this); @@ -756,7 +757,7 @@ namespace Barotrauma bool hadHole = SectionBodyDisabled(sectionIndex); sections[sectionIndex].damage = MathHelper.Clamp(damage, 0.0f, prefab.Health); - if (sections[sectionIndex].damage < prefab.Health) //otherwise it's possible to infinitely gain karma by welding fixed things + if (damageDiff != 0.0f) //otherwise it's possible to infinitely gain karma by welding fixed things AdjustKarma(attacker, damageDiff); bool hasHole = SectionBodyDisabled(sectionIndex);