ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


new:actor_properties

Actor property wrappers

ACSUtils provides wrapper functions for all actor properties. These functions serve several purposes:

For every actor property ACSUtils provides two functions:

  • <type> GetActor<property>(int tid)
  • void SetActor<property>(int tid, <type> value)

The only exception is GetActorViewHeight, which is a native ZDoom function that takes crouching into account. To access the actual value of the ViewHeight property, use GetActorProperty(tid, APROP_ViewHeight).

Readability increase

Now you can write just:

GetActorHealth(tid);
SetActorHealth(tid, 100);

instead of:

GetActorProperty(tid, APROP_Health);
SetActorProperty(tid, APROP_Health, 100);

Network optimization

All SetActor<property> functions first call GetActorProperty and compare the new value of the property to the current one. If both values are the same, SetActorProperty is not called. This automatically optimizes bandwidth use in Zandronum multiplayer.

Example implementation of SetActorHealth:

function void SetActorHealth(int tid, int Health)
{
	if (GetActorProperty(tid, APROP_Health) != Health)
		SetActorProperty(tid, APROP_Health, Health);
}

Some actor properties are optimized by Zandronum itself. However, the set of optimized actor properties depends on zandronum version, and not all actor properties are currently optimized (https://zandronum.com/tracker/view.php?id=1609).

All string properties are compared in a case-insensitive way before being set. This means, for example, that SetActorNameTag(0, “Thing”) will not call SetActorProperty if the NameTag property is already set to “thing”.

Strict type checking

Each GetActor<property> function is declared as returning the same type as the actor property.

Each SetActor<property> function's value argument is of the same type as the actor property.

If you use ACSUtils with strict type checking (for example, by using BCC with BCSUtils), using actor property wrappers will prevent you from reading an actor property into a variable of incorrect type, or setting an actor property to a value of a different type.

List of supported properties

If any ZDoom property is missing from this list, please, notify ACSUtils developers.

type Name
int Accuracy
str ActiveSound
fixed Alpha
bool Ambush
str AttackSound
fixed AttackZOffset
bool ChaseGoal
int Damage
fixed DamageFactor
fixed DamageMultiplier
str DamageType
str DeathSound
bool Dormant
bool Dropped
fixed Friction
bool Friendly
bool Frightened
fixed Gravity
int Health
fixed Height
bool Invulnerable
fixed JumpZ
int Mass
int MasterTID
fixed MaxDropOffHeight
fixed MaxStepHeight
fixed MeleeRange
str Nametag
bool NoTarget
bool NoTrigger
str PainSound
fixed Radius
int ReactionTime
int RenderStyle
fixed ScaleX
fixed ScaleY
int Score
str SeeSound
int SpawnHealth
str Species
fixed Speed
int Stamina
int StencilColor
int TargetTID
int TracerTID
fixed ViewHeight*
int Waterlevel

*See warning about GetActorViewHeight in the beginning of the article.

new/actor_properties.txt · Last modified: 2018/02/19 12:44 by korshun