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

Commit 37f01df

Browse files
committed
Expose Leg property MoveSpeed to Lua
1 parent 9262c81 commit 37f01df

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,8 @@ This can be accessed via the new Lua (R/W) `SettingsMan` property `AIUpdateInter
637637

638638
- Added `Activity` Lua function `GetPlayerController`, which gets you the `Controller` used for GUI stuff and when there's no `Actor` selected in an `Activity`. Be aware, it's very likely possible to cause problems by doing dumb things with this.
639639

640+
- Added `Leg` Lua (R/W) property `MoveSpeed`, which lets you get and set the `Leg`'s `MoveSpeed` scalar, similar to `Arm`s. 1 means instant movement and 0 means no movement.
641+
640642
</details>
641643

642644
<details><summary><b>Changed</b></summary>

Entities/Leg.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ namespace RTE {
8181
/// <returns>The max length, in pixels, of this Leg.</returns>
8282
float GetMaxLength() const { return m_MaxExtension; }
8383

84+
/// <summary>
85+
/// Gets the move speed of this Leg, where 1.0 is instant and 0.0 is no movement.
86+
/// </summary>
87+
/// <returns>The move speed of this Leg.</returns>
88+
float GetMoveSpeed() const { return m_MoveSpeed; }
89+
90+
/// <summary>
91+
/// Sets the move speed of this Leg, where 1.0 is instant and 0.0 is no movement.
92+
/// </summary>
93+
/// <returns>The new move speed of this Leg.</returns>
94+
void SetMoveSpeed(float newMoveSpeed) { m_MoveSpeed = newMoveSpeed; }
95+
8496
/// <summary>
8597
/// Sets the position this Leg should move towards, in absolute coordinates.
8698
/// </summary>

Lua/LuaBindingsEntities.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,8 @@ namespace RTE {
769769
LuaBindingRegisterFunctionDefinitionForType(EntityLuaBindings, Leg) {
770770
return ConcreteTypeLuaClassDefinition(Leg, Attachable)
771771

772-
.property("Foot", &Leg::GetFoot, &LuaAdaptersPropertyOwnershipSafetyFaker::LegSetFoot);
772+
.property("Foot", &Leg::GetFoot, &LuaAdaptersPropertyOwnershipSafetyFaker::LegSetFoot)
773+
.property("MoveSpeed", &Leg::GetMoveSpeed, &Leg::SetMoveSpeed);
773774
}
774775

775776
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)