Connecting to signal
From inside AcediaObject
(or its child class)
Supposing you want to connect to a signal function
_server.unreal.gameRules.OnNetDamage()
:
_server.unreal.gameRules.OnNetDamage(self).connect = handler;
where handler()
can be any function with appropriate signature:
function int Handler(
int originalDamage,
int damage,
Pawn injured,
Pawn instigator,
Vector hitLocation,
out Vector momentum,
class<DamageType> damageType)
{
// Do whatever
return damage;
}
From inside non-AcediaObject
Pass any other AcediaObject
object as an argument to your signal function.
For example:
local ServiceAnchor receiver;
receiver = ServiceAnchor(_.memory.Allocate(class'ServiceAnchor'));
_server.unreal.gameRules.OnNetDamage(receiver).connect = handler;
NOTE: Signal does not keep the reference to passed argument and once
receiver
gets deallocated - signal will stop notifying handlers connected through it.