some stuff
This commit is contained in:
@@ -12,23 +12,6 @@
|
||||
#include "steam/steam_gameserver.h"
|
||||
#endif
|
||||
|
||||
|
||||
IFileSystem *filesystem;
|
||||
|
||||
IRenderContext *g_pRenderContext;
|
||||
IGameWindow *g_pMainWindow;
|
||||
|
||||
static CEngineVars s_vars;
|
||||
CEngineVars *g_pEngineVars = &s_vars;
|
||||
EngineConsts_t *g_pEngineConstants;
|
||||
|
||||
INetworkBase *g_pClientBridge;
|
||||
INetworkBase *g_pPublicConnection;
|
||||
INetworkBase *g_pCurrentConnection;
|
||||
|
||||
IPhysics *g_pPhysics;
|
||||
IPhysicsWorld *g_pPhysicsWorld;
|
||||
|
||||
class CFunnyGameBridge: public IEngineBridge
|
||||
{
|
||||
virtual void Init() override;
|
||||
@@ -81,9 +64,17 @@ uint32_t NET_ServerCallback( NetCallback_t *pCallback )
|
||||
g_pCurrentConnection->SendPacket({&stClassSync, sizeof(stClassSync), pCallback->m_ullUserConnection, PACKET_MUST_ARRIVE});
|
||||
}
|
||||
|
||||
int iIndex = -1;
|
||||
CBaseEntity *pEntity;
|
||||
pEntity = EntitySystem()->CreateByClassname("player");
|
||||
pEntity = EntitySystem()->CreateByClassname("player", &iIndex);
|
||||
pEntity->Spawn();
|
||||
|
||||
SetLocalEntity_t stLocalEntity = {
|
||||
k_EMessage_PlayerSetLocalEntity,
|
||||
iIndex,
|
||||
};
|
||||
if (g_pCurrentConnection)
|
||||
g_pCurrentConnection->SendPacket({&stLocalEntity, sizeof(stLocalEntity), pCallback->m_ullUserConnection, PACKET_MUST_ARRIVE});
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -149,13 +140,29 @@ void NET_ProcessPacket( INetworkBase *pBase )
|
||||
switch (pPacket->m_eType)
|
||||
{
|
||||
case MESSAGE_PLAYER_JOINED:
|
||||
// online packets don't generate these
|
||||
if (g_pEngineConstants->m_bIsDedicated)
|
||||
break;
|
||||
pBase->RecievePacket();
|
||||
V_printf("Hi %s\n",pPacket->m_playerJoined.m_szPlayerName);
|
||||
pEntity = EntitySystem()->CreateByClassname("player");
|
||||
pEntity->Spawn();
|
||||
{
|
||||
|
||||
// online packets don't generate these
|
||||
if (g_pEngineConstants->m_bIsDedicated)
|
||||
break;
|
||||
|
||||
pBase->RecievePacket();
|
||||
|
||||
int iIndex = -1;
|
||||
V_printf("Hi %s\n",pPacket->m_playerJoined.m_szPlayerName);
|
||||
for ( int i = 0; i < 2; i++ )
|
||||
{
|
||||
pEntity = EntitySystem()->CreateByClassname("player", &iIndex);
|
||||
pEntity->Spawn();
|
||||
}
|
||||
|
||||
SetLocalEntity_t stLocalEntity = {
|
||||
k_EMessage_PlayerSetLocalEntity,
|
||||
iIndex,
|
||||
};
|
||||
if (g_pCurrentConnection)
|
||||
g_pCurrentConnection->SendPacket({&stLocalEntity, sizeof(stLocalEntity), 0, PACKET_MUST_ARRIVE});
|
||||
}
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user