OverrideLostSpawnIncreaseFromUse
Tracking Issue: #892
Normally, each ability template has its own LostSpawnIncreasePerUse value. When the ability is activated,
this value is added to the "bucket" responsible for spawning additional Lost waves. When the "bucket" is filled, a wave of Lost spawns.
This LostSpawnIncreasePerUse value is constant for each ability template; it does not depend on which weapon is used for the ability or any other context.
The XComGameState_Unit::OnAbilityActivated
triggers a OverrideLostSpawnIncreaseFromUse
event,
allowing mods to override the amount of Lost-attracting noise generated by abilities.
EventID: OverrideLostSpawnIncreaseFromUse
EventData: XComLWTuple {
Data: [
inout int LostSpawnModifier,
in XComGameState_Ability ActivatedAbilityState,
]
}
EventSource: self (XComGameState_Unit)
GameState: yes
Listeners for this event must use ELD_Immediate deferral. Example of an event listener function:
static function EventListenerReturn ListenerEventFunction(Object EventData, Object EventSource, XComGameState NewGameState, Name Event, Object CallbackData)
{
local XComLWTuple OverrideTuple;
local XComGameState_Ability AbilityState;
local XComGameState_Item SourceWeapon, SourceAmmo;
OverrideTuple = XComLWTuple(EventData);
AbilityState = XComGameState_Ability(OverrideTuple.Data[1].o);
if (AbilityState.GetMyTemplateName() == 'ThrowGrenade' || AbilityState.GetMyTemplateName() == 'LaunchGrenade')
{
SourceWeapon = AbilityState.GetSourceWeapon();
SourceAmmo = AbilityState.GetSourceAmmo();
if (SourceWeapon != none && SourceWeapon.GetMyTemplateName() == 'ProximityMine' ||
SourceAmmo != none && SourceAmmo.GetMyTemplateName() == 'ProximityMine')
{
// Override the amount of Lost-attracting noise generated by Proximity Mine if it is thrown or launched.
OverrideTuple.Data[0].i = 0;
}
}
return ELR_NoInterrupt;
}