;fix quest sprite
modify:
{
	match:
	{
		"targetname" "quest00_sprite00"
		"classname" "env_sprite"
	}
	replace:
	{
		"spawnflags" "1"
	}
}

;Add shortcut
modify:
{
	match:
	{
		"origin" "7358.07 6067.59 4982.69"
		"classname" "trigger_multiple"
	}
	insert:
	{
		"OnStartTouch" "trigger_05_b,Trigger,,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "mod_speedrun_branch"
		"classname" "logic_branch"
	}
	insert:
	{
		"OnTrue" "trigger_05_a,Kill,,0,1"
		"OnTrue" "trigger_05_b,Kill,,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_05"
		"classname" "logic_relay"
	}
	delete:
	{
		"OnTrigger" "windlock_breakable01,FireUser1,,10,1"
		"OnTrigger" "point_servercommand,Command,say Winter Shortcut is open now,10,1"
		"OnTrigger" "point_servercommand,Command,say Winter Shortcut will open in 10 sec,0,1"
	}
	insert:
	{
		"OnTrigger" "trigger_05_a,Trigger,,0,1"
		"OnTrigger"	"shortcut05,Kill,,0,1"
	}
}
add:
{
	"StartDisabled" "0"
	"spawnflags" "0"
	"classname" "logic_relay"
	"targetname" "trigger_05_a"

	"OnTrigger" "windlock_breakable01,FireUser1,,10,1"
	"OnTrigger" "point_servercommand,Command,say Winter Shortcut is open now,10,1"
	"OnTrigger" "point_servercommand,Command,say Winter Shortcut will open in 10 sec,0,1"
	"OnTrigger" "trigger_05_b,CancelPending,,0,1"
}
add:
{
	"StartDisabled" "0"
	"spawnflags" "0"
	"classname" "logic_relay"
	"targetname" "trigger_05_b"

	"OnTrigger" "windlock_breakable01,FireUser1,,120,1"
	"OnTrigger" "point_servercommand,Command,say Ice will melt in 120 seconds,0,1"
	"OnTrigger" "trigger_05_a,Disable,,109.5,1"
}
modify:
{
	match:
	{
		"targetname" "trigger_05"
		"classname" "logic_relay"
	}
	insert:
	{
		"OnStartTouch" "trigger_05_a,Disable,,0,1"
		"OnStartTouch" "trigger_05_b,CancelPending,,0,1"
	}
}

;fix godmod
modify:
{
	match:
	{
		"targetname" "start_trigger"
		"classname" "trigger_multiple"
	}
	delete:
	{
		"OnStartTouch" "!activator,SetDamageFilter,filter_god,0,-1"
	}
}
modify:
{
	match:
	{
		"classname" "logic_auto"
	}
	insert:
	{
		"OnMapSpawn" "point_servercommand,Command,zr_infect_spawntime_max 31.0,0,1"
		"OnMapSpawn" "point_servercommand,Command,zr_infect_spawntime_min 31.0,0,1"
	}
}

;add more time for humans to escape
modify:
{
	match:
	{
		"targetname" "mod_team_branch"
		"classname"	"logic_branch"
	}
	delete:
	{
		"OnTrue" "global_teleport_start,Enable,,15,1"
	}
	insert:
	{
		"OnTrue" "global_teleport_start,Enable,,20,1"
	}
}
modify:
{
	match:
	{
		"targetname" "mod_speedrun_branch"
		"classname" "logic_branch"
	}
	delete:
	{
		"OnTrue" "global_teleport_start,Enable,,20,1"
	}
	insert:
	{
		"OnTrue" "global_teleport_start,Enable,,25,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_00_a"
		"classname" "logic_relay"
	}
	delete:
	{
		"OnTrigger" "teleport_case,InValue,1,10,1"
		"OnTrigger" "point_servercommand,Command,say ZM teleport will be activated in 10 sec,1,1"
	}
	insert:
	{
		"OnTrigger" "teleport_case,InValue,1,20,1"
		"OnTrigger" "point_servercommand,Command,say ZM teleport will be activated in 20 sec,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_00_b"
		"classname" "logic_relay"
	}
	delete:
	{
		"OnTrigger" "teleport_case,InValue,2,20,1"
		"OnTrigger" "point_servercommand,Command,say ZM teleport will be activated in 20 sec,0,1"
	}
	insert:
	{
		"OnTrigger" "teleport_case,InValue,2,30,1"
		"OnTrigger" "point_servercommand,Command,say ZM teleport will be activated in 30 sec,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_05"
		"classname" "logic_relay"
	}
	delete:
	{
		"OnTrigger" "windlock_door00,Close,,18,1"
		"OnTrigger" "teleport_case,InValue,3,20,1"
		"OnTrigger" "point_servercommand,Command,say ZM teleport will be activated in 20 sec,1,1"
	}
	insert:
	{
		"OnTrigger" "windlock_door00,Close,,28,1"
		"OnTrigger" "teleport_case,InValue,3,30,1"
		"OnTrigger" "point_servercommand,Command,say ZM teleport will be activated in 20 sec,10,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_07"
		"classname" "logic_relay"
	}
	delete:
	{
		"OnTrigger" "point_servercommand,Command,say Chappel Roof Shortcut is open now,10,1"
		"OnTrigger" "point_servercommand,Command,say Chappel Roof Shortcut will open in 10 sec,0,1"
		"OnTrigger" "windlock_door03,FireUser1,,10,1"

		"OnTrigger" "teleport_case,InValue,4,30,1"
		"OnTrigger" "windlock_door02,Close,,30,1"
		"OnTrigger" "point_servercommand,Command,say ZM teleport will be activated in 30 sec,1,1"
	}
	insert:
	{
		"OnTrigger" "point_servercommand,Command,say Chappel Roof Shortcut is open now,20,1"
		"OnTrigger" "point_servercommand,Command,say Chappel Roof Shortcut will open in 20 sec,0,1"
		"OnTrigger" "windlock_door03,FireUser1,,20,1"

		"OnTrigger" "teleport_case,InValue,4,45,1"
		"OnTrigger" "windlock_door02,Close,,45,1"
		"OnTrigger" "point_servercommand,Command,say ZM teleport will be activated in 40 sec,5,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_08"
		"classname" "logic_relay"
	}
	delete:
	{
		"OnTrigger" "windlock_door04,Open,,20,1"
		"OnTrigger" "teleport_case,InValue,5,20,1"
		"OnTrigger" "point_servercommand,Command,say ZM teleport will be activated in 20 sec,1,1"
	}
	insert:
	{
		"OnTrigger" "windlock_door04,Open,,30,1"
		"OnTrigger" "teleport_case,InValue,5,30,1"
		"OnTrigger" "point_servercommand,Command,say ZM teleport will be activated in 25 sec,5,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_09"
		"classname" "logic_relay"
	}
	delete:
	{
		"OnTrigger" "windlock_door05,Open,,5,1"
		"OnTrigger" "windlock_door06,Open,,5,1"
		"OnTrigger" "point_servercommand,Command,say Final Tower Shortcuts is open now,5,1"
		"OnTrigger" "point_servercommand,Command,say Final Tower Shortcuts will open in 5 sec,0,1"
	}
	insert:
	{
		"OnTrigger" "windlock_door05,Open,,0,1"
		"OnTrigger" "windlock_door06,Open,,0,1"
		"OnTrigger" "point_servercommand,Command,say Final Tower Shortcuts is open now,0,1"
	}
}



;fix windlock skip
modify:
{
	match:
	{
		"classname" "trigger_push"
		"origin" "6340.5 5606 4938.24"
	}
	replace:
	{
		"origin" "6340.5 5530 4938.24"
	}
}

;nerf poison mine
modify:
{
	match:
	{
		"targetname" "poison_mine_counter"
		"classname" "math_counter"
	}
	replace:
	{
		"startvalue" "3"
		"max" "3"
	}
}
modify:
{
	match:
	{
		"targetname" "poison_slow"
		"classname" "trigger_hurt"
	}
	replace:
	{
		"damage" "250"
	}
}

add:
{
	"targetname" "poison_mine_template"
	"spawnflags" "0"
	"classname" "point_template"
	"origin" "1866 9997 670.594"
	"Template09" "poison_mine_effect"
	"Template08" "poison_mine_maker"
	"Template07" "poison_mine_filter"
	"Template06" "poison_mine_button"
	"Template05" "poison_mine_gun"
	"Template04" "poison_mine_branch"
	"Template03" "poison_mine_use_brach"
	"Template02" "poison_mine_counter"
	"Template01" "poison_mine_prop"
}
modify:
{
	match:
	{
		"classname" "logic_auto"
	}
	insert:
	{
		"OnMapSpawn" "poison_mine_template,ForceSpawn,,11,1"
		"OnMapSpawn" "poison_mine_template,AddOutput,origin 306 9644 650,11.05,1"
		"OnMapSpawn" "poison_mine_template,ForceSpawn,,11.1,1"
	}
}

;fix skin
filter:
{
	"targetname" "Player_Skin_Trigger"
	"classname" "trigger_multiple"
}
modify:
{
	match:
	{
		"classname" "logic_auto"
	}
	delete:
	{
		"OnNewGame" "Player_Skin_Trigger,FireUser1,,0,1"
		"OnNewGame" "Player_Skin_Trigger,Kill,,31,1"
	}
}
modify:
{
	match:
	{
		"targetname" "global_teleport_start_ct"
		"classname" "trigger_teleport"
	}
	insert:
	{
		"OnStartTouch" "!activator,AddOutput,modelindex 199,0.1,-1"
	}
}

;fix fakemessage
modify:
{
	match:
	{
		"targetname" "trigger_00"
		"classname" "logic_relay"
	}
	insert:
	{
		"OnTrigger" "shortcut00,Kill,,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_01"
		"classname" "logic_relay"
	}
	insert:
	{
		"OnTrigger" "shortcut01,Kill,,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_02"
		"classname" "logic_relay"
	}
	insert:
	{
		"OnTrigger" "shortcut02,Kill,,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_03"
		"classname" "logic_relay"
	}
	insert:
	{
		"OnTrigger" "shortcut03,Kill,,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_06"
		"classname" "logic_relay"
	}
	insert:
	{
		"OnTrigger" "shortcut06,Kill,,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_07"
		"classname" "logic_relay"
	}
	insert:
	{
		"OnTrigger" "shortcut07,Kill,,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "trigger_08"
		"classname" "logic_relay"
	}
	insert:
	{
		"OnTrigger" "shortcut08,Kill,,0,1"
	}
}

;fix selectmode
add:
{
	"targetname" "mod_speed_allow"
	"InitialValue" "0"
	"classname" "logic_branch"
	"OnTrue" "select_mode_speed,Enable,,0,1"
	"OnTrue" "brush_select_mode_speed,Toggle,,0,1"
}
modify:
{
	match:
	{
		"targetname" "windlock_trigger00"
		"classname" "trigger_multiple"
	}
	delete:
	{
		"OnStartTouch" "worldspawn,AddOutput,OnUser1 select_mode_speed:Enable::6:-1,0.1,1"
		"OnStartTouch" "worldspawn,AddOutput,OnUser1 brush_select_mode_speed:Toggle::6:-1,0.1,1"
	}
	insert:
	{
		"OnStartTouch" "worldspawn,AddOutput,OnUser1 mod_speed_allow:SetValueTest:1:6:-1,0.1,1"
	}
}

;move end trigger
modify:
{
	match:
	{
		"origin" "6144.09 1440.07 12103"
		"classname" "trigger_once"
	}
	replace:
	{
		"origin" "6144 1376 12103"
	}
}

;add record
modify:
{
    match:
    {
        "classname" "logic_auto"
    }
    delete:
    {
        "OnMapSpawn" "point_servercommand,Command,say Mapper record 50:00:00,0,1"
    }
    insert:
    {
        "OnMapSpawn" "point_servercommand,Command,say Speedrun info:,1,1"
        "OnMapSpawn" "point_servercommand,Command,say Main Babe: BJ Fastest times,2,1"
        "OnMapSpawn" "point_servercommand,Command,say - Shy Neko 7:13:300,3,1"
        "OnMapSpawn" "point_servercommand,Command,say - zeo 8:21:000,4,1"
        "OnMapSpawn" "point_servercommand,Command,say - encapsulation_dot1q 9:44:600,5,1"
    }
}
// add:
// {
// 	"classname" "env_hudhint"
// 	"message" "Speedrun info:\n\nMain Babe: BJ Fastest times\n- wale 11:38\n\nMain Babe: GJ Fastest times\n- zeo 10:38:800"
// 	"spawnflags" "1"
// 	"targetname" "record_hudhint"
// 	"OnUser1" "record_hudhint,ShowHudHint,,0,1"
// 	"OnUser1" "record_hudhint,ShowHudHint,,4,1"
// 	"OnUser1" "record_hudhint,ShowHudHint,,8,1"
// 	"OnUser1" "record_hudhint,ShowHudHint,,12,1"
// 	"OnUser1" "record_hudhint,ShowHudHint,,16,1"
// 	"OnUser1" "record_hudhint,ShowHudHint,,20,1"
// 	"OnUser1" "record_hudhint,ShowHudHint,,24,1"
// 	"OnUser1" "record_hudhint,ShowHudHint,,28,1"
// 	"OnUser1" "record_hudhint,ShowHudHint,,32,1"
// }