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

Commit 25ebbed

Browse files
committed
Added AHuman property EquippedMass
1 parent 5d294fd commit 25ebbed

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

CHANGELOG.md

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

276276
- New `AEmitter` and `PEmitter` Lua (R) property `ThrottleFactor`, which gets the throttle strength as a multiplier value that factors in either the positive or negative throttle multiplier according to throttle.
277277

278+
- New `AHuman` Lua (R) property `EquippedMass`, which returns the total mass of any `HeldDevice`s currently equipped by the actor.
279+
278280
</details>
279281

280282
<details><summary><b>Changed</b></summary>

Entities/AHuman.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,19 @@ MovableObject * AHuman::GetEquippedBGItem() const
14641464
return 0;
14651465
}
14661466

1467+
//////////////////////////////////////////////////////////////////////////////////////////
1468+
1469+
float AHuman::GetEquippedMass() const {
1470+
float equippedMass = 0;
1471+
if (MovableObject *fgDevice = GetEquippedItem()) {
1472+
equippedMass += fgDevice->GetMass();
1473+
}
1474+
if (MovableObject *bgDevice = GetEquippedBGItem()) {
1475+
equippedMass += bgDevice->GetMass();
1476+
}
1477+
return equippedMass;
1478+
}
1479+
14671480
//////////////////////////////////////////////////////////////////////////////////////////
14681481
// Virtual Method: FirearmIsReady
14691482
//////////////////////////////////////////////////////////////////////////////////////////

Entities/AHuman.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,13 @@ ClassInfoGetters;
607607
MovableObject * GetEquippedBGItem() const;
608608

609609

610+
/// <summary>
611+
/// Gets the total mass of this AHuman's currently equipped devices.
612+
/// </summary>
613+
/// <returns>The mass of this AHuman's equipped devices.</returns>
614+
float GetEquippedMass() const;
615+
616+
610617
//////////////////////////////////////////////////////////////////////////////////////////
611618
// Virtual Method: FirearmIsReady
612619
//////////////////////////////////////////////////////////////////////////////////////////

Lua/LuaBindingsEntities.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ namespace RTE {
418418
.property("ThrowProgress", &AHuman::GetThrowProgress)
419419
.property("EquippedItem", &AHuman::GetEquippedItem)
420420
.property("EquippedBGItem", &AHuman::GetEquippedBGItem)
421+
.property("EquippedMass", &AHuman::GetEquippedMass)
421422
.property("FirearmIsReady", &AHuman::FirearmIsReady)
422423
.property("ThrowableIsReady", &AHuman::ThrowableIsReady)
423424
.property("FirearmIsEmpty", &AHuman::FirearmIsEmpty)

0 commit comments

Comments
 (0)