Fix aliens being selectable by default (#900)
Broken in 6a382830a9
This change also allows you to make selectable insects with selectable=1 in scene file
dev-buzzingcars
parent
967fb9e30f
commit
7fadf7bad5
|
@ -1041,7 +1041,7 @@ void COldObject::Read(CLevelParserLine* line)
|
||||||
SetAnimateOnReset(line->GetParam("reset")->AsBool(false));
|
SetAnimateOnReset(line->GetParam("reset")->AsBool(false));
|
||||||
if (Implements(ObjectInterfaceType::Controllable))
|
if (Implements(ObjectInterfaceType::Controllable))
|
||||||
{
|
{
|
||||||
SetSelectable(line->GetParam("selectable")->AsBool(true));
|
SetSelectable(line->GetParam("selectable")->AsBool(IsSelectableByDefault(m_type)));
|
||||||
}
|
}
|
||||||
if (Implements(ObjectInterfaceType::JetFlying))
|
if (Implements(ObjectInterfaceType::JetFlying))
|
||||||
{
|
{
|
||||||
|
@ -3174,3 +3174,17 @@ float COldObject::GetLightningHitProbability()
|
||||||
}
|
}
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool COldObject::IsSelectableByDefault(ObjectType type)
|
||||||
|
{
|
||||||
|
if ( type == OBJECT_MOTHER ||
|
||||||
|
type == OBJECT_ANT ||
|
||||||
|
type == OBJECT_SPIDER ||
|
||||||
|
type == OBJECT_BEE ||
|
||||||
|
type == OBJECT_WORM ||
|
||||||
|
type == OBJECT_MOBILEtg )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -302,6 +302,12 @@ protected:
|
||||||
void TransformCrashSphere(Math::Sphere &crashSphere) override;
|
void TransformCrashSphere(Math::Sphere &crashSphere) override;
|
||||||
void TransformCameraCollisionSphere(Math::Sphere& collisionSphere) override;
|
void TransformCameraCollisionSphere(Math::Sphere& collisionSphere) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Check if given object type should be selectable by default
|
||||||
|
* \note This is a default value for the selectable= parameter and can still be overriden in the scene file or using the \a selectinsect cheat
|
||||||
|
*/
|
||||||
|
static bool IsSelectableByDefault(ObjectType type);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Gfx::CEngine* m_engine;
|
Gfx::CEngine* m_engine;
|
||||||
Gfx::CLightManager* m_lightMan;
|
Gfx::CLightManager* m_lightMan;
|
||||||
|
|
Loading…
Reference in New Issue