32 lines
929 B
C
32 lines
929 B
C
// An idle rotor or zero speed alone is normal during takeoff, landing and reload.
|
|
// Confirm prolonged grounding, but recognize actual loss of flight capability.
|
|
class ERR_HelicopterAvailability
|
|
{
|
|
protected float m_fGroundedSince = -1;
|
|
|
|
string Check(float now, float spawnedAt, bool destroyed, bool disabled, bool livingPilot, bool playerControlled, bool servicing, float height, float speed)
|
|
{
|
|
if (destroyed) return "destroyed";
|
|
if (now - spawnedAt < 20000)
|
|
{
|
|
m_fGroundedSince = -1;
|
|
return "";
|
|
}
|
|
if (disabled) return "engine, rotor or airframe disabled";
|
|
if (playerControlled)
|
|
{
|
|
m_fGroundedSince = -1;
|
|
return "";
|
|
}
|
|
if (!livingPilot) return "no living pilot";
|
|
if (servicing || height > 5 || speed > 2)
|
|
{
|
|
m_fGroundedSince = -1;
|
|
return "";
|
|
}
|
|
if (m_fGroundedSince < 0) m_fGroundedSince = now;
|
|
if (now - m_fGroundedSince >= 60000) return "grounded for 60 seconds";
|
|
return "";
|
|
}
|
|
}
|