;--------------------------------------------------------------------
; Fixes so the teleporter is reactivated again later in the map
;--------------------------------------------------------------------
modify:
{
	match:
	{
		"targetname" "lever_5_btn"
		"origin" "-12395.6 5920 -2024"
		"classname" "func_button"
	}
	insert:
	{
		"OnPressed" "afk_4,Enable,,25,1"
		"OnPressed" "afk_4,AddOutput,target fall_dest,20,1"
	}
}

;-------------------------------------------------------
; Fix: music get played multiple times after boss fight
;-------------------------------------------------------
modify:
{
	match:
	{
		"classname" "trigger_once"
		"targetname" "part2_music"
		"hammerid" "7023"
	}
	delete:
	{
		"OnStartTouch" "music_case2,PickRandomShuffle,,4,-1"
	}
	insert:
	{
		"OnTrigger" "music_case2,PickRandomShuffle,,4,-1"
	}
}

;----------------------------------
; Bosses TPs forgot to be disabled
; When the boss gets killed
;----------------------------------
modify:
{
	match:
	{
		"classname" "math_counter"
		"targetname" "boss_hp_iterations"
		"hammerid" "7009"
	}
	insert:
	{
		"OnHitMin" "attack1_teleport,Kill,,0.01,-1"
	}
}

;--------------------------------------------------------
;REPLACE PHYSICS LEVEL SYSTEM WITH PERM ENTS (.Rushaway)
;--------------------------------------------------------
add:
{
	"classname" "info_target"
	"targetname" "Stage_CounterInit"
	"spawnflags" "0"
	"OnUser1" "Stage_CounterTemplate,ForceSpawn,,0,1"
	"OnUser1" "Stage_Counter,AddOutput,classname info_target,0.03,1"
	"OnUser1" "!self,Kill,,0.06,1"
}
add:
{
	"classname" "point_template"
	"targetname" "Stage_CounterTemplate"
	"Template01" "Stage_Counter"
	"spawnflags" "2"
}
add:
{
	"classname" "math_counter"
	"targetname" "Stage_Counter"
	"startvalue" "1"
	"StartDisabled" "0"
	"min" "1"
	"max" "2"
	"OnGetValue" "Stage_Case,InValue,,0,-1"
}
add:
{
	"classname" "logic_case"
	"targetname" "Stage_Case"
	"Case01" "1"
	"Case02" "2"
	"OnCase01" "lvl_1,Trigger,,0,-1"
	"OnCase01" "cmd,Command,say *** level: EASY***,3,-1"
	"OnCase02" "lvl_2,Trigger,,0,-1"
	"OnCase02" "cmd,Command,say *** level: HARD***,3,-1"
}
modify:
{
	match:
	{
		"classname" "logic_auto"
	}
	insert:
	{
		"OnMapSpawn" "Stage_CounterInit,FireUser1,,0,1"
		"OnMapSpawn" "Stage_Counter,GetValue,,0.02,1"
	}
}

;------------------------------------
; CHANGE ADMINROOM I/O TO NEW SYSTEM
;------------------------------------
modify:
{
	match:
	{
		"classname" "func_button"
		"hammerid" "8142"
	}
	delete:
	{
		"OnPressed" "lvl1_easy,Disable,,0.01,-1"
		"OnPressed" "lvl2_hard,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,1,0,-1"
	}
}
modify:
{
	match:
	{
		"classname" "func_button"
		"hammerid" "8150"
	}
	delete:
	{
		"OnPressed" "lvl1_easy,Enable,,0,-1"
		"OnPressed" "lvl2_hard,Disable,,0.01,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,2,0,-1"
	}
}

;-------------------------------------
; CHANGE STAGE TRIGGERS TO NEW SYSTEM
;-------------------------------------
;- map is using only one relay to validate the win
;- same end zone used on lvl 1 & 2
;- origin behavior was to stay on level 2 when the map was beat
modify:
{
	match:
	{
		"classname" "logic_relay"
		"targetname" "relay_win"
	}
	delete:
	{
		"OnTrigger" "lvl1_easy,Enable,,0.05,-1"
		"OnTrigger" "lvl2_hard,Disable,,0.2,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,2,0,-1"
	}
}

;--------------------
; CLEANUP OLD SYSTEM
;--------------------
filter:
{
	"classname" "func_physbox"
	"origin" "/-3310 4550 -722|-3282 4550 -722/"
}
filter:
{
	"classname" "func_brush"
	"targetname" "/lvl1_easy|lvl2_hard/"
}
filter:
{
	"classname" "trigger_once"
	"origin" "/-3310 4550 -750|-3282 4550 -750/"
}

;fix not adjustable music volume
modify:
{
	match:
	{
		"message" "music/KatyaGur Qalb Al Sahraa.mp3"
	}
	replace:
	{
		"message" "#music/KatyaGur Qalb Al Sahraa.mp3"
	}
}
modify:
{
	match:
	{
		"message" "music/KatyaGur-Urba.mp3"
	}
	replace:
	{
		"message" "#music/KatyaGur-Urba.mp3"
	}
}
modify:
{
	match:
	{
		"message" "music/spawn_map.mp3"
	}
	replace:
	{
		"message" "#music/spawn_map.mp3"
	}
}
modify:
{
	match:
	{
		"message" "music/Dense_Bazaar_(ft._Translippers).mp3"
	}
	replace:
	{
		"message" "#music/Dense_Bazaar_(ft._Translippers).mp3"
	}
}
modify:
{
	match:
	{
		"message" "music/Elfenberg Bazaar.mp3"
	}
	replace:
	{
		"message" "#music/Elfenberg Bazaar.mp3"
	}
}
modify:
{
	match:
	{
		"message" "music/Circle of Dust - Deviate.mp3"
	}
	replace:
	{
		"message" "#music/Circle of Dust - Deviate.mp3"
	}
}