示例#1
0
void CInventoryOwner::OnItemDrop			(CInventoryItem *inventory_item)
{
	CGameObject	*object = smart_cast<CGameObject*>(this);
	VERIFY		(object);
	object->callback(GameObject::eOnItemDrop)(inventory_item->object().lua_game_object());

	detach		(inventory_item);
}
示例#2
0
bool CUsableScriptObject::use(CGameObject* who_use)
{
	VERIFY(who_use);
	CGameObject* pThis = smart_cast<CGameObject*>(this); VERIFY(pThis);
	
	pThis->callback(GameObject::eUseObject)(pThis->lua_game_object(),who_use->lua_game_object());

	return true;
}
void	anim_script_callback::update( CGameObject &O )
{
	if( !is_set )
			return;
	if(!on_end && !on_begin)
		return;
	O.callback		(GameObject::eScriptAnimation)	( on_end );
	on_end		= false;
	on_begin	= false;
}
示例#4
0
void CInventoryOwner::OnItemSlot	(CInventoryItem *inventory_item, EItemPlace previous_place)
{
	/************************************************** added by Ray Twitty (aka Shadows) START **************************************************/
	// Колбек перемещения предмета в слот
	CGameObject	*object = smart_cast<CGameObject*>(this);
	VERIFY		(object);
	object->callback(GameObject::eOnItemSlot)(inventory_item->object().lua_game_object());
	/*************************************************** added by Ray Twitty (aka Shadows) END ***************************************************/

	attach		(inventory_item);
}
bool CUsableScriptObject::use(CGameObject* who_use)
{
	VERIFY(who_use);
	CGameObject* pThis = smart_cast<CGameObject*>(this); VERIFY(pThis);
	
	if ( pThis->lua_game_object() && pThis->lua_game_object()->m_door && (pThis->lua_game_object()->m_door->is_blocked(doors::door_state_open) || pThis->lua_game_object()->m_door->is_blocked(doors::door_state_closed)) )
		return false;

	pThis->callback(GameObject::eUseObject)(pThis->lua_game_object(),who_use->lua_game_object());

	return true;
}
示例#6
0
void CInventoryOwner::OnItemTake			(CInventoryItem *inventory_item)
{
	CGameObject	*object = smart_cast<CGameObject*>(this);
	VERIFY		(object);
	object->callback(GameObject::eOnItemTake)(inventory_item->object().lua_game_object());

	attach		(inventory_item);

	if(m_tmp_active_slot_num!=NO_ACTIVE_SLOT && inventory_item->GetSlot()==m_tmp_active_slot_num)
	{
		inventory().Activate(m_tmp_active_slot_num);
		m_tmp_active_slot_num	= NO_ACTIVE_SLOT;
	}
}