diff --git a/docs/sdk/script/fn/GetEnergy.xml b/docs/sdk/script/fn/GetEnergy.xml
index 1f4404a2e..63dd845ab 100644
--- a/docs/sdk/script/fn/GetEnergy.xml
+++ b/docs/sdk/script/fn/GetEnergy.xml
@@ -7,7 +7,17 @@
GetEnergy
Objects
1.0 OC
- int
+
+ int
+
+
+ bool
+ exact
+ If true
, the exact energy value is returned.
+
+
+
+
Returns the current energy value of an object. 100% representing the maximum physical value of 100,000
For living beings, \"energy\" stands for health, in buildings it stands for electrical charge.
@@ -15,4 +25,5 @@
jwk2002-06
+ Marky2018-12
diff --git a/src/object/C4ObjectScript.cpp b/src/object/C4ObjectScript.cpp
index a0ab91830..d94770c68 100644
--- a/src/object/C4ObjectScript.cpp
+++ b/src/object/C4ObjectScript.cpp
@@ -558,9 +558,16 @@ static long FnGetPhase(C4Object *Obj)
return Obj->Action.Phase;
}
-static long FnGetEnergy(C4Object *Obj)
+static long FnGetEnergy(C4Object *Obj, bool fExact)
{
- return 100*Obj->Energy/C4MaxPhysical;
+ if (fExact)
+ {
+ return Obj->Energy;
+ }
+ else
+ {
+ return 100*Obj->Energy/C4MaxPhysical;
+ }
}
static long FnGetBreath(C4Object *Obj)