Skip to content

Commit

Permalink
Preserve client order of weapon physics
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Jun 2, 2024
1 parent 81f4c73 commit 26f7f32
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/game/server/gameworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "entity.h"
#include "gamecontext.h"
#include "gamecontroller.h"
#include "player.h"

#include <engine/shared/config.h>

Expand Down Expand Up @@ -214,13 +215,12 @@ void CGameWorld::Tick()
if(GameServer()->m_pController->IsForceBalanced())
GameServer()->SendChat(-1, TEAM_ALL, "Teams have been balanced");

// This is placed here so that certain weapon physics can happen before the regular Charecter Tick() to preserve physics accuracy
auto *pChar = m_apFirstEntityTypes[ENTTYPE_CHARACTER];
for(; pChar;)
// This is placed here so that certain weapon physics can happen before the regular Charecter Tick() to preserve physics accuracy.
// It is done in client order to preserve previous behavior.
for (int i = 0; i < MAX_CLIENTS; i++)
{
m_pNextTraverseEntity = pChar->m_pNextTypeEntity;
((CCharacter *)pChar)->WeaponTick();
pChar = m_pNextTraverseEntity;
CCharacter *pChar = GameServer()->m_apPlayers[i]->GetCharacter();
pChar->WeaponTick();
}

// update all objects
Expand Down

0 comments on commit 26f7f32

Please sign in to comment.