3 protected const float MAX_GETOUT_SPEED_METER_PER_SEC_SQ = 17.36138889;
4 protected const float MAX_GETOUT_ALTITUDE_AGL_METERS = 3;
7 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
12 ChimeraCharacter character = ChimeraCharacter.Cast(pUserEntity);
16 CharacterControllerComponent controller = character.GetCharacterController();
17 if (controller && controller.IsUnconscious())
20 BaseCompartmentSlot targetCompartment = GetCompartmentSlot();
21 if (!targetCompartment)
24 CompartmentAccessComponent compartmentAcess = character.GetCompartmentAccessComponent();
25 if (!compartmentAcess)
28 if (!compartmentAcess.GetOutVehicle(GetRelevantDoorIndex(pUserEntity),
false))
31 super.PerformAction(pOwnerEntity, pUserEntity);
35 override bool CanBePerformedScript(IEntity user)
37 ChimeraCharacter character = ChimeraCharacter.Cast(user);
41 CharacterControllerComponent controller = character.GetCharacterController();
42 if (controller && controller.IsUnconscious())
45 CompartmentAccessComponent compartmentAccess = character.GetCompartmentAccessComponent();
46 if (!compartmentAccess)
49 if (!compartmentAccess.IsInCompartment())
52 if (compartmentAccess.IsGettingIn() || compartmentAccess.IsGettingOut())
55 BaseCompartmentSlot compartment = compartmentAccess.GetCompartment();
60 Vehicle vehicle = Vehicle.Cast(
GetOwner().GetRootParent());
64 Physics phys = vehicle.GetPhysics();
68 vector velocity = phys.GetVelocity();
70 if ((velocity.LengthSq()) > MAX_GETOUT_SPEED_METER_PER_SEC_SQ)
75 HelicopterControllerComponent helicopterController = HelicopterControllerComponent.Cast(vehicle.GetVehicleController());
76 if (helicopterController)
78 VehicleHelicopterSimulation simulation = VehicleHelicopterSimulation.Cast(helicopterController.GetBaseSimulation());
79 if (simulation && simulation.GetAltitudeAGL() > MAX_GETOUT_ALTITUDE_AGL_METERS)
84 BaseCompartmentSlot thisCompartment = GetCompartmentSlot();
85 return thisCompartment == compartment;
89 override bool CanBeShownScript(IEntity user)
91 return CanBePerformed(user);
95 override bool GetActionNameScript(out
string outName)
97 BaseCompartmentSlot compartment = GetCompartmentSlot();
105 outName = actionInfo.GetName();