;stripper by koen (STEAM_1:1:114921174)

;adjust round time
modify:
{
	match:
	{
		"origin" "-272 96 -352"
		"classname" "logic_auto"
	}
	delete:
	{
		"OnMapSpawn" "sc,AddOutput,mp_roundtime 15,0,-1"
	}
	insert:
	{
		"OnMapSpawn" "sc,Command,mp_roundtime 11,0,-1"
	}
}

;replace existing physics level system to permanent 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" "1"
	"StartDisabled" "0"
	"min" "1"
	"max" "5"
	"OnGetValue" "Stage_Case,InValue,,0,-1"
}

add:
{
	"classname" "logic_case"
	"targetname" "Stage_Case"
	"Case01" "1"
	"Case02" "2"
	"Case03" "3"
	"case04" "4"
	"Case05" "5"
	"OnCase02" "Stage2_Relay,Trigger,,0.02,1"
	"OnCase03" "Stage3_Relay,Trigger,,0.02,1"
	"OnCase04" "RTV_Relay,Trigger,,0.02,1"
	"OnCase05" "RTV2_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 existing stage change triggers to the new system
modify:
{
	match:
	{
		"classname" "logic_relay"
		"targetname" "l1_win_hm_relay"
	}
	delete:
	{
		"OnTrigger" "brush_l2_physbox,Disable,,0,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,2,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_once"
		"targetname" "l2_nuke_trigger"
	}
	delete:
	{
		"OnStartTouch" "brush_l2_physbox,Enable,,5,1"
		"OnStartTouch" "brush_l3_physbox,Disable,,5,1"
	}
	insert:
	{
		"OnStartTouch" "Stage_Counter,SetValue,3,5,1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_multiple"
		"targetname" "getscore"
	}
	delete:
	{
		"OnStartTouch" "brush_l2_physbox,Enable,,0,1"
		"OnStartTouch" "brush_l3_physbox,Enable,,0,1"
		"OnStartTouch" "brush_rtv_physbox,Disable,,0,1"
	}
	insert:
	{
		"OnStartTouch" "Stage_Counter,SetValue,4,0,1"
	}
}

modify:
{
	match:
	{
		"classname" "logic_relay"
		"targetname" "rtv_trigger"
	}
	delete:
	{
		"OnTrigger" "worldspawn,FireUser1,,126.9,-1"
		"OnTrigger" "worldspawn,AddOutput,OnUser1 lvl_counter:SetValue:2:0.00:1,127,-1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,5,127,-1"
	}
}

modify:
{
	match:
	{
		"classname" "trigger_multiple"
		"targetname" "fys_win"
	}
	delete:
	{
		"OnTrigger" "brush_l3_physbox,Disable,,2,-1"
		"OnTrigger" "brush_rtv_physbox,Enable,,2,-1"
		"OnTrigger" "worldspawn,FireUser1,,2,1"
	}
	insert:
	{
		"OnTrigger" "Stage_Counter,SetValue,3,0,1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "admin_l1"
	}
	delete:
	{
		"OnPressed" "brush_l2_physbox,Enable,,0,-1"
		"OnPressed" "brush_l3_physbox,Enable,,0,-1"
		"OnPressed" "brush_rtv_physbox,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,1,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "admin_l2"
	}
	delete:
	{
		"OnPressed" "brush_l2_physbox,Disable,,0,-1"
		"OnPressed" "brush_l3_physbox,Enable,,0,-1"
		"OnPressed" "brush_rtv_physbox,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,2,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "admin_l3"
	}
	delete:
	{
		"OnPressed" "brush_l3_physbox,Disable,,0,-1"
		"OnPressed" "brush_l2_physbox,Enable,,0,-1"
		"OnPressed" "brush_rtv_physbox,Enable,,0,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,3,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "admin_rtv"
	}
	delete:
	{
		"OnPressed" "brush_l3_physbox,Enable,,0,-1"
		"OnPressed" "brush_l2_physbox,Enable,,0,-1"
		"OnPressed" "brush_rtv_physbox,Disable,,0,-1"
		"OnPressed" "worldspawn,FireUser1,,0,-1"
		"OnPressed" "worldspawn,AddOutput,OnUser1 lvl_counter:SetValue:1:0.00:1,0.03,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,4,0,-1"
	}
}

modify:
{
	match:
	{
		"classname" "func_button"
		"targetname" "admin_rtv_fys"
	}
	delete:
	{
		"OnPressed" "worldspawn,FireUser1,,0,-1"
		"OnPressed" "brush_l3_physbox,Enable,,0.5,-1"
		"OnPressed" "brush_l2_physbox,Enable,,0.5,-1"
		"OnPressed" "brush_rtv_physbox,Disable,,0.5,-1"
		"OnPressed" "worldspawn,AddOutput,OnUser1 lvl_counter:SetValue:2:0.00:1,0.03,-1"
	}
	insert:
	{
		"OnPressed" "Stage_Counter,SetValue,5,0,-1"
	}
}

;convert stage triggers to relays
add:
{
	"classname" "logic_relay"
	"targetname" "Stage2_Relay"
	"spawnflags" "0"
	"OnTrigger" "l1_destination_1,AddOutput,origin 15296 -8704 6672,0,-1"
	"OnTrigger" "l1_bgm,Kill,,0,-1"
	"OnTrigger" "l2_bgm_1,PlaySound,,20,-1"
	"OnTrigger" "l2_door_1,Open,,9.9,-1"
	"OnTrigger" "spr_train_green_1,AddOutput,origin 14680 -4680 -1396,0,-1"
	"OnTrigger" "sc,Command,say LEVEL2,2,-1"
	"OnTrigger" "l2_door_relay_1,Trigger,,60,-1"
	"OnTrigger" "trigger_fade_black,Kill,,0,-1"
	"OnTrigger" "item1_gr_spawn_temp,ForceSpawn,,1,-1"
	"OnTrigger" "item2_gr_spawn_temp,ForceSpawn,,2,-1"
	"OnTrigger" "itemheya_glitch_tp,Enable,,45,-1"
	"OnTrigger" "itemheya_smoke,Kill,,45,-1"
	"OnTrigger" "itemheya_1,Kill,,45,-1"
	"OnTrigger" "itemheya_2,Kill,,45,-1"
	"OnTrigger" "itemheya_temp,ForceSpawn,,3,-1"
	"OnTrigger" "item3_gr_spawn_temp,ForceSpawn,,4,-1"
	"OnTrigger" "l1_msg,Kill,,0,-1"
	"OnTrigger" "l1_msg,CancelPending,,0,-1"
	"OnTrigger" "l2_door_case,PickRandomShuffle,,10,-1"
	"OnTrigger" "l1_door_relay_*,Kill,,0,-1"
}

add:
{
	"classname" "logic_relay"
	"targetname" "Stage3_Relay"
	"spawnflags" "0"
	"OnTrigger" "l1_bgm,Kill,,0,-1"
	"OnTrigger" "l3_bgm_1,PlaySound,,10,-1"
	"OnTrigger" "l2_timer_door_oc,Kill,,0,-1"
	"OnTrigger" "sc,Command,say LEVEL3,2,-1"
	"OnTrigger" "l2_nuke_trigger,Kill,,0,-1"
	"OnTrigger" "l1_destination_1,AddOutput,origin -2736 -8000 -240,0,-1"
	"OnTrigger" "spr_l2_last,Kill,,0,-1"
	"OnTrigger" "l2_bgm_1,Kill,,0,-1"
	"OnTrigger" "l2_tp,Kill,,0,-1"
	"OnTrigger" "l2_teleport_zm_1,Kill,,0,-1"
	"OnTrigger" "l2_teleport_zm_2,Kill,,0,-1"
	"OnTrigger" "item2_gr_spawn_temp,ForceSpawn,,2,-1"
	"OnTrigger" "item1_gr_spawn_temp,ForceSpawn,,1,-1"
	"OnTrigger" "itemheya_glitch_tp,Enable,,60,-1"
	"OnTrigger" "itemheya_l3_2,Kill,,60,-1"
	"OnTrigger" "itemheya_l3_1,Kill,,60,-1"
	"OnTrigger" "itemheya_l3_smoke,Kill,,60,-1"
	"OnTrigger" "itemheya_l3_temp,ForceSpawn,,3,-1"
	"OnTrigger" "item3_gr_spawn_temp,ForceSpawn,,4,-1"
	"OnTrigger" "spr_l2_last,Kill,,0,-1"
	"OnTrigger" "l2_rot_white,Kill,,0,-1"
	"OnTrigger" "l1_msg,CancelPending,,0,-1"
	"OnTrigger" "l1_msg,Kill,,0,-1"
	"OnTrigger" "l2_door_relay_1,Kill,,0,-1"
	"OnTrigger" "maker_st4_heal_spawn,ForceSpawnAtEntityOrigin,target_heal_point_2,16,-1"
	"OnTrigger" "maker_st4_heal_spawn,ForceSpawnAtEntityOrigin,target_heal_point_1,15,-1"
	"OnTrigger" "maker_st4_heal_spawn,ForceSpawn,,14,-1"
}

add:
{
	"classname" "logic_relay"
	"targetname" "RTV_Relay"
	"spawnflags" "0"
	"OnTrigger" "l1_door_2,Kill,,0,-1"
	"OnTrigger" "l3_bgm_1,Kill,,0,-1"
	"OnTrigger" "l2_timer_door_oc,Kill,,0,-1"
	"OnTrigger" "l2_nuke_trigger,Kill,,0,-1"
	"OnTrigger" "l1_destination_1,AddOutput,origin -2736 -8000 -240,0,-1"
	"OnTrigger" "spr_l2_last,Kill,,0,-1"
	"OnTrigger" "l2_bgm_1,Kill,,0,-1"
	"OnTrigger" "l2_tp,Kill,,0,-1"
	"OnTrigger" "l2_teleport_zm_1,Kill,,0,-1"
	"OnTrigger" "l2_teleport_zm_2,Kill,,0,-1"
	"OnTrigger" "item2_gr_spawn_temp,ForceSpawn,,2,-1"
	"OnTrigger" "item1_gr_spawn_temp,ForceSpawn,,1,-1"
	"OnTrigger" "itemheya_glitch_tp,Enable,,60,-1"
	"OnTrigger" "itemheya_l3_2,Kill,,60,-1"
	"OnTrigger" "itemheya_l3_1,Kill,,60,-1"
	"OnTrigger" "itemheya_l3_smoke,Kill,,60,-1"
	"OnTrigger" "itemheya_l3_temp,ForceSpawn,,3,-1"
	"OnTrigger" "item3_gr_spawn_temp,ForceSpawn,,4,-1"
	"OnTrigger" "start_teleport_1,Kill,,0,-1"
	"OnTrigger" "rtv_teleport,Enable,,10,-1"
	"OnTrigger" "rtv_teleport,Kill,,16,-1"
	"OnTrigger" "rtv_trigger,Trigger,,19,-1"
	"OnTrigger" "l1_bgm,Kill,,0,-1"
	"OnTrigger" "rtv_teleport_2,Enable,,16.5,-1"
	"OnTrigger" "l2_rot_white,Kill,,0,-1"
	"OnTrigger" "spr_l2_last,Kill,,0,-1"
	"OnTrigger" "l1_msg,CancelPending,,0,-1"
	"OnTrigger" "l1_msg,Kill,,0,-1"
	"OnTrigger" "l2_door_relay_1,Kill,,0,-1"
	"OnTrigger" "sc,Command,say rtv,2,-1"
	"OnTrigger" "sc,Command,say MUSIC: Dizzolve,3,-1"
	"OnTrigger" "fys_trigger,kill,,0,-1"
}

add:
{
	"classname" "logic_relay"
	"targetname" "RTV2_Relay"
	"spawnflags" "0"
	"OnTrigger" "l1_door_2,Kill,,0,-1"
	"OnTrigger" "l3_bgm_1,Kill,,0,-1"
	"OnTrigger" "l2_timer_door_oc,Kill,,0,-1"
	"OnTrigger" "l2_nuke_trigger,Kill,,0,-1"
	"OnTrigger" "l1_destination_1,AddOutput,origin -2736 -8000 -240,0,-1"
	"OnTrigger" "spr_l2_last,Kill,,0,-1"
	"OnTrigger" "l2_bgm_1,Kill,,0,-1"
	"OnTrigger" "l2_tp,Kill,,0,-1"
	"OnTrigger" "l2_teleport_zm_1,Kill,,0,-1"
	"OnTrigger" "l2_teleport_zm_2,Kill,,0,-1"
	"OnTrigger" "item2_gr_spawn_temp,ForceSpawn,,2,-1"
	"OnTrigger" "item1_gr_spawn_temp,ForceSpawn,,1,-1"
	"OnTrigger" "itemheya_glitch_tp,Enable,,60,-1"
	"OnTrigger" "itemheya_l3_2,Kill,,60,-1"
	"OnTrigger" "itemheya_l3_1,Kill,,60,-1"
	"OnTrigger" "itemheya_l3_smoke,Kill,,60,-1"
	"OnTrigger" "itemheya_l3_temp,ForceSpawn,,3,-1"
	"OnTrigger" "item3_gr_spawn_temp,ForceSpawn,,4,-1"
	"OnTrigger" "start_teleport_1,Kill,,0,-1"
	"OnTrigger" "rtv_teleport,Enable,,10,-1"
	"OnTrigger" "rtv_teleport,Kill,,16,-1"
	"OnTrigger" "rtv_trigger,Trigger,,19,-1"
	"OnTrigger" "l1_bgm,Kill,,0,-1"
	"OnTrigger" "rtv_teleport_2,Enable,,16.5,-1"
	"OnTrigger" "l2_rot_white,Kill,,0,-1"
	"OnTrigger" "spr_l2_last,Kill,,0,-1"
	"OnTrigger" "l1_msg,CancelPending,,0,-1"
	"OnTrigger" "l1_msg,Kill,,0,-1"
	"OnTrigger" "l2_door_relay_1,Kill,,0,-1"
	"OnTrigger" "fys_trigger,Trigger,,19,-1"
	"OnTrigger" "sc,Command,say rtv2,2,-1"
	"OnTrigger" "sc,Command,say MUSIC: Yooh - Seraphim,3,-1"
	"OnTrigger" "rtv_trigger,kill,,0,-1"
	"OnTrigger" "fys_trigger,Enable,,1,-1"
}

;cleanup up old level system
filter:
{
	"classname" "func_physbox"
	"targetname" "/physbox_.*/"
}

filter:
{
	"classname" "func_brush"
	"targetname" "/brush_(l2|l3|rtv)_physbox/"
}

filter:
{
	"classname" "trigger_once"
	"targetname" "/trigger_(l2|l3|rtv)_physbox/"
}

modify:
{
	match:
	{
		"classname" "logic_auto"
	}
	delete:
	{
		"OnMapSpawn" "physbox_l2,Kill,,10,-1"
		"OnMapSpawn" "physbox_l3,Kill,,10,-1"
		"OnMapSpawn" "physbox_rtv,Kill,,10,-1"
	}
}