reverted hook behavior (#1488)

This commit is contained in:
oy 2018-10-13 13:36:25 +02:00
parent 906baa5d2e
commit b580a8dbc6
2 changed files with 7 additions and 4 deletions

View file

@ -153,6 +153,8 @@ Objects = [
NetIntAny("m_HookX"),
NetIntAny("m_HookY"),
NetIntAny("m_HookDx"),
NetIntAny("m_HookDy"),
]),
NetObject("Character:CharacterCore", [

View file

@ -139,9 +139,7 @@ void CCharacterCore::Tick(bool UseInput)
{
m_HookedPlayer = -1;
m_HookState = HOOK_IDLE;
m_HookPos = vec2(0,0);
m_HookDir = vec2(0,0);
m_HookTick = 0;
m_HookPos = m_Pos;
}
}
@ -404,6 +402,8 @@ void CCharacterCore::Write(CNetObj_CharacterCore *pObjCore)
pObjCore->m_HookTick = m_HookTick;
pObjCore->m_HookX = round_to_int(m_HookPos.x);
pObjCore->m_HookY = round_to_int(m_HookPos.y);
pObjCore->m_HookDx = round_to_int(m_HookDir.x*256.0f);
pObjCore->m_HookDy = round_to_int(m_HookDir.y*256.0f);
pObjCore->m_HookedPlayer = m_HookedPlayer;
pObjCore->m_Jumped = m_Jumped;
pObjCore->m_Direction = m_Direction;
@ -420,7 +420,8 @@ void CCharacterCore::Read(const CNetObj_CharacterCore *pObjCore)
m_HookTick = pObjCore->m_HookTick;
m_HookPos.x = pObjCore->m_HookX;
m_HookPos.y = pObjCore->m_HookY;
m_HookDir = normalize(m_HookPos-m_Pos);
m_HookDir.x = pObjCore->m_HookDx/256.0f;
m_HookDir.y = pObjCore->m_HookDy/256.0f;
m_HookedPlayer = pObjCore->m_HookedPlayer;
m_Jumped = pObjCore->m_Jumped;
m_Direction = pObjCore->m_Direction;