67 lines
1.6 KiB
Ucode
67 lines
1.6 KiB
Ucode
/*
|
|
--------------------------------------------------------------
|
|
ObjCondition_Counter_SE
|
|
--------------------------------------------------------------
|
|
|
|
Enhanced version if ObjCondition_Counter.
|
|
|
|
Allows to disable condition reset() on deactivation.
|
|
Usefull if condition needs to be activated/deactivated multiple
|
|
times during the mission.
|
|
|
|
- Counting disabled when objective is not active - fixed in KF v1054 too
|
|
- Completion count doesn't get lowered after player death
|
|
- ConditionIsValid() returns false if ObjOwner is none
|
|
|
|
Author : PooSH
|
|
Original Author : Alex Quick
|
|
|
|
--------------------------------------------------------------
|
|
*/
|
|
|
|
|
|
class ObjCondition_Counter_SE extends ObjCondition_Counter
|
|
editinlinenew;
|
|
|
|
var(ObjCondition_Counter) bool bResetOnDeactivation;
|
|
|
|
var transient float TotalDifficultyModifier;
|
|
|
|
function ConditionDeActivated()
|
|
{
|
|
if ( bResetOnDeactivation )
|
|
Reset();
|
|
else {
|
|
bActive = false;
|
|
}
|
|
}
|
|
|
|
|
|
// don't let counter lower after player death
|
|
function float GetTotalDifficultyModifier()
|
|
{
|
|
if ( TotalDifficultyModifier == 0 )
|
|
TotalDifficultyModifier = super.GetTotalDifficultyModifier();
|
|
return TotalDifficultyModifier;
|
|
}
|
|
|
|
function Reset()
|
|
{
|
|
super.Reset();
|
|
TotalDifficultyModifier = 0;
|
|
}
|
|
|
|
// Dunno why, but sometimes it is called if condition is inactive (even if other or none objective is running)
|
|
function bool ConditionIsValid()
|
|
{
|
|
if ( GetObjOwner() == none )
|
|
return false; // wtf?
|
|
|
|
return super.ConditionIsValid();
|
|
}
|
|
|
|
defaultproperties
|
|
{
|
|
bResetOnDeactivation=True
|
|
}
|