static void RequestUpdateCallback(MySyncEntity sync, ref RequestPositionUpdateMsg msg, MyNetworkClient sender) { if (false && Sync.IsServer || sync.IsResponsibleForUpdate) { sync.UpdatePosition(); } }
private void RequestPositionUpdate() { // This mechanic is here when entity starts moving by actions of local player which are not transfered to server // Local player is now moving entity, but owner does not update it and sending updates. This requests updates. if (MyMultiplayer.Static != null && MyMultiplayer.Static.FrameCounter - m_lastUpdateFrame > m_sleepTimeForRequest) { // Request owner update var reqMsg = new RequestPositionUpdateMsg(); reqMsg.EntityId = Entity.EntityId; if (false) { MySession.Static.SyncLayer.SendMessageToServer(ref reqMsg); } else { MySession.Static.SyncLayer.SendMessage(ref reqMsg, GetResponsiblePlayer()); } ResetUpdateTimer(); } }
private void RequestPositionUpdate() { if (MyMultiplayer.Static == null) { return; } Debug.Assert(MySandboxGame.Static != null); // This mechanic is here when entity starts moving by actions of local player which are not transfered to server // Local player is now moving entity, but owner does not update it and sending updates. This requests updates. bool timeForUpdate; if (MyFakes.NEW_POS_UPDATE_TIMING) { timeForUpdate = (MySandboxGame.Static.UpdateTime - m_lastUpdateTime).Seconds > (m_sleepTimeForRequest / MyEngineConstants.UPDATE_STEPS_PER_SECOND); } else { timeForUpdate = MyMultiplayer.Static.FrameCounter - m_lastUpdateFrame >= m_sleepTimeForRequest; } if (timeForUpdate) { // Request owner update var reqMsg = new RequestPositionUpdateMsg(); reqMsg.EntityId = Entity.EntityId; if (false) { MySession.Static.SyncLayer.SendMessageToServer(ref reqMsg); } else { MySession.Static.SyncLayer.SendMessage(ref reqMsg, GetResponsiblePlayer()); } ResetUpdateTimer(); } }