Exemplo n.º 1
0
IMPLEMENT_RMI(CGameRules, ClPlayerLeft)
{
	my->CallHook("PlayerLeft", params.entityId, params.name);

	NOTIFY_UI_MP( PlayerLeft(params.entityId, params.name) );
	return true;
}
Exemplo n.º 2
0
IMPLEMENT_RMI(CGameRules, ClPlayerJoined)
{
	auto ent = oohh::GetEntityFromId(params.entityId);
	my->CallHook("PlayerEntered", ent);

	NOTIFY_UI_MP( PlayerJoined(params.entityId, params.name) );
	return true;
}
Exemplo n.º 3
0
IMPLEMENT_RMI(CGameRules, ClEnteredGame)
{
	if(!gEnv->bServer && m_pGameFramework->GetClientActor())
	{
		CActor* pActor = GetActorByChannelId(m_pGameFramework->GetClientActor()->GetChannelId());
		if(pActor)
		{
			int status[2];
			status[0] = GetTeam(pActor->GetEntityId());
			status[1] = pActor->GetSpectatorMode();
			m_pGameplayRecorder->Event(pActor->GetEntity(), GameplayEvent(eGE_Connected, 0, 0, (void*)status));
			NOTIFY_UI_MP( EnteredGame() );
		}
	}
	return true;
}
Exemplo n.º 4
0
//------------------------------------------------------------------------
IMPLEMENT_RMI(CGameRules, ClRenameEntity)
{
	IEntity *pEntity=gEnv->pEntitySystem->GetEntity(params.entityId);
	if (pEntity)
	{
		string old=pEntity->GetName();
		pEntity->SetName(params.name.c_str());

		CryLogAlways("$8%s$o renamed to $8%s", old.c_str(), params.name.c_str());

		NOTIFY_UI_MP( PlayerRenamed( params.entityId, params.name ) );

		// if this was a remote player, check we're not spectating them.
		//	If we are, we need to trigger a spectator hud update for the new name
		EntityId clientId = g_pGame->GetIGameFramework()->GetClientActorId();
		if(gEnv->bMultiplayer && params.entityId != clientId)
		{
			CActor* pClientActor = static_cast<CActor *>(g_pGame->GetIGameFramework()->GetClientActor());
		}
	}

	return true;
}
Exemplo n.º 5
0
IMPLEMENT_RMI(CGameRules, ClPlayerLeft)
{
	NOTIFY_UI_MP( PlayerLeft(params.entityId, params.name) );
	return true;
}
Exemplo n.º 6
0
//---------------------------------------------------
void CGameRules::UpdateScoreBoardItem(EntityId id, const string name, int kills, int deaths)
{
	NOTIFY_UI_MP( UpdateScoreBoardItem(id, name, kills, deaths) );
}
Exemplo n.º 7
0
IMPLEMENT_RMI(CGameRules, ClEnteredGame)
{
	CPlayer *pClientActor = static_cast<CPlayer*>(m_pGameFramework->GetClientActor());

	if (pClientActor)
	{
		IEntity *pClientEntity = pClientActor->GetEntity();
		const EntityId clientEntityId = pClientEntity->GetId();

		if(!gEnv->bServer)
		{
			int status[2];
			status[0] = GetTeam(clientEntityId);
			status[1] = pClientActor->GetSpectatorMode();
			m_pGameplayRecorder->Event(pClientEntity, GameplayEvent(eGE_Connected, 0, 0, (void*)status));
		}

		if (g_pGame->GetHostMigrationState() != CGame::eHMS_NotMigrating)
		{
			eHostMigrationState hostMigrationState = g_pGame->GetGameLobby()->GetMatchMakingHostMigrationState();
			if (hostMigrationState < eHMS_ReconnectClient)
			{
				CryLog("CGameRules::ClEnteredGame() received a left over message from previous server, ignoring it");
				return true;
			}

			CryLog("CGameRules::ClEnteredGame() We have our client actor ('%s'), send migration params", pClientEntity->GetName());

			// Request various bits
			GetGameObject()->InvokeRMI(SvHostMigrationRequestSetup(), *m_pHostMigrationParams, eRMI_ToServer);
			SAFE_DELETE(m_pHostMigrationParams);

			pClientActor->GetEntity()->SetPos(m_pHostMigrationClientParams->m_position);
			pClientActor->SetViewRotation(m_pHostMigrationClientParams->m_viewQuat);

			if (m_pHostMigrationClientParams->m_hasValidVelocity)
			{
				pe_action_set_velocity actionVel;
				actionVel.v = m_pHostMigrationClientParams->m_velocity;
				actionVel.w.zero();
				IPhysicalEntity *pPhysicalEntity = pClientEntity->GetPhysics();
				if (pPhysicalEntity)
				{
					pPhysicalEntity->Action(&actionVel);
				}
			}

			CPlayerMovementController *pPMC = static_cast<CPlayerMovementController *>(pClientActor->GetMovementController());
			if (pPMC)
			{
				// Force an update through so that the aim direction gets set correctly
				pPMC->PostUpdate(0.f);
			}

			if (m_pHostMigrationClientParams->m_pSelectedItemClass)
			{
				CItem *pItem = pClientActor->GetItemByClass(m_pHostMigrationClientParams->m_pSelectedItemClass);
				if (pItem)
				{
					EntityId itemId = pItem->GetEntityId();
					if (pClientActor->GetCurrentItemId() != itemId)
					{
						pClientActor->SelectItem(itemId, false);
					}
				}
			}

			m_pHostMigrationClientParams->m_doneEnteredGame = true;
			if (m_pHostMigrationClientParams->IsDone())
			{
				SAFE_DELETE(m_pHostMigrationClientParams);
			}

			if (!gEnv->bServer)
			{
				// todo: ui
			}

			m_hostMigrationClientHasRejoined = true;
		}
		else
		{
			NOTIFY_UI_MP( EnteredGame() );
		}
	}

	return true;
}