#include "../beast/player_blocker"
#include "../beast/replace_weapon_sprites"

#include "nvision"

#include "items/item_elixer"
#include "items/item_herbs"
#include "items/item_telegram"

#include "monsters/basemonster"
#include "weapons/baseweapon"

const bool blAllyNpcGodmode = true;// Set this to false if you want to let key npcs become mortal (at risk of level restarts)
const bool blLanternModeToggle = false;// Set this to true if you want to switch between lantern and flashlight using "nvision_mode" console command

void MapInit()
{
	HLWanted_WeaponsRegister();
	HLWanted_MonstersRegister();
	REPLACE_WEAPON_SPRITES::SetReplacements( "wanted", "health_syringe", "weapon_medkit" );

	HLWanted_Elixer::Register();
	HLWanted_Herbs::Register();
	HLWanted_Telegram::Register();

	LanternMode( blLanternModeToggle );
	
	g_EngineFuncs.CVarSetFloat( "mp_hevsuit_voice", 0 );
	g_EngineFuncs.CVarSetFloat( "mp_banana", 0 );
	g_EngineFuncs.CVarSetFloat( "mp_npckill", 2 );

	g_Hooks.RegisterHook( Hooks::Player::PlayerSpawn, SetRoganCharacter );
}

void MapStart()
{
	if( blAllyNpcGodmode )
		AddNpcGodmode();
}
// Nightvision, but configured to emulate a lantern effect
void LanternMode(bool blAllowToggle = false)
{
	NightVision::iRadius = NightVision::iBrightness = 16;
	NightVision::iPosition = NightVision::CENTER;
	NightVision::szSndFLight = NightVision::szSndHudNV = "wanted/items/flashlight1.wav";
	NightVision::Enable( Vector( 128, 128, 128 ) );// Init and set color

	if( !blAllowToggle )
		@NightVision::cmdNVSetMode = null;
}

HookReturnCode SetRoganCharacter(CBasePlayer@ pPlayer)
{
	if( pPlayer is null || !pPlayer.IsConnected() )
		return HOOK_CONTINUE;

	if( pPlayer.entindex() == 1 && g_EngineFuncs.GetInfoKeyBuffer( pPlayer.edict() ).GetValue( "model" ) != "wnt_rogan" )
		pPlayer.SetOverriddenPlayerModel( "wnt_rogan" );

	return HOOK_CONTINUE;
}
