actor - MSUTeam/MSU GitHub Wiki
- Modified functions
-
New functions
- getMaxMoraleState
-
Get items
- getMainhandItem
- getOffhandItem
- getHeadItem
- getBodyItem
-
Check equipment
- isArmedWithOneHandedWeapon
- isArmedWithTwoHandedWeapon
- getRemainingArmorFraction
-
Check situation
- isEngagedInMelee
- isDoubleGrippingWeapon
- isDisarmed
MSU modifies the vanilla getActionPointsMax
function of actor
to now return a floored value.
MSU adds several convenience functions to actor which allow for cleaner code and a faster modding experience.
<actor>.getMaxMoraleState()
Vanilla has a setter for the MaxMoraleState
of an actor but not a getter. MSU adds the getter. Returns this.m.MaxMoraleState
by default.
<actor>.getMainhandItem()
Returns the item currently equipped by <actor>
in the Mainhand item slot. Returns null if no item is found in that slot.
<actor>.getOffhandItem()
Returns the item currently equipped by <actor>
in the Offhand item slot. Returns null if no item is found in that slot.
<actor>.getHeadItem()
Returns the item currently equipped by <actor>
in the Head item slot. Returns null if no item is found in that slot.
<actor>.getBodyItem()
Returns the item currently equipped by <actor>
in the Body item slot. Returns null if no item is found in that slot.
<actor>.isArmedWithOneHandedWeapon()
Returns true if <actor>
is currently holding a One-Handed item in their Mainhand, otherwise returns false.
<actor>.isArmedWithTwoHandedWeapon()
Returns true if <actor>
is currently holding a Two-Handed item in their Mainhand, otherwise returns false.
<actor>.getRemainingArmorFraction( _bodyPart = null )
// _bodyPart is a key in ::Const.BodyPart
Returns a float which is the current remaining armor durability as a fraction of the maximum durability. If _bodyPart
is null then it returns the total remaining armor fraction calculated using both head and body armor, otherwise only returns the fraction calculated for the specified slot.
<actor>.isEngagedInMelee()
Returns true only if <actor>
is placed on the tactical map and there is an enemy who is exerting zone of control on <actor>
. Otherwise returns false.
<actor>.isDoubleGrippingWeapon()
Returns true if <actor>
has access to the special.double_grip
skill and the skill is not hidden. Otherwise returns false.
<actor>.isDisarmed()
Returns true if <actor>
has the effects.disarmed
effect. This function should be used whenever you want to check for an actor being disarmed, because it is expected that mods will hook and extend this function to include any other conditions which may lead to an actor being considered disarmed.