12 if (state !=
EDamageState.DESTROYED || !m_Asset || !m_SupportEntity)
15 SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(SCR_DamageManagerComponent.GetDamageManager(m_Asset));
18 objectDmgManager.GetOnDamageStateChanged().Remove(OnObjectDamage);
19 GetGame().GetCallqueue().Remove(CheckEngineDrowned);
21 VehicleControllerComponent_SA vehicleController = VehicleControllerComponent_SA.Cast(m_Asset.FindComponent(VehicleControllerComponent_SA));
22 if (vehicleController)
23 vehicleController.GetOnEngineStop().Remove(CheckEngineDrowned);
26 m_SupportEntity.FailTask(
this);
30 void CheckEngineDrowned()
32 if (!m_Asset || !m_SupportEntity)
35 VehicleControllerComponent_SA vehicleController = VehicleControllerComponent_SA.Cast(m_Asset.FindComponent(VehicleControllerComponent_SA));
36 if (vehicleController && vehicleController.GetEngineDrowned())
38 vehicleController.GetOnEngineStop().Remove(CheckEngineDrowned);
39 GetGame().GetCallqueue().Remove(CheckEngineDrowned);
41 SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(SCR_DamageManagerComponent.GetDamageManager(m_Asset));
43 objectDmgManager.GetOnDamageStateChanged().Remove(OnObjectDamage);
45 m_SupportEntity.FailTask(
this);
50 override void RehookTaskAsset(IEntity
object)
57 SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(SCR_DamageManagerComponent.GetDamageManager(m_Asset));
59 objectDmgManager.GetOnDamageStateChanged().Insert(OnObjectDamage);
61 if (Vehicle.Cast(m_Asset))
63 VehicleControllerComponent_SA vehicleController = VehicleControllerComponent_SA.Cast(m_Asset.FindComponent(VehicleControllerComponent_SA));
64 if (vehicleController)
65 vehicleController.GetOnEngineStop().Insert(CheckEngineDrowned);
69 GetGame().GetCallqueue().CallLater(CheckEngineDrowned, 5000,
true);
74 override bool SetSupportEntity()
80 Print(
"ScenarioFramework: Task Defend support entity not found in the world, task won't be created!", LogLevel.ERROR);
95 SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(SCR_DamageManagerComponent.GetDamageManager(m_Asset));
97 objectDmgManager.GetOnDamageStateChanged().Insert(OnObjectDamage);
99 if (Vehicle.Cast(m_Asset))
101 VehicleControllerComponent_SA vehicleController = VehicleControllerComponent_SA.Cast(m_Asset.FindComponent(VehicleControllerComponent_SA));
102 if (vehicleController)
103 vehicleController.GetOnEngineStop().Insert(CheckEngineDrowned);
107 GetGame().GetCallqueue().CallLater(CheckEngineDrowned, 5000,
true);