Merge pull request #994 from DavivaD/dev-issue-658

Thumper & Recycler Enhancements.
1008-fix
krzys_h 2017-10-22 18:22:06 +02:00 committed by GitHub
commit 6b1dd5dd8b
2 changed files with 109 additions and 4 deletions

View File

@ -376,5 +376,5 @@ bool CTaskRecover::Abort()
CObject* CTaskRecover::SearchRuin()
{
return CObjectManager::GetInstancePointer()->FindNearest(nullptr, m_recoverPos, {OBJECT_RUINmobilew1, OBJECT_RUINmobilew2, OBJECT_RUINmobilet1, OBJECT_RUINmobilet2, OBJECT_RUINmobiler1, OBJECT_RUINmobiler2}, 40.0f/g_unit);
return CObjectManager::GetInstancePointer()->FindNearest(nullptr, m_recoverPos, {OBJECT_RUINmobilew1, OBJECT_RUINmobilew2, OBJECT_RUINmobilet1, OBJECT_RUINmobilet2, OBJECT_RUINmobiler1, OBJECT_RUINmobiler2, OBJECT_RUINdoor, OBJECT_RUINsupport, OBJECT_RUINradar}, 40.0f/g_unit);
}

View File

@ -363,13 +363,110 @@ bool CTaskTerraform::Terraform()
type = pObj->GetType();
if ( type == OBJECT_NULL ) continue;
if ( type == OBJECT_TEEN34 ) // stone?
if ( type == OBJECT_TEEN34 ||
type == OBJECT_POWER ||
type == OBJECT_ATOMIC ||
type == OBJECT_STONE ||
type == OBJECT_URANIUM ||
type == OBJECT_METAL ||
type == OBJECT_BULLET ||
type == OBJECT_BBOX ||
type == OBJECT_KEYa ||
type == OBJECT_KEYb ||
type == OBJECT_KEYc ||
type == OBJECT_KEYd ||
type == OBJECT_TNT ||
type == OBJECT_NEST ||
type == OBJECT_BOMB ||
type == OBJECT_PLANT0 ||
type == OBJECT_PLANT1 ||
type == OBJECT_PLANT2 ||
type == OBJECT_PLANT3 ||
type == OBJECT_PLANT4 ||
type == OBJECT_PLANT5 ||
type == OBJECT_PLANT6 ||
type == OBJECT_PLANT7 ||
type == OBJECT_PLANT15 ||
type == OBJECT_PLANT16 ||
type == OBJECT_PLANT17 ||
type == OBJECT_PLANT18 ||
type == OBJECT_PLANT19 ||
type == OBJECT_MUSHROOM1 ||
type == OBJECT_MUSHROOM2 ||
type == OBJECT_FACTORY ||
type == OBJECT_STATION ||
type == OBJECT_CONVERT ||
type == OBJECT_REPAIR ||
type == OBJECT_DESTROYER ||
type == OBJECT_ENERGY ||
type == OBJECT_LABO ||
type == OBJECT_PARA ||
type == OBJECT_START ||
type == OBJECT_END ||
type == OBJECT_EGG ||
type == OBJECT_RUINmobilew1 ||
type == OBJECT_RUINmobilew2 ||
type == OBJECT_RUINmobilet1 ||
type == OBJECT_RUINmobilet2 ||
type == OBJECT_RUINdoor ||
type == OBJECT_RUINsupport ||
type == OBJECT_RUINradar ||
type == OBJECT_BARRIER0 ||
type == OBJECT_APOLLO4 ) // almost everything?
{
dist = Math::Distance(m_terraPos, pObj->GetPosition());
if ( dist > 20.0f ) continue;
if (type == OBJECT_BULLET ||
type == OBJECT_NEST ||
type == OBJECT_EGG) // Alien Organic?
{
if ( dist > 5.0f ) continue;
m_engine->GetPyroManager()->Create(Gfx::PT_FRAGO, pObj);
}
else if (type == OBJECT_TNT ||
type == OBJECT_BOMB) // Explosives?
{
if ( dist > 5.0f ) continue;
m_engine->GetPyroManager()->Create(Gfx::PT_EXPLOT, pObj);
dynamic_cast<CDamageableObject*>(m_object)->DamageObject(DamageType::Explosive, 0.9f);
}
else if (type == OBJECT_PLANT0 ||
type == OBJECT_PLANT1 ||
type == OBJECT_PLANT2 ||
type == OBJECT_PLANT3 ||
type == OBJECT_PLANT4 ||
type == OBJECT_PLANT5 ||
type == OBJECT_PLANT6 ||
type == OBJECT_PLANT7 ||
type == OBJECT_PLANT15 ||
type == OBJECT_PLANT16 ||
type == OBJECT_PLANT17 ||
type == OBJECT_PLANT18 ||
type == OBJECT_PLANT19 ||
type == OBJECT_MUSHROOM1 ||
type == OBJECT_MUSHROOM2) // Plants?
{
if ( dist > 7.5f ) continue;
m_engine->GetPyroManager()->Create(Gfx::PT_EGG, pObj);
}
else if (type == OBJECT_FACTORY ||
type == OBJECT_STATION ||
type == OBJECT_CONVERT ||
type == OBJECT_REPAIR ||
type == OBJECT_DESTROYER ||
type == OBJECT_ENERGY ||
type == OBJECT_LABO ||
type == OBJECT_PARA) // Buildings?
{
if ( dist > 15.0f ) continue;
dynamic_cast<CDamageableObject*>(pObj)->DamageObject(DamageType::Explosive, 0.2f);
}
else // Other?
{
if ( dist > 5.0f ) continue;
m_engine->GetPyroManager()->Create(Gfx::PT_FRAGT, pObj);
}
}
else
{
if ( !pObj->Implements(ObjectInterfaceType::Movable) ) continue;
@ -388,6 +485,14 @@ bool CTaskTerraform::Terraform()
if (type == OBJECT_SPIDER) actionType = MSS_BACK1;
motion->SetAction(actionType, 0.8f+Math::Rand()*0.3f);
dynamic_cast<CBaseAlien*>(pObj)->SetFixed(true); // not moving
if ( dist > 5.0f ) continue;
m_engine->GetPyroManager()->Create(Gfx::PT_EXPLOO, pObj);
}
else if ( type == OBJECT_BEE || type == OBJECT_WORM )
{
if ( dist > 5.0f ) continue;
m_engine->GetPyroManager()->Create(Gfx::PT_EXPLOO, pObj);
}
}
}