Example #1
0
void CCharacter::Tick()
{
	if(m_pPlayer->m_ForceBalanced)
	{
		char Buf[128];
		str_format(Buf, sizeof(Buf), "You were moved to %s due to team balancing", GameServer()->m_pController->GetTeamName(m_pPlayer->GetTeam()));
		GameServer()->SendBroadcast(Buf, m_pPlayer->GetCID());
		
		m_pPlayer->m_ForceBalanced = false;
	}

	m_Core.m_Input = m_Input;
	m_Core.Tick(true);
	
	// handle death-tiles and leaving gamelayer
	if(GameServer()->Collision()->GetCollisionAt(m_Pos.x+m_ProximityRadius/3.f, m_Pos.y-m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameServer()->Collision()->GetCollisionAt(m_Pos.x+m_ProximityRadius/3.f, m_Pos.y+m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameServer()->Collision()->GetCollisionAt(m_Pos.x-m_ProximityRadius/3.f, m_Pos.y-m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameServer()->Collision()->GetCollisionAt(m_Pos.x-m_ProximityRadius/3.f, m_Pos.y+m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameLayerClipped(m_Pos))
	{
		Die(m_pPlayer->GetCID(), WEAPON_WORLD);
	}
	
	// handle Weapons
	HandleWeapons();

	// Previnput
	m_PrevInput = m_Input;
	return;
}
Example #2
0
void CCharacter::Tick()
{
    if(m_pPlayer->m_ForceBalanced)
    {
        char Buf[128];
        str_format(Buf, sizeof(Buf), "You were moved to %s due to team balancing", GameServer()->m_pController->GetTeamName(m_pPlayer->GetTeam()));
        GameServer()->SendBroadcast(Buf, m_pPlayer->GetCID());

        m_pPlayer->m_ForceBalanced = false;
    }

    m_Core.m_Input = m_Input;
    m_Core.Tick(true);

    int Col = GameServer()->Collision()->GetCollisionAt(m_Pos.x, m_Pos.y);
    if((Col <= 7 && Col&CCollision::COLFLAG_DEATH) || GameLayerClipped(m_Pos)) //seriously.
    {
        // handle death-tiles and leaving gamelayer
        m_Core.m_Frozen = 0; //we just unfreeze so it never counts as a sacrifice
        Die(m_pPlayer->GetCID(), WEAPON_WORLD);
    }

    if (m_Core.m_Frozen)
    {
        if (m_ActiveWeapon != WEAPON_NINJA)
            GiveNinja(true);
        else if (m_Ninja.m_ActivationTick + 5 * Server()->TickSpeed() < Server()->Tick())
            m_Ninja.m_ActivationTick = Server()->Tick(); // this should fix the end-of-ninja missprediction bug

        //openfng handles this in mod gamectl
        //if ((m_Core.m_Frozen+1) % Server()->TickSpeed() == 0)
        //	GameServer()->CreateDamageInd(m_Pos, 0, (m_Core.m_Frozen+1) / Server()->TickSpeed());

        m_MoltenBy = -1;
        m_MoltenAt = -1;
    }
    else
    {
        if (m_ActiveWeapon == WEAPON_NINJA)
        {
            TakeNinja();
            m_MoltenAt = Server()->Tick();
        }
        m_FrozenBy = -1;
    }

    if (m_BloodTicks > 0)
    {
        if (m_BloodTicks % g_Config.m_SvBloodInterval == 0)
            GameServer()->CreateDeath(m_Core.m_Pos, m_pPlayer->GetCID());
        --m_BloodTicks;
    }

    // handle Weapons
    HandleWeapons();

    // Previnput
    m_PrevInput = m_Input;
    return;
}
Example #3
0
void CCharacter::Tick()
{
	m_Core.m_Input = m_Input;
	m_Core.Tick(true);

	// handle death-tiles and leaving gamelayer
	if(GameServer()->Collision()->GetCollisionAt(m_Pos.x+m_ProximityRadius/3.f, m_Pos.y-m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameServer()->Collision()->GetCollisionAt(m_Pos.x+m_ProximityRadius/3.f, m_Pos.y+m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameServer()->Collision()->GetCollisionAt(m_Pos.x-m_ProximityRadius/3.f, m_Pos.y-m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameServer()->Collision()->GetCollisionAt(m_Pos.x-m_ProximityRadius/3.f, m_Pos.y+m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameLayerClipped(m_Pos))
	{
		Die(m_pPlayer->GetCID(), WEAPON_WORLD);
	}

	// handle Weapons
	HandleWeapons();
}
void CCharacter::Tick()
{
	if(m_pPlayer->m_ForceBalanced)
	{
		char Buf[128];
		str_format(Buf, sizeof(Buf), "You were moved to %s due to team balancing", GameServer()->m_pController->GetTeamName(m_pPlayer->GetTeam()));
		GameServer()->SendBroadcast(Buf, m_pPlayer->GetCID());

		m_pPlayer->m_ForceBalanced = false;
	}

	m_Core.m_Input = m_Input;
	m_Core.Tick(true);

	// handle death-tiles and leaving gamelayer
	if(GameServer()->Collision()->GetCollisionAt(m_Pos.x+m_ProximityRadius/3.f, m_Pos.y-m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameServer()->Collision()->GetCollisionAt(m_Pos.x+m_ProximityRadius/3.f, m_Pos.y+m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameServer()->Collision()->GetCollisionAt(m_Pos.x-m_ProximityRadius/3.f, m_Pos.y-m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameServer()->Collision()->GetCollisionAt(m_Pos.x-m_ProximityRadius/3.f, m_Pos.y+m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
		GameLayerClipped(m_Pos))
	{
		Die(m_pPlayer->GetCID(), WEAPON_WORLD);
	}

	// handle Weapons
	HandleWeapons();

/* INFECTION MODIFICATION START ***************************************/
	if(GetClass() == PLAYERCLASS_HUNTER)
	{
		if(IsGrounded()) m_AirJumpCounter = 0;
		if(m_Core.m_TriggeredEvents&COREEVENT_AIR_JUMP && m_AirJumpCounter < 1)
		{
			m_Core.m_Jumped &= ~2;
			m_AirJumpCounter++;
		}
	}
	
	if(m_pClassChooser)
	{
		if(GetClass() != PLAYERCLASS_NONE)
		{
			GameServer()->m_World.DestroyEntity(m_pClassChooser);
			m_pClassChooser = 0;
		}
		else
		{
			m_pClassChooser->m_Pos = m_Pos;
			m_pClassChooser->SetCursor(vec2(m_Input.m_TargetX, m_Input.m_TargetY));
			
			if(m_Input.m_Fire&1)
			{
				int ccRes = m_pClassChooser->SelectClass();
				if(ccRes)
				{				
					GameServer()->m_World.DestroyEntity(m_pClassChooser);
					m_pClassChooser = 0;
					
					m_pPlayer->SetClass(ccRes);
				}
			}
		}
	}
/* INFECTION MODIFICATION END *****************************************/

	// Previnput
	m_PrevInput = m_Input;
	return;
}