summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS1
-rw-r--r--src/Entities/ArrowEntity.cpp4
-rw-r--r--src/Entities/ArrowEntity.h2
3 files changed, 7 insertions, 0 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 5622b22f8..1bf8aabfb 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -61,6 +61,7 @@ nesco
NiLSPACE (formerly STR_Warrior)
npresley0506
p-mcgowan
+Persson-dev
pokechu22
ProjectBM
pwnOrbitals
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp
index c7c088361..c21f2a7f3 100644
--- a/src/Entities/ArrowEntity.cpp
+++ b/src/Entities/ArrowEntity.cpp
@@ -194,6 +194,10 @@ void cArrowEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
m_IsInGround = false; // Yes, begin simulating physics again
}
}
+ else if (IsInWater()) // Arrow in water?
+ {
+ ApplyFriction(m_Speed, ARROW_WATER_FRICTION, static_cast<float>(a_Dt.count())); // Yes, slow down arrow
+ }
}
diff --git a/src/Entities/ArrowEntity.h b/src/Entities/ArrowEntity.h
index 2ddc43617..793e09401 100644
--- a/src/Entities/ArrowEntity.h
+++ b/src/Entities/ArrowEntity.h
@@ -39,6 +39,8 @@ public:
// tolua_end
+ static constexpr float ARROW_WATER_FRICTION = 50.0f; ///< Value used to calculate arrow speed in water
+
CLASS_PROTODEF(cArrowEntity)
/** Creates a new arrow with psNoPickup state and default damage modifier coeff */