Things without a death animation will now disappear when killed.
Also removed some debug info and added some checks for passability in pathfinding to avoid long searches when the source or destination is impassable. This was SVN commit r4495.
This commit is contained in:
parent
500483ef2c
commit
0df95f3e8f
@ -71,6 +71,16 @@ bool CAStarEngine::findPath(
|
||||
mGoal->setDestination(dest);
|
||||
mGoal->setRadius(radius);
|
||||
|
||||
if( !mGoal->isPassable(src, player) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( radius==0 && !mGoal->isPassable(dest, player) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AStarNode *start = getFreeASNode();
|
||||
start->coord = mGoal->getTile(src);
|
||||
start->parent = NULL;
|
||||
@ -145,7 +155,7 @@ bool CAStarEngine::findPath(
|
||||
|
||||
if (mSolved && best!=NULL)
|
||||
{
|
||||
debug_printf("Number of nodes searched: %d\n", iterations);
|
||||
//debug_printf("Number of nodes searched: %d\n", iterations);
|
||||
constructPath(best);
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,6 @@ void CEntity::update( size_t timestep )
|
||||
}
|
||||
break;
|
||||
case CEntityOrder::ORDER_PRODUCE:
|
||||
debug_printf("calling processProduce once\n");
|
||||
processProduce( current );
|
||||
m_orderQueue.pop_front();
|
||||
break;
|
||||
|
@ -385,12 +385,17 @@ bool CEntity::Kill( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(arg
|
||||
|
||||
g_EntityManager.SetDeath(true);
|
||||
|
||||
|
||||
if( m_actor )
|
||||
if( m_actor && m_actor->GetRandomAnimation( "death" ) != m_actor->GetRandomAnimation( "idle" ) )
|
||||
{
|
||||
m_actor->SetEntitySelection( "death" );
|
||||
m_actor->SetRandomAnimation( "death", true );
|
||||
}
|
||||
else
|
||||
{
|
||||
g_UnitMan.RemoveUnit( m_actor );
|
||||
delete( m_actor );
|
||||
m_actor = NULL;
|
||||
}
|
||||
|
||||
return( true );
|
||||
}
|
||||
|
@ -489,12 +489,11 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times
|
||||
// The pathfinder will push its result in front of the current order
|
||||
if( !g_Pathfinder.requestAvoidPath( me, current, action->m_MinRange + 2.0f ) )
|
||||
{
|
||||
popOrder(); // Nothing we can do.. maybe we'll find a better target
|
||||
m_actor->SetRandomAnimation( "idle" );
|
||||
return false;
|
||||
m_actor->SetRandomAnimation( "idle" ); // Nothing we can do.. maybe we'll find a better target
|
||||
popOrder();
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user