void OnStart()
{
}
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "room101key", "room101", "UsedKeyOnDoor", true);
AddUseItemCallback("", "room100key", "room100", "UsedKeyOnDoor", true);
AddUseItemCallback("", "hollow_needle_1", "padlock_rusty_1", "unlock_prison_section_1", true);
AddEntityCollideCallback("Player", "prison_1swingarea", "func_slam", true, 1);
SetEntityPlayerInteractCallback("prison_1", "func_slam", true);
SetEntityCallbackFunc("room100key", "OnPickup");
SetEntityCallbackFunc("NOTETWO", "OnPickup");
}
void func_slam(string &in asEntity)
{
SetPropHealth("prison_1", 0.0f);
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);
StartEffectFlash(0.2f , 1, 2.0f);
AddTimer("", 0.5f, "prisondoorbreak");
}
void prisondoorbreak(string &in asTimer)
{
SetEntityActive("prison_1_broken", true);
}
void unlock_prison_section_1(string &in asItem, string &in asEntity)
{
SetPropHealth("padlock_rusty_1", 0.0f);
SetEntityActive("padlock_broken_1", true);
RemoveItem("hollow_needle_1");
SetEntityActive("padlock_rusty_1", false);
PlaySoundAtEntity("", "break_wood_metal.snt", "padlockarea_1", 0 , false);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", asEntity, "room101", 0, false);
PlaySoundAtEntity("", asEntity, "room100", 0, false);
RemoveItem(asItem);
}
void OnPickup(string &in asEntity, string &in type)
{
if(asEntity == "room100key")
{
SetEntityActive("poofer1", true);
ShowEnemyPlayerPosition("poofer1");
PlaySoundAtEntity("", "04_break.snt", "poofer1", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
StartPlayerLookAt("poofer1",7,7,"");
GiveSanityDamage(20.0f, true);
AddTimer("",1.5f,"StopLook");
}
else if(asEntity == "NOTETWO")
{
SetSwingDoorLocked("room102",false,false);
SetEntityActive("brute1",true);
ShowEnemyPlayerPosition("brute1");
PlaySoundAtEntity("", "react_breath_fast.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
StartPlayerLookAt("brute1",7,7,"");
GiveSanityDamage(30.0f, true);
AddTimer("",1.0f,"StopLook");
StartScreenShake(0.5f, 1.5f, 1, 2);
PlaySoundAtEntity("","explosion_rock_large.snt","brute1",0,false);
}
}
void StopLook(string &in asTimer)
{
StopPlayerLookAt();
}