//------------------------------------------------------------------------ void CScriptBind_MatchMaking::AttachTo( CMatchMakingHandler* pMatchMaking, CGameLobbyManager *pLobbyManager ) { m_pLobbyManager = pLobbyManager; IScriptTable *pScriptTable = pMatchMaking->GetScriptTable(); if (pScriptTable) { SmartScriptTable thisTable(m_pSS); thisTable->Delegate(GetMethodsTable()); pScriptTable->SetValue("bindings", thisTable); } }
//------------------------------------------------------------------------ void CScriptBind_Inventory::AttachTo(CInventory* pInventory) { IScriptTable *pScriptTable = pInventory->GetEntity()->GetScriptTable(); if (pScriptTable) { SmartScriptTable thisTable(m_pSS); thisTable->SetValue("__this", ScriptHandle(pInventory)); thisTable->Delegate(GetMethodsTable()); pScriptTable->SetValue("inventory", thisTable); } }
//------------------------------------------------------------------------ void CScriptBind_Weapon::AttachTo(CWeapon *pWeapon) { IScriptTable *pScriptTable = ((CItem *)pWeapon)->GetEntity()->GetScriptTable(); if (pScriptTable) { SmartScriptTable thisTable(m_pSS); thisTable->SetValue("__this", ScriptHandle(pWeapon->GetEntityId())); thisTable->Delegate(GetMethodsTable()); pScriptTable->SetValue("weapon", thisTable); } }
//------------------------------------------------------------------------ void CScriptBind_Item::AttachTo(CItem *pItem) { IScriptTable *pScriptTable = pItem->GetEntity()->GetScriptTable(); if (pScriptTable) { SmartScriptTable thisTable(m_pSS); thisTable->SetValue("__this", ScriptHandle(pItem->GetEntityId())); thisTable->Delegate(GetMethodsTable()); pScriptTable->SetValue("item", thisTable); } }
//------------------------------------------------------------------------ void CScriptBind_Actor::AttachTo(CActor *pActor) { IScriptTable *pScriptTable = pActor->GetEntity()->GetScriptTable(); if (pScriptTable) { SmartScriptTable thisTable(m_pSS); thisTable->SetValue("__this", ScriptHandle(pActor->GetEntityId())); thisTable->Delegate(GetMethodsTable()); pScriptTable->SetValue("actor", thisTable); } }
//------------------------------------------------------------------------ void CScriptBind_Vehicle::AttachTo(IVehicle *pVehicle) { IScriptTable *pScriptTable = pVehicle->GetEntity()->GetScriptTable(); if (!pScriptTable) return; SmartScriptTable thisTable(gEnv->pScriptSystem); thisTable->SetValue("vehicleId", ScriptHandle(pVehicle->GetEntityId())); thisTable->Delegate(GetMethodsTable()); pScriptTable->SetValue("vehicle", thisTable); SmartScriptTable seatTable(gEnv->pScriptSystem); pScriptTable->SetValue("Seats", seatTable); }
void CScriptBind_NetworkBuilding::AttachTo( CNetworkBuilding *pInteractiveObject ) { IScriptTable *pScriptTable = pInteractiveObject->GetEntity()->GetScriptTable(); if (pScriptTable) { SmartScriptTable thisTable(m_pSS); thisTable->SetValue("__this", ScriptHandle(pInteractiveObject->GetEntityId())); thisTable->Delegate(GetMethodsTable()); pScriptTable->SetValue("networkBuilding", thisTable); } m_NetworkBuildingMap.insert(TNetworkBuildingMap::value_type(pInteractiveObject->GetEntityId(), pInteractiveObject)); }
//------------------------------------------------------------------------ bool CScriptControlledPhysics::Init(IGameObject *pGameObject) { CScriptableBase::Init(gEnv->pScriptSystem, gEnv->pSystem, 1); SetGameObject(pGameObject); pGameObject->EnablePhysicsEvent(true, eEPE_OnPostStepLogged); RegisterGlobals(); RegisterMethods(); SmartScriptTable thisTable(gEnv->pScriptSystem); thisTable->SetValue("__this", ScriptHandle(GetEntityId())); thisTable->Delegate(GetMethodsTable()); GetEntity()->GetScriptTable()->SetValue("scp", thisTable); return true; }