;------------------------------------------------
;Replace physics level system with perm entities
;------------------------------------------------
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" "6"
	"StartDisabled" "0"
	"min" "1"
	"max" "6"
	"OnGetValue" "Stage_Case,InValue,,0,-1"
}

add:
{
	"classname" "logic_case"
	"targetname" "Stage_Case"
	"Case01" "1"
	"Case02" "2"
	"Case03" "3"
	"Case04" "4"
	"Case05" "5"
	"Case06" "6"
	"OnCase01" "lvl1_map_relay,Trigger,,0.02,-1"
	"OnCase02" "lvl2_map_relay,Trigger,,0.02,-1"
	"OnCase03" "lvl3_map_relay,Trigger,,0.02,-1"
	"OnCase04" "lvl4_map_relay,Trigger,,0.02,-1"
	"OnCase05" "lvl5_map_relay,Trigger,,0.02,-1"
	"OnCase06" "warmup_map_relay,Trigger,,0.02,-1"
}

modify:
{
	match:
	{
		"classname" "logic_auto"
	}
	insert:
	{
		"OnMapSpawn" "Stage_CounterInit,FireUser1,,0,1"
		"OnMapSpawn" "Stage_Counter,GetValue,,0.02,1"
	}
}

;------------------------------------
;Change stage triggers to new system
;------------------------------------
modify:
{
	match:
	{
		"classname" "func_button"
		"hammerid" "1442088"
	}
	delete:
	{
		"OnPressed" "lvl1_brush,Disable,,0.05,-1"
		"OnPressed" "warmup_brush,Enable,,0,-1"
		"OnPressed" "lvl1_brush,Enable,,0,-1"
		"OnPressed" "lvl2_brush,Enable,,0,-1"
		"OnPressed" "lvl3_brush,Enable,,0,-1"
		"OnPressed" "lvl4_brush,Enable,,0,-1"
		"OnPressed" "lvl5_brush,Enable,,0,-1"
		"OnPressed" "lvl6_brush,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,1,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"hammerid" "1442207"
	}
	delete:
	{
		"OnPressed" "lvl2_brush,Disable,,0.05,-1"
		"OnPressed" "warmup_brush,Enable,,0,-1"
		"OnPressed" "lvl1_brush,Enable,,0,-1"
		"OnPressed" "lvl2_brush,Enable,,0,-1"
		"OnPressed" "lvl3_brush,Enable,,0,-1"
		"OnPressed" "lvl4_brush,Enable,,0,-1"
		"OnPressed" "lvl5_brush,Enable,,0,-1"
		"OnPressed" "lvl6_brush,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,2,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"hammerid" "1442267"
	}
	delete:
	{
		"OnPressed" "lvl3_brush,Disable,,0.05,-1"
		"OnPressed" "warmup_brush,Enable,,0,-1"
		"OnPressed" "lvl1_brush,Enable,,0,-1"
		"OnPressed" "lvl2_brush,Enable,,0,-1"
		"OnPressed" "lvl3_brush,Enable,,0,-1"
		"OnPressed" "lvl4_brush,Enable,,0,-1"
		"OnPressed" "lvl5_brush,Enable,,0,-1"
		"OnPressed" "lvl6_brush,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"hammerid" "1442260"
	}
	delete:
	{
		"OnPressed" "lvl4_brush,Disable,,0.05,-1"
		"OnPressed" "warmup_brush,Enable,,0,-1"
		"OnPressed" "lvl1_brush,Enable,,0,-1"
		"OnPressed" "lvl2_brush,Enable,,0,-1"
		"OnPressed" "lvl3_brush,Enable,,0,-1"
		"OnPressed" "lvl4_brush,Enable,,0,-1"
		"OnPressed" "lvl5_brush,Enable,,0,-1"
		"OnPressed" "lvl6_brush,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,4,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"hammerid" "1442384"
	}
	delete:
	{
		"OnPressed" "lvl5_brush,Disable,,0.05,-1"
		"OnPressed" "warmup_brush,Enable,,0,-1"
		"OnPressed" "lvl1_brush,Enable,,0,-1"
		"OnPressed" "lvl2_brush,Enable,,0,-1"
		"OnPressed" "lvl3_brush,Enable,,0,-1"
		"OnPressed" "lvl4_brush,Enable,,0,-1"
		"OnPressed" "lvl5_brush,Enable,,0,-1"
		"OnPressed" "lvl6_brush,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,5,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_relay"
		"targetname" "warmup_map_relay"
	}
	delete:
	{
		"OnTrigger" "lvl1_brush,Disable,,40.05,-1"
		"OnTrigger" "lvl1_brush,Enable,,40,-1"
		"OnTrigger" "lvl2_brush,Enable,,40,-1"
		"OnTrigger" "lvl3_brush,Enable,,40,-1"
		"OnTrigger" "lvl4_brush,Enable,,40,-1"
		"OnTrigger" "lvl5_brush,Enable,,40,-1"
		"OnTrigger" "lvl6_brush,Enable,,40,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,1,40,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_once"
		"targetname" "lvl1_win"
	}
	delete:
	{
		"OnStartTouch" "lvl2_brush,Disable,,0.05,-1"
		"OnStartTouch" "lvl1_brush,Enable,,0,-1"
		"OnStartTouch" "lvl2_brush,Enable,,0,-1"
		"OnStartTouch" "lvl3_brush,Enable,,0,-1"
		"OnStartTouch" "lvl4_brush,Enable,,0,-1"
		"OnStartTouch" "lvl5_brush,Enable,,0,-1"
		"OnStartTouch" "lvl6_brush,Enable,,0,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,2,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_once"
		"targetname" "lvl2_win"
	}
	delete:
	{
		"OnStartTouch" "lvl3_brush,Disable,,0.05,-1"
		"OnStartTouch" "lvl1_brush,Enable,,0,-1"
		"OnStartTouch" "lvl2_brush,Enable,,0,-1"
		"OnStartTouch" "lvl3_brush,Enable,,0,-1"
		"OnStartTouch" "lvl4_brush,Enable,,0,-1"
		"OnStartTouch" "lvl5_brush,Enable,,0,-1"
		"OnStartTouch" "lvl6_brush,Enable,,0,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_once"
		"targetname" "lvl3_win"
	}
	delete:
	{
		"OnStartTouch" "lvl4_brush,Disable,,5.05,-1"
		"OnStartTouch" "lvl1_brush,Enable,,5,-1"
		"OnStartTouch" "lvl2_brush,Enable,,5,-1"
		"OnStartTouch" "lvl3_brush,Enable,,5,-1"
		"OnStartTouch" "lvl4_brush,Enable,,5,-1"
		"OnStartTouch" "lvl5_brush,Enable,,5,-1"
		"OnStartTouch" "lvl6_brush,Enable,,5,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,4,5,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_once"
		"targetname" "lvl4_win"
	}
	delete:
	{
		"OnStartTouch" "lvl5_brush,Disable,,5.05,-1"
		"OnStartTouch" "lvl1_brush,Enable,,0,-1"
		"OnStartTouch" "lvl2_brush,Enable,,0,-1"
		"OnStartTouch" "lvl3_brush,Enable,,0,-1"
		"OnStartTouch" "lvl4_brush,Enable,,0,-1"
		"OnStartTouch" "lvl5_brush,Enable,,0,-1"
		"OnStartTouch" "lvl6_brush,Enable,,0,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,5,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_once"
		"targetname" "lvl5_win"
	}
	delete:
	{
		"OnStartTouch" "lvl1_brush,Disable,,0.05,-1"
		"OnStartTouch" "lvl1_brush,Enable,,0,-1"
		"OnStartTouch" "lvl2_brush,Enable,,0,-1"
		"OnStartTouch" "lvl3_brush,Enable,,0,-1"
		"OnStartTouch" "lvl4_brush,Enable,,0,-1"
		"OnStartTouch" "lvl5_brush,Enable,,0,-1"
		"OnStartTouch" "lvl6_brush,Enable,,0,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,1,0,-1"
	}
}

;-------------------------
;Cleanup old level system
;-------------------------
filter:
{
	"classname" "func_brush"
	"targetname" "/(warmup|lvl[1-6])_brush/"
}

filter:
{
	"classname" "trigger_once"
	"targetname" "/(warmup|lvl[1-6])_trigger/"
}

filter:
{
	"classname" "func_physbox"
	"targetname" "lvl_phys"
}

;------------------------------------
;Remove all unfinished stage 6 stuff
;------------------------------------
filter:
{
	"targetname" "/lvl6_.*/"
}

;------------------------------------------
; CHANGE THE GARGANTUA MODEL TO A RECOMPILED VERSION
; TO FIX ISSUES SINCE THE VSCRIPT UPDATE
; by Moltard
; Require players to DL the new model + materials
;------------------------------------------
modify:
{
	match:
	{
		"model" "models/garg.mdl"
		"classname" "prop_dynamic"
	}
	replace:
	{
		"model" "models/garg_fix_2025.mdl"
	}
}

;*******************************************
;*-------------STRIPPER BY-----------------*
;*---------------KLIXUS--------------------*
;*******************************************


;Moves item spawnpoints from unobtainable area to playable area

modify:
{
	match:
	{
		"targetname" "lvl3_item_origin"
		"classname" "logic_case"
		"hammerid" "2010245"
	}
	delete:
	{
		"OnCase01" "lvl3_item_spawn,AddOutput,origin 811 -1313 7270,0,1"
		"OnCase02" "lvl3_item_spawn,AddOutput,origin 6854 644 7412,0,1"
		"OnCase03" "lvl3_item_spawn,AddOutput,origin 5116 3154 7332,0,1"
		"OnCase04" "lvl3_item_spawn,AddOutput,origin 6034 5228 7424,0,1"
	}
	insert:
	{
		"OnCase01" "lvl3_item_spawn,AddOutput,origin 1187 4572 7211,0,1"
		"OnCase02" "lvl3_item_spawn,AddOutput,origin 3623 2763 3871,0,1"
		"OnCase03" "lvl3_item_spawn,AddOutput,origin 3788 944 3559,0,1"
		"OnCase04" "lvl3_item_spawn,AddOutput,origin -1170 -1038 3247,0,1"
	}
}



;; _

;; restart round on warmup

modify:
{
	match:
	{
		"targetname" "warmup_map_relay"
		"classname" "logic_relay"
	}
	delete:
	{
		"OnTrigger" "killall,Enable,,41,-1"
	}
	insert:
	{
		"OnTrigger" "command,Command,mp_restartgame 1,41,1"
	}
}

;; fix performance

modify:
{
	match:
	{
		"targetname" "bosslvl1_4_model"
		"classname" "prop_dynamic"
	}
	replace:
	{
		"DisableBoneFollowers" "1"
	}
}

;; stage 2,5 - fix invisible c4

modify:
{
	match:
	{
		"targetname" "lvl2_map_relay"
		"classname" "logic_relay"
	}
	insert:
	{
		"OnTrigger" "door60_9,AddOutput,rendermode 10,5,1"
		"OnTrigger" "door60_9,AddOutput,rendermode 1,5.5,1"
		"OnTrigger" "door60_9,AddOutput,rendermode 10,10,1"
		"OnTrigger" "door60_9,AddOutput,rendermode 1,10.5,1"
		"OnTrigger" "door60_9,AddOutput,rendermode 10,15,1"
		"OnTrigger" "door60_9,AddOutput,rendermode 1,15.5,1"
	}
}

;; stage 3 - fix heli

modify:
{
	match:
	{
		"targetname" "heli_path6"
		"classname" "path_track"
	}
	insert:
	{
		"OnPass" "heli_move,AddOutput,orientationtype 0,0.5,1"
	}
}
modify:
{
	match:
	{
		"targetname" "heli_trigger"
		"classname" "trigger_once"
	}
	delete:
	{
		"OnStartTouch" "heli_temp,AddOutput,origin -11741 9383 6813,10,1"
	}
	insert:
	{
		"OnStartTouch" "heli_temp,AddOutput,origin -11761 9383 6813,10,1"
	}
}