Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit a121a27

Browse files
committed
Add JetReplenishRate + some attempts to re-balance jetpacking
1 parent f7fee99 commit a121a27

File tree

6 files changed

+48
-3
lines changed

6 files changed

+48
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
250250

251251
- New `SoundContainer` INI and Lua (R/W) property `PitchVariation`, which can be used to randomize the pitch of the sounds being played.
252252

253+
- New `AHuman` and `ACrab` INI and Lua (R/W) property `JetReplenishRate`, which determines how fast jump time (i.e. jetpack fuel) is replenished during downtime.
254+
253255
</details>
254256

255257
<details><summary><b>Changed</b></summary>

Entities/ACrab.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void ACrab::Clear()
5959
m_pJetpack = 0;
6060
m_JetTimeTotal = 0.0;
6161
m_JetTimeLeft = 0.0;
62+
m_JetReplenishRate = 1.75F;
6263
m_JetAngleRange = 0.25F;
6364
m_MoveState = STAND;
6465
for (int side = 0; side < SIDECOUNT; ++side)
@@ -188,6 +189,7 @@ int ACrab::Create(const ACrab &reference) {
188189

189190
m_JetTimeTotal = reference.m_JetTimeTotal;
190191
m_JetTimeLeft = reference.m_JetTimeLeft;
192+
m_JetReplenishRate = reference.m_JetReplenishRate;
191193
m_JetAngleRange = reference.m_JetAngleRange;
192194

193195
m_pLFGFootGroup = dynamic_cast<AtomGroup *>(reference.m_pLFGFootGroup->Clone());
@@ -257,6 +259,8 @@ int ACrab::ReadProperty(const std::string_view &propName, Reader &reader)
257259
} else if (propName == "JumpTime") {
258260
reader >> m_JetTimeTotal;
259261
m_JetTimeTotal *= 1000;
262+
} else if (propName == "JumpReplenishRate") {
263+
reader >> m_JetReplenishRate;
260264
} else if (propName == "JumpAngleRange") {
261265
reader >> m_JetAngleRange;
262266
} else if (propName == "LFGLeg" || propName == "LeftFGLeg") {
@@ -335,6 +339,8 @@ int ACrab::Save(Writer &writer) const
335339
writer.NewProperty("JumpTime");
336340
// Convert to seconds
337341
writer << m_JetTimeTotal / 1000;
342+
writer.NewProperty("JumpReplenishRate");
343+
writer << m_JetReplenishRate;
338344
writer.NewProperty("JumpAngleRange");
339345
writer << m_JetAngleRange;
340346
writer.NewProperty("LFGLeg");
@@ -2156,8 +2162,7 @@ void ACrab::Update()
21562162
m_pJetpack->EnableEmission(false);
21572163
if (m_MoveState == JUMP) { m_MoveState = STAND; }
21582164

2159-
// Replenish the jetpack time, twice as fast
2160-
m_JetTimeLeft = std::min(m_JetTimeLeft + g_TimerMan.GetDeltaTimeMS() * 2.0F, m_JetTimeTotal);
2165+
m_JetTimeLeft = std::min(m_JetTimeLeft + g_TimerMan.GetDeltaTimeMS() * m_JetReplenishRate, m_JetTimeTotal);
21612166
}
21622167

21632168
float maxAngle = c_HalfPI * m_JetAngleRange;

Entities/ACrab.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,20 @@ class ACrab :
258258
float GetJetTimeLeft() const { return m_JetTimeLeft; }
259259

260260

261+
/// <summary>
262+
/// Gets the rate at which this ACrab's jetpack is replenished during downtime.
263+
/// </summary>
264+
/// <returns>The rate at which the jetpack is replenished.</returns>
265+
float GetJetReplenishRate() const { return m_JetReplenishRate; }
266+
267+
268+
/// <summary>
269+
/// Sets the rate at which this ACrab's jetpack is replenished during downtime.
270+
/// </summary>
271+
/// <param name="newValue">The rate at which the jetpack is replenished.</param>
272+
void SetJetReplenishRate(float newValue) { m_JetReplenishRate = newValue; }
273+
274+
261275
/// <summary>
262276
/// Gets the scalar ratio at which this jetpack's thrust angle follows the aim angle of the user.
263277
/// </summary>
@@ -585,6 +599,7 @@ int FirearmActivationDelay() const;
585599
float m_JetTimeTotal;
586600
// How much time left the jetpack can go, in ms
587601
float m_JetTimeLeft;
602+
float m_JetReplenishRate; //!< How fast the jetpack fuel will replenish when not in use.
588603
// Ratio at which the jetpack angle follows aim angle
589604
float m_JetAngleRange;
590605
// Blink timer

Entities/AHuman.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ void AHuman::Clear()
7373
m_StrideStart = false;
7474
m_JetTimeTotal = 0.0;
7575
m_JetTimeLeft = 0.0;
76+
m_JetReplenishRate = 1.75F;
7677
m_JetAngleRange = 0.25F;
7778
m_GoldInInventoryChunk = 0;
7879
m_ThrowTmr.Reset();
@@ -174,6 +175,7 @@ int AHuman::Create(const AHuman &reference) {
174175
m_ThrowPrepTime = reference.m_ThrowPrepTime;
175176
m_JetTimeTotal = reference.m_JetTimeTotal;
176177
m_JetTimeLeft = reference.m_JetTimeLeft;
178+
m_JetReplenishRate = reference.m_JetReplenishRate;
177179
m_JetAngleRange = reference.m_JetAngleRange;
178180
m_FGArmFlailScalar = reference.m_FGArmFlailScalar;
179181
m_BGArmFlailScalar = reference.m_BGArmFlailScalar;
@@ -243,6 +245,8 @@ int AHuman::ReadProperty(const std::string_view &propName, Reader &reader) {
243245
reader >> m_JetTimeTotal;
244246
// Convert to ms
245247
m_JetTimeTotal *= 1000;
248+
} else if (propName == "JumpReplenishRate") {
249+
reader >> m_JetReplenishRate;
246250
} else if (propName == "JumpAngleRange") {
247251
reader >> m_JetAngleRange;
248252
} else if (propName == "FGArmFlailScalar") {
@@ -340,6 +344,8 @@ int AHuman::Save(Writer &writer) const
340344
writer.NewProperty("JumpTime");
341345
// Convert to seconds
342346
writer << m_JetTimeTotal / 1000;
347+
writer.NewProperty("JumpReplenishRate");
348+
writer << m_JetReplenishRate;
343349
writer.NewProperty("JumpAngleRange");
344350
writer << m_JetAngleRange;
345351
writer.NewProperty("FGArmFlailScalar");
@@ -3150,7 +3156,7 @@ void AHuman::Update()
31503156
} else {
31513157
m_pJetpack->EnableEmission(false);
31523158
if (m_MoveState == JUMP) { m_MoveState = STAND; }
3153-
m_JetTimeLeft = std::min(m_JetTimeLeft + g_TimerMan.GetDeltaTimeMS() * 2.0F, m_JetTimeTotal);
3159+
m_JetTimeLeft = std::min(m_JetTimeLeft + g_TimerMan.GetDeltaTimeMS() * m_JetReplenishRate, m_JetTimeTotal);
31543160
}
31553161

31563162
float maxAngle = c_HalfPI * m_JetAngleRange;

Entities/AHuman.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,20 @@ ClassInfoGetters;
374374
void SetJetTimeLeft(float newValue) { m_JetTimeLeft = newValue < m_JetTimeTotal ? newValue : m_JetTimeTotal; }
375375

376376

377+
/// <summary>
378+
/// Gets the rate at which this AHuman's jetpack is replenished during downtime.
379+
/// </summary>
380+
/// <returns>The rate at which the jetpack is replenished.</returns>
381+
float GetJetReplenishRate() const { return m_JetReplenishRate; }
382+
383+
384+
/// <summary>
385+
/// Sets the rate at which this AHuman's jetpack is replenished during downtime.
386+
/// </summary>
387+
/// <param name="newValue">The rate at which the jetpack is replenished.</param>
388+
void SetJetReplenishRate(float newValue) { m_JetReplenishRate = newValue; }
389+
390+
377391
/// <summary>
378392
/// Gets the scalar ratio at which this jetpack's thrust angle follows the aim angle of the user.
379393
/// </summary>
@@ -976,6 +990,7 @@ ClassInfoGetters;
976990
float m_JetTimeTotal;
977991
// How much time left the jetpack can go, in ms
978992
float m_JetTimeLeft;
993+
float m_JetReplenishRate; //!< How fast the jetpack fuel will replenish when not in use.
979994
// Ratio at which the jetpack angle follows aim angle
980995
float m_JetAngleRange;
981996
// Blink timer

Lua/LuaBindingsEntities.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ namespace RTE {
6060
.property("StrideSound", &ACrab::GetStrideSound, &ACrabSetStrideSound)
6161
.property("JetTimeTotal", &ACrab::GetJetTimeTotal, &ACrab::SetJetTimeTotal)
6262
.property("JetTimeLeft", &ACrab::GetJetTimeLeft)
63+
.property("JetReplenishRate", &ACrab::GetJetReplenishRate, &ACrab::SetJetReplenishRate)
6364
.property("EquippedItem", &ACrab::GetEquippedItem)
6465
.property("FirearmIsReady", &ACrab::FirearmIsReady)
6566
.property("FirearmIsEmpty", &ACrab::FirearmIsEmpty)
@@ -409,6 +410,7 @@ namespace RTE {
409410
.property("StrideSound", &AHuman::GetStrideSound, &AHumanSetStrideSound)
410411
.property("JetTimeTotal", &AHuman::GetJetTimeTotal, &AHuman::SetJetTimeTotal)
411412
.property("JetTimeLeft", &AHuman::GetJetTimeLeft, &AHuman::SetJetTimeLeft)
413+
.property("JetReplenishRate", &AHuman::GetJetReplenishRate, &AHuman::SetJetReplenishRate)
412414
.property("JetAngleRange", &AHuman::GetJetAngleRange, &AHuman::SetJetAngleRange)
413415
.property("ThrowPrepTime", &AHuman::GetThrowPrepTime, &AHuman::SetThrowPrepTime)
414416
.property("ThrowProgress", &AHuman::GetThrowProgress)

0 commit comments

Comments
 (0)