9 IEntity m_targetVehicle;
17 ChimeraCharacter character = ChimeraCharacter.Cast(taskExecutor.GetControlledEntity());
21 if (!character.IsInVehicle())
24 CompartmentAccessComponent compartmentAccessComponent = CompartmentAccessComponent.Cast(character.FindComponent(CompartmentAccessComponent));
25 if (!compartmentAccessComponent)
28 BaseCompartmentSlot compartmentSlot = compartmentAccessComponent.GetCompartment();
32 Vehicle vehicle = Vehicle.Cast(compartmentSlot.GetOwner());
40 Vehicle vehicle = GetVehicleExecutorIsIn(taskExecutor);
44 SCR_FuelNode fuelNode = SCR_FuelNode.Cast(vehicle.FindComponent(SCR_FuelNode));
48 float maxFuel = fuelNode.GetMaxFuel();
49 float currentFuel = fuelNode.GetFuel();
50 float fuelPercent = currentFuel / maxFuel;
52 return fuelPercent <= GetFuelLimit();
56 static float GetFuelLimit()
63 return supportEntity.GetFuelLimit();
69 override string GetMapDescriptorText()
71 return GetTaskListTaskText();
75 void SetTargetVehicle(IEntity targetVehicle)
78 m_targetVehicle = targetVehicle;
82 IEntity GetTargetVehicle()
84 return m_targetVehicle;
90 super.SetRequester(requester);
97 void OnRefuelingFinished(SCR_FuelNode fuelNode, IEntity refueler)
99 if (!fuelNode || !refueler)
102 IEntity vehicle = fuelNode.GetOwner();
106 if (GetTargetVehicle() != vehicle)
119 supportEntity.FailTask(
this);
123 IEntity assigneeControlledEntity = assignee.GetControlledEntity();
124 if (!assigneeControlledEntity || assigneeControlledEntity != refueler)
126 supportEntity.FailTask(
this);
130 float currentFuel, maxFuel;
131 currentFuel = fuelNode.GetFuel();
132 maxFuel = fuelNode.GetMaxFuel();
133 float percent = currentFuel / maxFuel;
136 supportEntity.FinishTask(
this);
145 SetEventMask(EntityEvent.INIT | EntityEvent.FRAME);
146 SetFlags(EntityFlags.NO_TREE | EntityFlags.NO_LINK);
151 SCR_FuelNode.s_OnRefuelingFinished.Insert(OnRefuelingFinished);
161 SCR_FuelNode.s_OnRefuelingFinished.Remove(OnRefuelingFinished);