void OnStart() 
{ 
    AddEntityCollideCallback("Player", "statueappear", "MonsterFunction", true, 1); 
    AddEntityCollideCallback("Player", "statueappear_1", "deadbodies", true, 1); 
    AddEntityCollideCallback("Player", "alldark", "CollideTeleportToDarkSide", true, 1); 
    AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
    AddEntityCollideCallback("Player", "metalheads", "metalheads", true, 1); 
    AddEntityCollideCallback("Player", "metalheads2", "metalheads2", true, 1); 
    SetEntityPlayerInteractCallback("machineroomkey", "spawn_func", true);
    AddUseItemCallback("", "crowbar", "crowbardoor", "CrowbarOnDoor", true);
    AddEntityCollideCallback("crowbar_joint_1", "door_script_1", "crowbarfunc", true, 1);
} 
void CrowbarOnDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
}
void crowbarfunc(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("crowbardoor", 0.0f);
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);
}
void spawn_func(string &in item)
{
SetEntityActive("armour_rusty_complete_4", false);
SetEntityActive("armour_rusty_complete_3", false);
SetEntityActive("armour_rusty_complete_2", false);
SetEntityActive("armour_rusty_complete_1", false);
SetEntityActive("armour_rusty_complete_11", true);
SetEntityActive("armour_rusty_complete_12", true);
SetEntityActive("armour_rusty_complete_13", true);
SetEntityActive("armour_rusty_complete_14", true);
SetEntityActive("armour_rusty_complete_15", true);
}
void CollideTeleportToDarkSide(string &in asParent, string &in asChild, int alState)
{
    FadeOut(0.3);
    
    AddTimer("scare", 0.3f, "TimerPlayerReact");    
    AddTimer("breath", 2.0f, "TimerPlayerReact");    
    AddTimer("breathl", 4.0f, "TimerPlayerReact");
    AddTimer("breathl", 6.0f, "TimerPlayerReact");
    
    AddTimer("TeleportHowl", 0.5f, "TimerTeleportHowl");    
    AddTimer("TeleportDone", 3.5f, "TimerTelportDone");
    
    PlaySoundAtEntity("stomp","scare_wall_stomp","Player", 0, false);
    PlaySoundAtEntity("darkamb","07_amb_breath","Player", 5, true);
    PlaySoundAtEntity("howl","guardian_activated.snt","Player", 0, false);
    
    FadePlayerFOVMulTo(4.0f, 4.0f);
    SetRadialBlurStartDist(0.1f);
    FadeRadialBlurTo(1.0f, 5.0f);
    
    StartEffectFlash(0.2, 0.1,0.3);
    
    StopMusic(0.3f, 0);
    StartScreenShake(0.1, 4.7, 0.05, 0.5);
    
    FadePlayerFOVMulTo(0.5, 3);
    FadeGlobalSoundVolume(1,2);
    SetPlayerActive(true);
    FadePlayerFOVMulTo(1.0f, 0.5f);
    FadeRadialBlurTo(0.0f, 1.0f);
    FadeIn(3);
    ChangePlayerStateToNormal();
    
    
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("chained_prisoner_1", true); 
    SetEntityActive("chained_prisoner_2", true); 
    SetEntityActive("armour_rusty_complete_1", true); 
    SetEntityActive("armour_rusty_complete_2", true); 
    SetEntityActive("armour_rusty_complete_3", true); 
    SetEntityActive("armour_rusty_complete_4", true); 
    SetEntityActive("torch_static01_nosound_5", true); 
    SetEntityActive("torch_static01_nosound_6", true); 
    SetEntityActive("torch_static_green_1", true); 
    SetEntityActive("torch_static_green_2", true); 
    SetEntityActive("torch_static_green_3", true); 
    SetEntityActive("torch_static_green_4", true); 
    SetEntityActive("torch_static01_nosound_7", false); 
    SetEntityActive("torch_static01_nosound_2", false); 
    SetEntityActive("torch_static01_nosound_3", false); 
    SetEntityActive("torch_static01_nosound_4", false); 
}
void metalheads(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("armour_rusty_complete_5", true); 
SetEntityActive("armour_rusty_complete_6", true); 
SetEntityActive("armour_rusty_complete_7", true); 
}
void metalheads2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("armour_rusty_complete_8", false); 
SetEntityActive("armour_rusty_complete_9", false); 
SetEntityActive("armour_rusty_complete_10", false); 
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door2", true, true);
 
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false); 
 
PlaySoundAtEntity("", "react_scare", "Player", 0, false);  PlaySoundAtEntity("", "close_door.snt", "Player", 0, false); 
 
GiveSanityDamage(5.0f, true);
}