Esempio n. 1
0
void CElementRPCs::SetElementAttachedOffsets ( NetBitStreamInterface& bitStream )
{
    ElementID ID;
    SPositionSync position ( true );
    SRotationDegreesSync rotation ( true );
    if ( bitStream.Read ( ID ) && position.Read ( bitStream ) && rotation.Read ( bitStream ) )
    {
        CClientEntity* pEntity = CElementIDs::GetElement ( ID );
        if ( pEntity )
        {
            pEntity->SetAttachedOffsets ( position.data.vecPosition, rotation.data.vecRotation );
        }
    }
}
Esempio n. 2
0
void CElementRPCs::AttachElements ( NetBitStreamInterface& bitStream )
{
    ElementID ID, usAttachedToID;
    CVector vecPosition, vecRotation;
    if ( bitStream.Read ( ID ) && bitStream.Read ( usAttachedToID ) &&
        bitStream.Read ( vecPosition.fX ) &&
        bitStream.Read ( vecPosition.fY ) &&
        bitStream.Read ( vecPosition.fZ ) &&
        bitStream.Read ( vecRotation.fX ) &&
        bitStream.Read ( vecRotation.fY ) &&
        bitStream.Read ( vecRotation.fZ ) )
    {
        CClientEntity* pEntity = CElementIDs::GetElement ( ID );
        CClientEntity* pAttachedToEntity = CElementIDs::GetElement ( usAttachedToID );
        if ( pEntity && pAttachedToEntity )
        {
            pEntity->SetAttachedOffsets ( vecPosition, vecRotation );
            pEntity->AttachTo ( pAttachedToEntity );
        }
    }
}