Пример #1
0
IC	T	*CScriptGameObject::action_planner()
{
	CAI_Stalker				*manager = smart_cast<CAI_Stalker*>(&object());
	if (!manager)
		ai().script_engine().script_log				(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member action_planner!");
	return					(&manager->brain());
}
bool CScriptGameObject::suitable_smart_cover					(CScriptGameObject* object)
{
	if (!object) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError, "CAI_Stalker::suitable_smart_cover null smart cover specified!");
		return							(false);
	}

	CAI_Stalker							*stalker = smart_cast<CAI_Stalker*>(&this->object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError, "CAI_Stalker : cannot access class member suitable_smart_cover!");
		return							(false);
	}

	smart_cover::object const* const	smart_object = smart_cast<smart_cover::object const*>(&object->object());
	if (!smart_object) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError, "CAI_Stalker : suitable_smart_cover: passed non-smart_cover object!");
		return							(false);
	}

	smart_cover::cover const& cover		= smart_object->cover();
	if (!cover.is_combat_cover())
		return							(true);

	CInventoryItem const* inventory_item= stalker->inventory().ActiveItem();
	if (inventory_item)
		return							(inventory_item->GetSlot() == 2);

	CInventoryItem const* best_weapon	= stalker->best_weapon();
	if (!best_weapon)
		return							(false);

	return								(best_weapon->GetSlot() == 2);
}
Пример #3
0
void CStalkerAnimationManager::script_play_callback(CBlend *blend)
{
	CAI_Stalker					*object = (CAI_Stalker*)blend->CallbackParam;
	VERIFY						(object);
	
	CStalkerAnimationManager	&animation_manager = object->animation();
	CStalkerAnimationPair		&pair = animation_manager.script();
	const SCRIPT_ANIMATIONS		&animations = animation_manager.script_animations();

#if 0
	Msg							(
		"%6d Script callback [%s]",
		Device.dwTimeGlobal,
		animations.empty()
		?
		"unknown"
		:
		animation_manager.m_skeleton_animated->LL_MotionDefName_dbg(animations.front().animation())
	);
#endif

	if	(
			pair.animation() && 
			!animations.empty() && 
			(pair.animation() == animations.front().animation())
		)
		animation_manager.pop_script_animation();

	animation_manager.m_call_script_callback	= true;

	pair.on_animation_end		();
}
Пример #4
0
void CScriptGameObject::set_sight		(const CMemoryInfo *memory_object, bool	torso_look)
{
	CAI_Stalker					*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker)
		ai().script_engine().script_log					(ScriptStorage::eLuaMessageTypeError,"CSightManager : cannot access class member set_sight!");
	else
		stalker->sight().setup	(memory_object,torso_look);
}
Пример #5
0
void CScriptGameObject::set_patrol_path		(LPCSTR path_name, const PatrolPathManager::EPatrolStartType patrol_start_type, const PatrolPathManager::EPatrolRouteType patrol_route_type, bool random)
{
	CAI_Stalker					*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker)
		ai().script_engine().script_log					(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member movement!");
	else
		stalker->movement().patrol().set_path		(path_name,patrol_start_type,patrol_route_type,random);
}
Пример #6
0
void CScriptGameObject::set_sight		(SightManager::ESightType sight_type, const Fvector *vector3d)
{
	CAI_Stalker					*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker)
		ai().script_engine().script_log					(ScriptStorage::eLuaMessageTypeError,"CSightManager : cannot access class member set_sight!");
	else
		stalker->sight().setup	(sight_type,vector3d);
}
Пример #7
0
void CScriptGameObject::set_sight		(CScriptGameObject *object_to_look, bool torso_look, bool fire_object, bool no_pitch)
{
	CAI_Stalker					*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker)
		ai().script_engine().script_log					(ScriptStorage::eLuaMessageTypeError,"CSightManager : cannot access class member set_sight!");
	else
		stalker->sight().setup	(CSightAction(&object_to_look->object(),torso_look,fire_object,no_pitch));
}
Пример #8
0
void  CScriptGameObject::set_detail_path_type	(DetailPathManager::EDetailPathType detail_path_type)
{
	CAI_Stalker					*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker)
		ai().script_engine().script_log					(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member movement!");
	else
		stalker->movement().set_detail_path_type	(detail_path_type);
}
Пример #9
0
void  CScriptGameObject::set_movement_type		(EMovementType movement_type)
{
	CAI_Stalker					*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker)
		ai().script_engine().script_log					(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member movement!");
	else
		stalker->movement().set_movement_type	(movement_type);
}
Пример #10
0
void  CScriptGameObject::set_desired_direction	(const Fvector *desired_direction)
{
	CAI_Stalker					*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker)
		ai().script_engine().script_log					(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member movement!");
	else
		stalker->movement().set_desired_direction	(desired_direction);
}
void CStalkerAnimationManager::legs_play_callback			(CBlend *blend)
{
	CAI_Stalker					*object = (CAI_Stalker*)blend->CallbackParam;
	VERIFY						(object);

	CStalkerAnimationPair		&pair = object->animation().legs();
	pair.on_animation_end		();
}
Пример #12
0
void CScriptGameObject::clear_animations		()
{
	CAI_Stalker			*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log		(ScriptStorage::eLuaMessageTypeError,"CGameObject : cannot access class member clear_animations!");
		return;
	}
	stalker->animation().clear_script_animations();
}
Пример #13
0
bool CScriptGameObject::weapon_unstrapped	() const
{
	CAI_Stalker		*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError,"CScriptGameObject : cannot access class member weapon_unstrapped!");
		return		(false);
	}
	return			(stalker->weapon_unstrapped());
}
Пример #14
0
MovementManager::EPathType CScriptGameObject::path_type					() const
{
	CAI_Stalker		*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log					(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member path_type!");
		return		(MovementManager::ePathTypeNoPath);
	}
	return			(stalker->movement().path_type());
}
Пример #15
0
MonsterSpace::EMentalState CScriptGameObject::target_mental_state		() const
{
	CAI_Stalker		*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log					(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member mental_state!");
		return		(MonsterSpace::eMentalStateDanger);
	}
	return			(stalker->movement().target_mental_state());
}
Пример #16
0
MonsterSpace::EMovementType CScriptGameObject::movement_type			() const
{
	CAI_Stalker		*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log					(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member movement_type!");
		return		(MonsterSpace::eMovementTypeStand);
	}
	return			(stalker->movement().movement_type());
}
Пример #17
0
void  CScriptGameObject::set_body_state			(EBodyState body_state)
{
	THROW						((body_state == eBodyStateStand) || (body_state == eBodyStateCrouch));
	CAI_Stalker					*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker)
		ai().script_engine().script_log					(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member movement!");
	else
		stalker->movement().set_body_state	(body_state);
}
Пример #18
0
float CScriptGameObject::max_ignore_monster_distance	() const
{
	CAI_Stalker			*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log		(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member max_ignore_monster_distance!");
		return			(0.f);
	}
	return				(stalker->memory().enemy().max_ignore_monster_distance());
}
Пример #19
0
void CScriptGameObject::restore_ignore_monster_threshold	()
{
	CAI_Stalker			*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log		(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member restore_ignore_monster_threshold!");
		return;
	}
	stalker->memory().enemy().restore_ignore_monster_threshold	();
}
Пример #20
0
int	CScriptGameObject::animation_count		() const
{
	CAI_Stalker			*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log		(ScriptStorage::eLuaMessageTypeError,"CGameObject : cannot access class member clear_animations!");
		return			(-1);
	}
	return				((int)stalker->animation().script_animations().size());
}
LPCSTR CScriptGameObject::get_dest_smart_cover_name		()
{
	CAI_Stalker*						stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member get_dest_smart_cover!");
		return							(0);
	}

	return								(stalker->movement().target_params().cover_id().c_str());
}
void CScriptGameObject::apply_loophole_direction_distance		(float value)
{
	CAI_Stalker							*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError, "CAI_Stalker : cannot access class member smart_cover_enter_distance!");
		return;
	}

	stalker->movement().apply_loophole_direction_distance	(value);
}
bool CScriptGameObject::movement_target_reached					()
{
	CAI_Stalker							*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError, "CAI_Stalker : cannot access class member movement_target_reached!");
		return							(false);
	}

	return								(stalker->movement().current_params().equal_to_target(stalker->movement().target_params()));
}
void CScriptGameObject::set_smart_cover_target_selector	()
{
	CAI_Stalker							*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member set_smart_cover_target_selector!");
		return;
	}

	stalker->movement().target_selector	(CScriptCallbackEx<void>());
}
void CScriptGameObject::lookout_max_time						(float value)
{
	CAI_Stalker							*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError, "CAI_Stalker : cannot access class member lookout_max_time!");
		return;
	}

	stalker->movement().lookout_max_time(value);
}
float const CScriptGameObject::lookout_min_time					() const
{
	CAI_Stalker							*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError, "CAI_Stalker : cannot access class member lookout_min_time!");
		return							(flt_max);
	}

	return								(stalker->movement().lookout_min_time());
}
bool CScriptGameObject::in_current_loophole_range				(Fvector object_position) const
{
	CAI_Stalker							*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError, "CAI_Stalker : cannot access class member object_in_loophole_range!");
		return							(false);
	}

	return								(stalker->movement().in_current_loophole_range (object_position));
}
void CScriptGameObject::use_smart_covers_only		(bool value)
{
	CAI_Stalker							*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member use_smart_covers_only!");
		return;
	}

	stalker->use_smart_covers_only		(value);
}
void CScriptGameObject::set_smart_cover_target						(CScriptGameObject *enemy_object)
{
	CAI_Stalker							*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member set_smart_cover_target!");
		return;
	}

	stalker->movement().target_params().cover_fire_object		(&enemy_object->object());
}
void CScriptGameObject::set_dest_loophole							()
{
	CAI_Stalker							*stalker = smart_cast<CAI_Stalker*>(&object());
	if (!stalker) {
		ai().script_engine().script_log	(ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member set_dest_loophole!");
		return;
	}

	stalker->movement().target_params().cover_loophole_id("");
}