Skip to content

Commit

Permalink
Merge pull request colobot#994 from DavivaD/dev-issue-658
Browse files Browse the repository at this point in the history
Thumper & Recycler Enhancements.
  • Loading branch information
krzys-h authored Oct 22, 2017
2 parents ee0f3ff + ee35d35 commit 6b1dd5d
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/object/task/taskrecover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
111 changes: 108 additions & 3 deletions src/object/task/taskterraform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,109 @@ 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;

m_engine->GetPyroManager()->Create(Gfx::PT_FRAGT, pObj);
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
{
Expand All @@ -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);
}
}
}
Expand Down

0 comments on commit 6b1dd5d

Please sign in to comment.