#include "anti_rush"

#include "beast/checkpoint_spawner"
#include "beast/teleport_zone"

const bool blAntiRushEnabled = false; // You can change this to have AntiRush mode enabled or disabled
const float flSurvivalVoteAllow = g_EngineFuncs.CVarGetFloat( "mp_survival_voteallow" );

void MapInit()
{
    RegisterCheckPointSpawnerEntity();
    ANTI_RUSH::EntityRegister( blAntiRushEnabled );

    if( g_Engine.mapname == "deliver1" )
	{
		g_SurvivalMode.SetStartOn( false );

		if( flSurvivalVoteAllow > 0 )
			g_EngineFuncs.CVarSetFloat( "mp_survival_voteallow", 0 );
	}
}

void TurnOnSurvival(CBaseEntity@ pActivator, CBaseEntity@ pCaller, USE_TYPE useType, float flValue)
{
	g_EngineFuncs.CVarSetFloat( "mp_survival_voteallow", flSurvivalVoteAllow ); // Revert to the original cvar setting as per server

	if( g_SurvivalMode.IsEnabled() && g_SurvivalMode.MapSupportEnabled() && !g_SurvivalMode.IsActive() )
		g_SurvivalMode.Activate( true );
}
// Bastard thing won't trigger from bsp
void Osprey2ForceTakeoff(CBaseEntity@ pActivator, CBaseEntity@ pCaller, USE_TYPE useType, float flValue)
{
    g_EntityFuncs.FireTargets( "osprey2", null, null, useType, flValue, 0.0f );
}
