#include "../point_checkpoint"
#include "anti_rush"

#include "../hl_weapons/weapon_hlmp5"

#include "../kmkz/func_global"

const bool blAntiRushEnabled = false; // You can change this to have AntiRush mode enabled or disabled

int DiffMode = 0; //Default DO NOT CHANGE HERE. this will be updated via mapping trigger_save/load.

void normal( CBaseEntity@ pActivator,CBaseEntity@ pCaller, USE_TYPE useType, float flValue ){
    DiffMode = 1;
	Register();
}

void extreme( CBaseEntity@ pActivator,CBaseEntity@ pCaller, USE_TYPE useType, float flValue ){
    DiffMode = 2;
	Register();
}

void Register(){
	g_Hooks.RegisterHook( Hooks::Player::PlayerSpawn, @PlayerSpawn );
}

HookReturnCode PlayerSpawn(CBasePlayer@ pPlayer){
    if( pPlayer is null or DiffMode == 0)
        return HOOK_CONTINUE;
    
	if(DiffMode == 1 )
    {
        pPlayer.pev.health = 100;
        pPlayer.pev.max_health = 100;
        pPlayer.pev.armortype = 100;
    }
    else if(DiffMode == 2 )
    {
        pPlayer.pev.health = 1;
        pPlayer.pev.max_health = 1;
        pPlayer.pev.armortype = 1;
    }
    
    return HOOK_CONTINUE;
}

array<ItemMapping@> CLASSIC_WEAPONS_LIST = 
{
    ItemMapping( "weapon_mp5", "weapon_hlmp5" ),
    ItemMapping( "weapon_9mmAR", "weapon_hlmp5" ),
    ItemMapping( "weapon_m16", "weapon_hlmp5" ),
    ItemMapping( "ammo_556clip", "ammo_9mmAR" ),
};

void MapInit()
{
	RegisterPointCheckPointEntity();
	RegisterFuncGlobal();
	
    RegisterHLMP5();

	ANTI_RUSH::EntityRegister( blAntiRushEnabled );
	
    g_ClassicMode.SetItemMappings( @CLASSIC_WEAPONS_LIST );
    g_ClassicMode.ForceItemRemap( true );
	
	g_EngineFuncs.ServerPrint( "Half-Life Hazardous Course 2 ( v1.6 ) - Download this campaign from scmapdb.com\n" );
}