32 bool m_bTurretControl;
38 float m_fTurretLeftRight;
41 float m_fTurretDownUp;
47 private World actualWorld;
49 private SlotManagerComponent slotManager;
50 private SlotManagerComponent secondarySlotManager;
52 private int lastGear = 0;
59 array<EntitySlotInfo> vehicleSlotInfos = {};
60 slotManager.GetSlotInfos(vehicleSlotInfos);
64 IEntity slotEntity = slotInfo.GetAttachedEntity();
101 slotManager = SlotManagerComponent.Cast(m_Vehicle.FindComponent(SlotManagerComponent));
105 void findEntity(
World world)
109 GetTrackName().Split(
"_", strs,
true);
111 m_Vehicle =
GenericEntity.Cast(world.FindEntityByName(strs.Get(0)));
114 override void OnApply(
float time)
117 if (m_Vehicle && m_Vehicle_c && m_Vehicle_s)
121 int id = chanim.BindFloatVariable(
"VehicleSteering");
122 chanim.SetFloatVariable(
id,m_fSteering);
125 m_Vehicle_s.SetNoiseSteerSensitivity(0);
126 m_Vehicle_s.SetRoughnessSensitivity(0);
127 m_Vehicle_c.SetPersistentHandBrake(0);
128 m_Vehicle_s.GearboxSetEfficiencyState(m_fEfficiency);
133 m_Vehicle_l.SetLightsState(
ELightType.Head, m_bLightsOn, 0);
134 m_Vehicle_l.SetLightsState(
ELightType.Head, m_bLightsOn, 1);
138 if (m_bStartEngine && !m_Vehicle_c.IsEngineOn())
140 m_Vehicle_c.ForceStartEngine();
142 }
else if (!m_bStartEngine && m_Vehicle_c.IsEngineOn()) {
144 m_Vehicle_c.ForceStopEngine();
149 m_Vehicle_s.SetBreak(m_fBreak, m_bHandBrake);
152 if(m_fGear != lastGear)
154 m_Vehicle_s.SetGear(m_fGear);
159 m_Vehicle_s.SetClutch(m_fClutch);
162 m_Vehicle_s.SetThrottle(m_fThrottle);
165 m_Vehicle_s.SetSteering(m_fSteering);
168 if (slotManager && m_bTurretControl)
170 array<EntitySlotInfo> vehicleSlotInfos = {};
171 slotManager.GetSlotInfos(vehicleSlotInfos);
175 IEntity slotEntity = slotInfo.GetAttachedEntity();
185 turret.SetAimingAngles(m_fTurretLeftRight,m_fTurretDownUp);
188 turret.SetFireWeaponWanted(
true);
190 turret.SetFireWeaponWanted(
false);
195 secondarySlotManager = SlotManagerComponent.Cast(slotEntity.
FindComponent(SlotManagerComponent));
197 if (secondarySlotManager)
199 array<EntitySlotInfo> secondaryVehicleSlotInfos = {};
200 secondarySlotManager.GetSlotInfos(secondaryVehicleSlotInfos);
202 foreach (
EntitySlotInfo secondarySlotInfo : secondaryVehicleSlotInfos)
204 IEntity secondarySlotEntity = secondarySlotInfo.GetAttachedEntity();
206 if (!secondarySlotEntity)
213 secondaryTurret.SetAimingAngles(m_fTurretLeftRight,m_fTurretDownUp);
216 secondaryTurret.SetFireWeaponWanted(
true);