void OnStart()
{AddUseItemCallback("", "key2", "door2", "KeyOnCellarDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "BreakDoor", "CollideAreaBreakDoor", true, 1);
AddUseItemCallback("crowbarondoor", "crowbar_1", "mansion_1","UseCrowbarOnDoor", true);
}
void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer(asEntity, 0.2, "TimerSwitchShovel");
PlaySoundAtEntity("pickupcrow","player_crouch.snt", "Player", 0.05, false);
//Remove callback incase player never touched door
SetEntityPlayerInteractCallback("mansion_1", "", true);
SetEntityPlayerInteractCallback("AreaUseCrowbar", "", true);
RemoveItem(asItem);
}
void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("attachshovel","puzzle_place_jar.snt", asTimer, 0, false);
SetEntityActive("crowbar_joint_1", true);
}
void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
GiveSanityBoostSmall();
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("mansion_1", false, false);
SetSwingDoorDisableAutoClose("mansion_1", true);
SetSwingDoorClosed("mansion_1", false,false);
PlaySoundAtEntity("break","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false);
AddPropImpulse("mansion_1", -3, 0, 0, "world");
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);
AddTimer("pushdoor", 0.1, "TimerPushDoor");
AddDebugMessage("Break door!", false);
}
void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("mansion_1", -1, 2, -4, "world");
AddTimer("doorclose", 1.1, "TimerDoorCanClose");
}
void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("mansion_1", false);
}