예제 #1
0
//------------------------------------------------------------------------
int CScriptBind_Item::SetExtensionActivation(IFunctionHandler *pH, const char *extension, bool activation)
{
	CItem *pItem = GetItem(pH);
	if (!pItem)
		return pH->EndFunction();

	bool ok = false;
	if (pItem)
	{
		if (activation)
			ok = pItem->GetGameObject()->ActivateExtension(extension);
		else
		{
			pItem->GetGameObject()->DeactivateExtension(extension);
			ok = true;
		}
	}
	if (!ok)
		pH->GetIScriptSystem()->RaiseError("Failed to %s extension %s", activation? "enable" : "disable", extension);
	return pH->EndFunction();
}
예제 #2
0
//------------------------------------------------------------------------
int CScriptBind_Item::GetExtensionParams(IFunctionHandler* pH, const char *extension, SmartScriptTable params)
{
	CItem * pItem = GetItem(pH);
	if (!pItem)
		return pH->EndFunction();

	bool ok = false;
	if (pItem)
		ok = pItem->GetGameObject()->GetExtensionParams(extension, params);
	if (!ok)
		pH->GetIScriptSystem()->RaiseError("Failed to set params for extension %s", extension);
	return pH->EndFunction();
}