Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is only executed when the map is loaded for the first time.
- //Only happens once. Can be used for adding effects and callbacks that should not repeat.//
- void OnStart()
- {
- AddUseItemCallback("", "Crowbar", "DoorCrowbar", "UseCrowbarOnDoor", true);
- AddEntityCollideCallback(""CrowbarJoint", "AreaBreak", "BreakDoor", true, 1);
- }
- void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
- {
- RemoveItem(asItem);
- PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);
- AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");
- }
- void TimerPlaceCrowbar(string &in asTimer)
- {
- SetEntityActive("CrowbarJoint", true);
- PlaySoundAtEntity("", "puzzle_place_jar.snt", asTimer, 0.05, false);
- }
- void BreakDoor(string &in asParent, string &in asChild, int alState)
- {
- SetEntityActive("CrowbarJoint", false);
- SetEntityActive("CrowbarBroken", true);
- SetSwingDoorLocked("DoorCrowbar", false, false);
- SetSwingDoorClosed("DoorCrowbar", false, false);
- SetSwingDoorDisableAutoClose("DoorCrowbar", true);
- AddPropImpulse("DoorCrowbar", 0, 0, 3, "world");
- CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "AreaEffect", false);
- PlaySoundAtEntity("", "break_wood_metal", "AreaEffect", 0, false);
- GiveSanityBoostSmall();
- PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
- AddTimer("", 0.1, "TimerPushDoor");
- }
- void TimerPushDoor(string &in asTimer)
- {
- AddPropImpulse("DoorCrowbar", -4, 2, 1, "world");
- AddTimer("", 1.1, "TimerDoorCanClose");
- }
- void TimerDoorCanClose(string &in asTimer)
- {
- SetSwingDoorDisableAutoClose("DoorCrowbar", false);
- }
- void InteractPassage(string &in asEntity)
- {
- int interactCount = GetLocalVarInt("HitCount");
- AddLocalVarInt("HitCount", 1);
- AddTimer("", 0.7, "DecreaseHitCount");
- CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "AreaParticle_" + RandInt(1, 4), false);
- if (interactCount == 3)
- {
- SetPropHealth("WallPassage", 0);
- }
- if (GetTimerTimeLeft("limitsound") == 0)
- {
- AddTimer("limitsound", 0.7, "");
- PlayGuiSound("impact_rock_low3.ogg", 1);
- PlayGuiSound("15_rock_break", 1);
- }
- }
- void DecreaseHitCount(string &in asTimer)
- {
- AddLocalVarInt("HitCount", -1);
- }
- void BreakWall(string &in asEntity, string &in type)
- {
- GiveSanityBoostSmall();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement