void CStalkerActionSmartTerrain::execute () { inherited::execute (); if (completed()) object().CObjectHandler::set_goal (eObjectActionStrapped,object().best_weapon()); object().sound().play (eStalkerSoundHumming,60000,10000); CSE_ALifeHumanAbstract *stalker = smart_cast<CSE_ALifeHumanAbstract*>(ai().alife().objects().object(m_object->ID())); VERIFY (stalker); VERIFY (stalker->m_smart_terrain_id != 0xffff); CALifeSmartTerrainTask *task = stalker->brain().smart_terrain().task(stalker); THROW2 (task,"Smart terrain is assigned but returns no task"); if (object().ai_location().game_vertex_id() != task->game_vertex_id()) { object().movement().set_path_type (MovementManager::ePathTypeGamePath); object().movement().set_game_dest_vertex(task->game_vertex_id()); return; } object().movement().set_path_type (MovementManager::ePathTypeLevelPath); if (object().movement().accessible(task->level_vertex_id())) { object().movement().set_level_dest_vertex (task->level_vertex_id()); Fvector temp = task->position(); object().movement().set_desired_position (&temp); return; } object().movement().set_nearest_accessible_position (task->position(),task->level_vertex_id()); }
void CStalkerActionSmartTerrain::execute () { inherited::execute (); #ifndef GRENADE_TEST if (completed()) object().CObjectHandler::set_goal (eObjectActionStrapped,object().best_weapon()); object().sound().play (eStalkerSoundHumming,60000,10000); CSE_ALifeHumanAbstract *stalker = smart_cast<CSE_ALifeHumanAbstract*>(ai().alife().objects().object(m_object->ID())); VERIFY (stalker); VERIFY (stalker->m_smart_terrain_id != 0xffff); CALifeSmartTerrainTask *task = stalker->brain().smart_terrain().task(stalker); THROW2 (task,"Smart terrain is assigned but returns no task"); if (object().ai_location().game_vertex_id() != task->game_vertex_id()) { object().movement().set_path_type (MovementManager::ePathTypeGamePath); object().movement().set_game_dest_vertex(task->game_vertex_id()); return; } object().movement().set_path_type (MovementManager::ePathTypeLevelPath); if (object().movement().accessible(task->level_vertex_id())) { object().movement().set_level_dest_vertex (task->level_vertex_id()); Fvector temp = task->position(); object().movement().set_desired_position (&temp); return; } object().movement().set_nearest_accessible_position (task->position(),task->level_vertex_id()); #else object().movement().set_desired_direction (0); object().movement().set_path_type (MovementManager::ePathTypeLevelPath); object().movement().set_detail_path_type (DetailPathManager::eDetailPathTypeSmooth); object().movement().set_body_state (eBodyStateStand); object().movement().set_movement_type (eMovementTypeStand); object().movement().set_mental_state (eMentalStateDanger); object().sight().setup (CSightAction(g_actor,true)); object().throw_target (g_actor->Position(), g_actor); if (object().throw_enabled()) { object().CObjectHandler::set_goal (eObjectActionFire1,object().inventory().ItemFromSlot(GRENADE_SLOT)); return; } object().CObjectHandler::set_goal (eObjectActionIdle,object().inventory().ItemFromSlot(GRENADE_SLOT)); #endif }
void CALifeMonsterDetailPathManager::target (const CALifeSmartTerrainTask &task) { target (task.game_vertex_id(),task.level_vertex_id(),task.position()); }