Skip to content

Commit 6df4484

Browse files
committed
Lua, INI bindings and changelog
1 parent 1982920 commit 6df4484

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

CHANGELOG.md

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

8585
- New `Actor` INI and Lua (R/W) property `PainThreshold`, which determines how much damage this actor must take in a frame to play their `PainSound`. This can be set to 0 to never manually play the sound. Defaults to 15.
8686

87+
- New `AHuman` INI and Lua (R/W) property `MaxWalkPathCrouchShift`, which determines how much the actor will automatically duck down to avoid low ceilings above them. This can be set to 0 to never duck. Defaults to 5.
88+
8789
- New `MOPixel` INI and Lua (R/W) property `Staininess`, which defines how likely a pixel is to stain a surface when it collides with it. Staining a surface changes that surface's `Color` to that of this `MOPixel`, without changing the underlying material. Value can be between 0 and 1. Defaults to 0 (never stain).
8890

8991
- New `Activity` INI and Lua (R/W) property `AllowsUserSaving`, which can be used to enable/disable manual user saving/loading. This defaults to true for all `GAScripted` with an `OnSave()` function, but false otherwise. Lua `ActivityMan::SaveGame()` function now forces a save even if `AllowsUserSaving` is disabled. This allows mods and scripted gamemodes to handle saving in their own way (for example, only allowing saving at set points).

Entities/AHuman.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ int AHuman::Create(const AHuman &reference) {
209209
m_BackupBGFootGroup->SetOwner(this);
210210
m_BackupBGFootGroup->SetLimbPos(atomGroupToUseAsFootGroupBG->GetLimbPos());
211211

212+
m_MaxWalkPathCrouchShift = reference.m_MaxWalkPathCrouchShift;
213+
212214
if (reference.m_StrideSound) { m_StrideSound = dynamic_cast<SoundContainer*>(reference.m_StrideSound->Clone()); }
213215

214216
m_ArmsState = reference.m_ArmsState;
@@ -285,6 +287,9 @@ int AHuman::ReadProperty(const std::string_view &propName, Reader &reader) {
285287
m_BackupBGFootGroup = new AtomGroup(*m_pBGFootGroup);
286288
m_BackupBGFootGroup->RemoveAllAtoms();
287289
});
290+
MatchProperty("MaxWalkPathCrouchShift", {
291+
reader >> m_MaxWalkPathCrouchShift;
292+
});
288293
MatchProperty("StrideSound", {
289294
m_StrideSound = new SoundContainer;
290295
reader >> m_StrideSound;
@@ -348,6 +353,8 @@ int AHuman::Save(Writer &writer) const
348353
writer << m_pFGFootGroup;
349354
writer.NewProperty("BGFootGroup");
350355
writer << m_pBGFootGroup;
356+
writer.NewProperty("MaxWalkPathCrouchShift");
357+
writer << m_MaxWalkPathCrouchShift;
351358
writer.NewProperty("StrideSound");
352359
writer << m_StrideSound;
353360

Entities/AHuman.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,18 @@ DefaultPieMenuNameGetter("Default Human Pie Menu");
863863
/// <param name="newValue">The new device arm sway rate for this AHuman.</param>
864864
void SetDeviceArmSwayRate(float newValue) { m_DeviceArmSwayRate = newValue; }
865865

866+
/// <summary>
867+
/// Gets this AHuman's max walkpath adjustment upwards to crouch below low ceilings.
868+
/// </summary>
869+
/// <returns>This AHuman's max walkpath adjustment.</returns>
870+
float GetMaxWalkPathCrouchShift() const { return m_MaxWalkPathCrouchShift; }
871+
872+
/// <summary>
873+
/// Sets this AHuman's max walkpath adjustment upwards to crouch below low ceilings.
874+
/// </summary>
875+
/// <param name="newValue">The new value for this AHuman's max walkpath adjustment.</param>
876+
void SetMaxWalkPathCrouchShift(float newValue) { m_MaxWalkPathCrouchShift = newValue; }
877+
866878
/// <summary>
867879
/// Gets this AHuman's stride sound. Ownership is NOT transferred!
868880
/// </summary>

Lua/LuaBindingsEntities.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ namespace RTE {
460460
.property("BGLeg", &AHuman::GetBGLeg, &LuaAdaptersPropertyOwnershipSafetyFaker::AHumanSetBGLeg)
461461
.property("FGFoot", &AHuman::GetFGFoot, &LuaAdaptersPropertyOwnershipSafetyFaker::AHumanSetFGFoot)
462462
.property("BGFoot", &AHuman::GetBGFoot, &LuaAdaptersPropertyOwnershipSafetyFaker::AHumanSetBGFoot)
463+
.property("MaxWalkPathCrouchShift", &AHuman::GetMaxWalkPathCrouchShift, &AHuman::SetMaxWalkPathCrouchShift)
463464
.property("StrideSound", &AHuman::GetStrideSound, &LuaAdaptersPropertyOwnershipSafetyFaker::AHumanSetStrideSound)
464465
.property("UpperBodyState", &AHuman::GetUpperBodyState, &AHuman::SetUpperBodyState)
465466
.property("MovementState", &AHuman::GetMovementState, &AHuman::SetMovementState)

0 commit comments

Comments
 (0)