void OnStart()
{
AddEntityCollideCallback("Player", "AreaBreath", "CollideAreaBreath", true, 1);
SetEntityPlayerInteractCallback("FakeCrank", "InteractWithCrank", true);
SetMessage("Messages", "chapter2", 0);
GiveSanityBoostSmall();
AddEntityCollideCallback("Player","AreaDustEnter","CollideDustPaper",true,1);
AddUseItemCallback("getoil", "DirtyContainer", "AreaGetOil", "UseContainerOnOil", false);
AddUseItemCallback("", "glass_container_oil_1", "FakeCrank", "OilContainerOnFakeCrank", false);
}
void CollideAreaBreath(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("rocks", "03_rock_move.snt", "AreaBreath_1", 0.0f, false);
CreateParticleSystemAtEntity("warnps", "ps_cave_monster_warn.ps", "AreaBreath_1", false);
StartScreenShake(0.01f, 0.5f, 2.0f, 3.5f);
PlaySoundAtEntity("breaths", "04_breath.snt", "AreaBreath_1", 0.0f, false);
PlaySoundAtEntity("rocksm", "03_rock_move.snt", "AreaBreath_1", RandFloat(2.0f,6.0f), false);
CreateParticleSystemAtEntity("breathps", "ps_cave_monster_breath.ps", "AreaBreath_1", false);
}
void CollideDustPaper(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("Wind", "general_wind_whirl", "Player", 2, false);
CreateParticleSystemAtEntity("PSDoor_3", "ps_dust_whirl.ps", "AreaDust", false);
}
void InteractWithCrank(string &in asEntity)
{
SetMessage("Messages", "NeedOil", 0);
AddQuest("InteractWithCrank", "Oil");
PlaySoundAtEntity("rocks", "16_lever_stuck.ogg", "FakeCrank", 0.0f, false);
}
void UseContainerOnOil(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);
AddTimer("AddContainer", 1.1f, "TimerAddContainer");
AddTimer("StartCrouch", 0.8f, "TimerCrouch");
AddTimer("StopCrouch", 1.4f, "TimerCrouch");
AddTimer("AddContainer", 1.6f, "TimerStopLookAt");
SetLocalVarInt("FilledContainer", 1);
SetEntityPlayerInteractCallback("AreaOil", "", false);
StartPlayerLookAt("AreaLookAtContainer", 3, 3, "");
}
void TimerAddContainer(string &in asTimer)
{
DestroyParticleSystem("ParticleSystem_42");
SetEntityActive("glass_container_oil_1", true);
CreateParticleSystemAtEntity("fill", "ps_oil_jar", "glass_container_oil_1", true);
PlaySoundAtEntity("slurp", "16_fill_oil", "glass_container_oil_1", 0.0f, false);
}
void TimerCrouch(string &in asTimer)
{
if(asTimer == "StartCrouch"){
SetPlayerCrouching(true);
PlaySoundAtEntity("crouch", "player_crouch", "Player", 0.0f, false);
PlaySoundAtEntity("slurp2", "16_water_stream", "glass_container_oil_1", 0.3f, false);
return;
}
SetPlayerCrouching(false);
PlaySoundAtEntity("stand", "player_stand", "Player", 0.0f, false);
}
void TimerStopLookAt(string &in asTimer)
{
StopPlayerLookAt();
StopSound("slurp2", 4.0f);
}
void EntityCallGlassContainer(string &in asEntity, string &in type)
{
DestroyParticleSystem("fill");
CreateParticleSystemAtEntity("oilsplah", "ps_oil_splash.ps", "AreaLookAtContainer", true);
SetEntityPlayerInteractCallback("AreaOil", "InteractAreaOil02", false);
}
void OilContainerOnFakeCrank(string &in asItem, string &in asEntity)
{
SetEntityActive("FakeCrank", false);
SetLeverStuckState(asEntity, 0, true);
SetEntityActive("crank_iron_1", true);
CreateParticleSystemAtEntity("oilsplah", "ps_oil_grease.ps", "PS", true);
PlaySoundAtEntity("stand", "16_grease_lever.ogg", "FakeCrank", 0.0f, false);
}
void MoveBridge(string &in asEntity, int LeverState)
{
if(LeverState == 1)
{
PlaySoundAtEntity("unstucksound", "16_bridge_unstuck", "ladder", 0.0f, false);
PlaySoundAtEntity("fall", "16_winch_bridge", "ladder", 1.0f, true);
AddTimer("hitground", 1.0f, "TimerBridgeHitGround");
StartScreenShake(0.05f, 0.5f, 0.1f, 0.3f);
SetEntityPlayerInteractCallback("bridge_lever_1", "", false);
SetMoveObjectStateExt("ladder", 2.66, 8, 8, 0.5, false);
GiveSanityBoostSmall();
PlayMusic("23_puzzle.ogg", false, 0.7f, 0, 10, false);
SetLeverStuckState(asEntity, LeverState, false);
}
void TimerBridgeHitGround(string &in asTimer)
{
StopSound("fall", 0.3f);
StartScreenShake(0.01f, 1.0f, 0.1f, 0.5f);
}
void OnEnter()
{
PlayMusic("16_amb.ogg", true, 0.7, 1, 0, true);
}
void OnLeave()
{
}