void OnStart()
{
AddEntityCollideCallback("BatSound", "player", "PlayBatSound", false, 1);
AddUseItemCallback("Usedsteam", "SteamRod", "MachineScript_1", "Elevator", true);
AddUseItemCallback("Usedflow" ,"FlowRod", "MachineScript_2", "Elevator_1", true);
AddUseItemCallback("Usedkey" ,"KeyRod", "MachineScript_3", "SafetyOpen", true);
}
void PlayBatSound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("Bat", "general_bat.snt", "BAtSound", 0.1f, false);
}
void SafetyOpen (string &in asItem, string &in asEntity)
{
SetEntityActive("KeyRod_static", true);
PreloadSound("rod_in.snt");
PreloadSound("17_piston_move.snt");
RemoveItem("KeyRod");
SetMoveObjectState("safety_normal_vert_1", 1.0f);
SetMoveObjectState("safety_normal_vert_2", 1.0f);
SetMoveObjectState("safety_normal_vert_3", 1.0f);
SetMoveObjectState("safety_normal_vert_4", 1.0f);
SetMoveObjectState("safety_normal_vert_5", 1.0f);
SetMoveObjectState("safety_normal_vert_6", 1.0f);
}
void Elevator (string &in asItem, string &in asEntity)
{
SetEntityActive("SteamRod_static", true);
PreloadSound("rod_in.snt");
RemoveItem("SteamRod");
AddLocalVarInt("ElevatorWork", 1);
func_check();
}
void Elevator_1 (string &in asItem, string &in asEntity)
{
SetEntityActive("FlowRod_static", true);
PreloadSound("rod_in.snt");
RemoveItem("FlowRod");
AddLocalVarInt("ElevatorWork", 1);
func_check();
}
void func_check()
{
if (GetLocalVarInt("ElevatorWork") == 2)
{
PreloadSound("13_flow_done.snt");
SetEntityConnectionStateChangeCallback("elevator_lever_1", "Map");
}
}
void Map (string &in asEntity, int alState)
{
if (alState == 1)
{
FadeOut(4);
ChangeMap("00_Buda.map", "PlayerStartArea_1", "14_elevator_activate.snt", "elevator_move_normal.snt");
}
}