From e655fb88446da691f1bc1d905b6e3a7d4b7a28cb Mon Sep 17 00:00:00 2001 From: yavl Date: Sun, 10 Feb 2019 02:56:28 +0900 Subject: [PATCH] Add Tarzan-mode non-readable first commit (todo: cleanup and fixes etc) yavl/teeworlds-infclassR#78 --- src/game/gamecore.cpp | 9 ++++++--- src/game/server/entities/character.cpp | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/game/gamecore.cpp b/src/game/gamecore.cpp index 4b6ffdf94..3733982dd 100644 --- a/src/game/gamecore.cpp +++ b/src/game/gamecore.cpp @@ -366,9 +366,12 @@ void CCharacterCore::Tick(bool UseInput, CParams* pParams) float DragSpeed = pTuningParams->m_HookDragSpeed; // add force to the hooked player - pCharCore->m_Vel.x = SaturatedAdd(-DragSpeed, DragSpeed, pCharCore->m_Vel.x, Accel*Dir.x*1.5f); - pCharCore->m_Vel.y = SaturatedAdd(-DragSpeed, DragSpeed, pCharCore->m_Vel.y, Accel*Dir.y*1.5f); - + if(!((m_Infected && pCharCore->m_Infected && !pCharCore->m_HookProtected) || + (!m_Infected && !pCharCore->m_Infected && !pCharCore->m_HookProtected))) { // ignore for zombies{ // ignore for humans + pCharCore->m_Vel.x = SaturatedAdd(-DragSpeed, DragSpeed, pCharCore->m_Vel.x, Accel*Dir.x*1.5f); + pCharCore->m_Vel.y = SaturatedAdd(-DragSpeed, DragSpeed, pCharCore->m_Vel.y, Accel*Dir.y*1.5f); + } + // add a little bit force to the guy who has the grip m_Vel.x = SaturatedAdd(-DragSpeed, DragSpeed, m_Vel.x, -Accel*Dir.x*0.25f); m_Vel.y = SaturatedAdd(-DragSpeed, DragSpeed, m_Vel.y, -Accel*Dir.y*0.25f); diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index c78188c04..2288fb6b0 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -554,10 +554,7 @@ void CCharacter::UpdateTuningParam() { pTuningParams->m_Gravity = 0.0f; } - if(GetPlayer()->HookProtectionEnabled()) - { pTuningParams->m_PlayerHooking = 0; - } if(GetClass() == PLAYERCLASS_GHOUL) { @@ -1997,6 +1994,11 @@ void CCharacter::Tick() { CoreTickParams.m_HookGrabTime = g_Config.m_InfBatHookTime*SERVER_TICK_SPEED; } + if(m_Core.m_HookedPlayer > -1 && GameServer()->m_apPlayers[m_Core.m_HookedPlayer] && + !GameServer()->m_apPlayers[m_Core.m_HookedPlayer]->HookProtectionEnabled()) + { + CoreTickParams.m_HookGrabTime = 999*SERVER_TICK_SPEED; + } CoreTickParams.m_HookMode = m_HookMode; vec2 PrevPos = m_Core.m_Pos; @@ -3204,6 +3206,13 @@ void CCharacter::Snap(int SnappingClient) if(pCharacter->m_HookTick < 0) pCharacter->m_HookTick = 0; } + if(m_Core.m_HookedPlayer > -1 && GameServer()->m_apPlayers[m_Core.m_HookedPlayer] && + !GameServer()->m_apPlayers[m_Core.m_HookedPlayer]->HookProtectionEnabled()) + { + pCharacter->m_HookTick -= (999 - 1) * SERVER_TICK_SPEED - SERVER_TICK_SPEED/5; + if(pCharacter->m_HookTick < 0) + pCharacter->m_HookTick = 0; + } /* INFECTION MODIFICATION END *****************************************/ pCharacter->m_AttackTick = m_AttackTick;