void OnStart()
{
PlayMusic("04_amb.ogg", true, 1, 4, 1, true);
AddTimer("AreaScrape_", RandFloat(3.0f,10.f), "TimerAreaScrape");
AddTimer("AreaStep_", RandFloat(3.0f,10.f), "TimerAreaStep");
AddUseItemCallback("", "DirtyContainer", "PutCont", "UseContainer", true);
AddEntityCollideCallback("Player", "AreaDoor", "EventDoor", true, 1);
SetLocalVarInt("BarrelCheck", 0);
}
void TimerAreaScrape(string &in asTimer)
{
int iRand = RandInt(1, 6);
PlaySoundAtEntity(asTimer+iRand, "15_wall_crawl.snt", asTimer+iRand, 1, false);
AddTimer("EndRadial", 4.0f, "TimerEndRadial");
AddTimer(asTimer, RandFloat(15.0f, 30.0f), "TimerAreaScrape");
}
void TimerAreaStep(string &in asTimer)
{
int iRand = RandInt(1, 6);
PlaySoundAtEntity(asTimer+iRand, "scare_wood_creak_walk.snt", asTimer+iRand, 1, false);
AddTimer("EndRadial", 4.0f, "TimerEndRadial");
AddTimer(asTimer, RandFloat(15.0f, 30.0f), "TimerAreaStep");
}
void EventDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door", false, false);
SetSwingDoorDisableAutoClose("Door", true);
PlaySoundAtEntity("creak", "joint_door_move_special.snt", "Door", 1, false);
PlaySoundAtEntity("Wind", "general_wind_whirl", "Player", 2, false);
PlaySoundAtEntity("scare", "react_scare.snt", "Player", 0.75f, false);
PlaySoundAtEntity("SoundBong", "scare_tingeling.snt", "Player", 0.0f, false);
PlayMusic("18_amb.ogg", true, 1.0f, 0, 0, true);
CreateParticleSystemAtEntity("PSDoor_3", "ps_dust_push.ps", "Door", false);
CreateParticleSystemAtEntity("PSDoor_4", "ps_dust_push.ps", "Door", false);
GiveSanityDamage(10, true);
AddTimer("", 2, "TimerStopSound");
AddTimer("Door", 0, "TimerMoveDoor");
}
void TimerMoveDoor(string &in asTimer)
{
if(GetLocalVarInt("VarDoor") == 50) return;
AddLocalVarInt("VarDoor", 1);
AddTimer(asTimer, 0.03, "TimerMoveDoor");
AddPropForce(asTimer, 70, 0, 0, "world");
}
void TimerStopSound(string &in asTimer)
{
StopSound("creak", 0.4);
}
void TurnLiquidValve(string &in asEntityName, int alState)
{
if(alState == 1)
{
CreateParticleSystemAtEntity("liquidps", "ps_liquid_epoxy.ps", "PS", false);
CreateParticleSystemAtEntity("splat", "ps_liquid_epoxy_splatt.ps", "PS_1", true);
PlaySoundAtEntity("turnon", "12_valve_stuck", asEntityName, 0, false);
PlaySoundAtEntity("hdfg", "12_epoxy_flow", asEntityName, 0, true);
AddTimer("fillcontainer", 5.0f, "TimerFillContainer");
}
}
void TimerFillContainer(string &in asTimer)
{
SetPropActiveAndFade("Empty", false, 0.5f);
SetPropActiveAndFade("Clean", true, 0.5f);
SetEntityActive("PutCont", false);
AddPlayerSanity(2);
}
void InteractCallback(string &in asEntity)
{
if(GetLocalVarInt("ContainerUsed") == 0) SetMessage("Messages", "Place", 0);
return; //Stops the script completely
SetWheelStuckState("ValveStuck", 0, false);
}
void UseContainer(string &in asEntity, string &in asItem)
{
PlaySoundAtEntity("plss", "puzzle_place_jar", asEntity, 0.0f, false);
SetWheelStuckState("ValveStuck", 0, true);
SetEntityActive("Empty", true);
SetLocalVarInt("ContainerUsed", 1);
}
void ContainerOnBarrelCheck()
{
if(GetLocalVarInt("BarrelCheck") == 1)
{
//WHAT TO DO IF BARREL IS ALREADY CLEANED
}
else if(GetLocalVarInt("BarrelCheck") != 1)
{
//WHAT TO DO IF BARREL HAVEN'T CLEANED YET
}
}//<- this one