server/CNetworkManager.cpp
// LIBRG_ENTITY_UPDATE
// gets triggered every time an entity is found within streamzone of a client's entity and was already created
// event can be rejected if the data was not changed
LIBRG_ENTITY_UPDATE
gets triggered every time an entity is found within streamzone of a client's entity and was already created
event can be rejected if the data was not changed
LIBRG_ENTITY_UPDATE gets triggered every time an entity is found within streamzone of a client ' s entity and was already created event can be rejected if the data was not changed
void CNetworkManager::on_entity_update(librg_event_t *event)
{
	if (!event->entity->user_data)
		return;
	if (event->entity->type == eNetworkEntityType::PLAYER)
	{
		CServerPlayer* player = (CServerPlayer*)event->entity->user_data;
		int size;
		if (player->syncType == eSyncType::SYNC_TYPE_ON_FOOT) size = sizeof(OnfootPlayerSyncPacket);
		else if (player->syncType == eSyncType::SYNC_TYPE_ON_FOOT_AIMING)size = sizeof(OnfootPlayerAimingSyncPacket);
		else if (player->syncType == eSyncType::SYNC_TYPE_IN_WATER)size = sizeof(InWaterPlayerSyncPacket);
		if (memcmp(player->lastSyncData, player->syncData, size) == 0)
		{
			librg_event_reject(event);
			return;
		}
		librg_data_wu8(event->data, player->syncType);
		librg_data_wptr(event->data, player->syncData, size);
	}
}
void CNetworkManager :: on_entity_update ( librg_event_t * event ) { if ( ! event -> entity -> user_data ) return ; if ( event -> entity -> type == eNetworkEntityType :: PLAYER ) { CServerPlayer * player = ( CServerPlayer * ) event -> entity -> user_data ; int size ; if ( player -> syncType == eSyncType :: SYNC_TYPE_ON_FOOT ) size = sizeof ( OnfootPlayerSyncPacket ) ; else if ( player -> syncType == eSyncType :: SYNC_TYPE_ON_FOOT_AIMING ) size = sizeof ( OnfootPlayerAimingSyncPacket ) ; else if ( player -> syncType == eSyncType :: SYNC_TYPE_IN_WATER ) size = sizeof ( InWaterPlayerSyncPacket ) ; if ( memcmp ( player -> lastSyncData , player -> syncData , size ) == 0 ) { librg_event_reject ( event ) ; return ; } librg_data_wu8 ( event -> data , player -> syncType ) ; librg_data_wptr ( event -> data , player -> syncData , size ) ; } }
LIBRG_ENTITY_UPDATE
gets triggered every time an entity is found within streamzone of a client's entity and was already created
event can be rejected if the data was not changed
LIBRG_ENTITY_UPDATE gets triggered every time an entity is found within streamzone of a client ' s entity and was already created event can be rejected if the data was not changed