;---------------------------------------------------
; Fix Early Elevator trigger
;---------------------------------------------------
modify:
{
	match:
	{
		"targetname" "poison_lift_up"
		"origin" "-6276.4 -2614 -596.8"
		"classname" "trigger_multiple"
	}
	replace:
	{
		"StartDisabled" "1"
	}
}
modify:
{
	match:
	{
		"targetname" "poison_lift"
		"origin" "-6276.4 -2614 -418.6"
		"classname" "func_door"
	}
	insert:
	{
		"OnFullyOpen" "poison_lift_up,Enable,,0,1"
	}
}

;---------------------------------------------------
; Fix grammar / text spaces / Logic_auto problems
;---------------------------------------------------
modify:
{
	match:
	{
		"origin" "3920 -4660.5 -341"
		"classname" "logic_auto"
	}
	delete:
	{
		"OnMapSpawn" "main_tp_zmEnable181"
		"OnMapSpawn" "main_tpEnable121"
		"OnMapSpawn" "consoleCommandsay >>Teleport Enable In 5 Seconds<<71"
		"OnMapSpawn" "consoleCommandsay >>For Nide Contest 2025<<61"
		"OnMapSpawn" "consoleCommandsay >>Special Thank F4ckxyAnd Hobgoblin<<41"
		"OnMapSpawn" "consoleCommandsay >>Map made by PikaHaru&Khanq<<21"
		"OnMapSpawn" "consoleCommandmp_roundtime 22.501"
	}
	insert:
	{
		"OnMapSpawn" "console,Command,mp_roundtime 30,0,-1"
		"OnMapSpawn" "main_tp_zm,Enable,18,-1"
		"OnMapSpawn" "main_tp,Enable,,12,-1"
		"OnMapSpawn" "console,Command,say >>Stripper 2 loaded<<,0,-1"
		"OnMapSpawn" "console,Command,say >>Map made by PikaHaru & Khanq<<,2,-1"
		"OnMapSpawn" "console,Command,say >>Special Thanks to F4ckxy & HOBGOBLIN<<,4,-1"
		"OnMapSpawn" "console,Command,say >>For Nide Contest 2025<<,6,-1"
		"OnMapSpawn" "console,Command,say >>Teleport Enable In 5 Seconds<<,7,-1"
	}
}
modify:
{
	match:
	{
		"origin" "-1134.89 -6911.72 -24.93"
		"targetname" "puzzle_logic_counter"
		"classname" "math_counter"
	}
	delete:
	{
		"OnHitMax" "consoleCommandsay >>All button press,Door open in 30 seconds<<11"
	}
	insert:
	{
		"OnHitMax" "console,Command,say >>All buttons pressed, Door open in 30 seconds<<,1,1"
	}
}
modify:
{
	match:
	{
		"origin" "-5288.05 -2420.8 -58.59"
		"targetname" "cave_button_counter"
		"classname" "math_counter"
	}
	delete:
	{
		"OnHitMax" "consoleCommandsay >>All button pressed, Door open in 15 seconds<<11"
	}
	insert:
	{
		"OnHitMax" "console,Command,say >>All buttons pressed, Door open in 15 seconds<<,1,1"
	}
}
modify:
{
	match:
	{
		"targetname" "e1m7_button"
		"origin" "7663.2 -3942.4 479.8"
		"classname" "func_button"
	}
	delete:
	{
		"OnPressed" "consoleCommandsay >>Platform break in 40 seconds<<01"
	}
	insert:
	{
		"OnPressed" "console,Command,say >>Platform breaks in 40 seconds<<,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "slime_button"
		"origin" "-3909.75 -6453 328"
		"classname" "func_button"
	}
	delete:
	{
		"OnPressed" "consoleCommandsay >>Platform move in 10 seconds<<01"
	}
	insert:
	{
		"OnPressed" "console,Command,say >>Platform moves in 10 seconds<<,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "end_elevator"
		"origin" "2442 1966 -592"
		"classname" "func_movelinear"
	}
	delete:
	{
		"OnFullyOpen" "consoleCommandsay >>elevator go up in 10 seconds<<01"
	}
	insert:
	{
		"OnFullyOpen" "console,Command,say >>elevator goes up in 10 seconds<<,0,1"
	}
}

;------------------------
; Remove laser ending
;------------------------
filter:
{
	"origin" "4768 -672 784"
	"classname" "trigger_multiple"
}
filter:
{
	"targetname" "block_laser"
	"origin" "4768 -492 784"
	"classname" "func_breakable"
}
filter:
{
	"origin" "4768 1248 673"
	"targetname" "deathknight"
	"classname" "prop_dynamic_override"
}
filter:
{
	"origin" "4592 -799 700"
	"targetname" "laser_case2"
	"classname" "logic_case"
}
filter:
{
	"origin" "4568 -799 700"
	"targetname" "boss_laser_timer2"
	"classname" "logic_timer"
}
filter:
{
	"origin" "4512 -832 742"
	"targetname" "laser_crouch_relay2"
	"classname" "logic_relay"
}
filter:
{
	"targetname" "boss_block"
	"origin" "4768 1312 784"
	"classname" "func_breakable"
}
filter:
{
	"targetname" "Death Knight"
	"origin" "4768 1248 716.62"
	"classname" "func_breakable"
}

;------------------------
; Apply new ending
;------------------------
filter:
{
	"origin" "4768 1904 712"
	"classname" "trigger_multiple"
	"hammerid" "159449"
}
add:
{
	"model" "*160"
	"targetname" "final_trigger"
	"StartDisabled" "0"
	"spawnflags" "1"
	"origin" "4768 1904 712"
	"classname" "trigger_once"
	"OnStartTouch" "last_break1Break151"
	"OnStartTouch" "consoleCommandsay >>The bridge break in 15 seconds<<01"
	"OnStartTouch" "consoleCommandsay >>The bridge broke!<<151"
	"OnStartTouch" "consoleCommandsay >>Go through the portal now to escape!<<201"
	"OnStartTouch" "last_tp4Enable201"
}
modify:
{
	match:
	{
		"origin" "5356 5919 375"
		"classname" "trigger_multiple"
		"hammerid" "97165"
	}
	delete:
	{
		"OnStartTouch" "consoleCommandsay >>Teleport will enable soon<<01"
	}
	insert:
	{
		"OnStartTouch" "consoleCommandsay >>Teleporter will enable in 60 seconds<<01"
		"OnStartTouch" "consoleCommandsay >>Teleporter is active!<<601"
		"OnStartTouch" "triggertp5Enable701"
	}
}

;--------------------------------------------------------------
; Fix lava part where zombies could just walk in
;--------------------------------------------------------------
modify:
{
	match:
	{
		"origin" "5284 5571 -1333"
		"classname" "trigger_hurt"
		"hammerid" "52048"
	}
	replace:
	{
		"damagecap" "9999"
		"damage" "9999"
	}
	insert:
	{
		"filtername" "Human"
	}
}
add:
{
	"model" "*74"
	"StartDisabled" "0"
	"spawnflags" "3"
	"origin" "5540 5571 -1333"
	"nodmgforce" "0"
	"damagetype" "8"
	"damagemodel" "0"
	"filtername" "Human"
	"damagecap" "9999"
	"damage" "9999"
	"classname" "trigger_hurt"
}
add:
{
	"model" "*74"
	"targetname" "fail_safe_tp_for_zombies"
	"target" "stage3_tp"
	"StartDisabled" "0"
	"filtername" "Zombie"
	"spawnflags" "1"
	"origin" "5284 5571 -1333"
	"classname" "trigger_teleport"
}
add:
{
	"model" "*74"
	"targetname" "fail_safe_tp_for_zombies"
	"target" "stage3_tp"
	"StartDisabled" "0"
	"filtername" "Zombie"
	"spawnflags" "1"
	"origin" "5540 5571 -1333"
	"classname" "trigger_teleport"
}

;-----------------------
; Fix multiple tp enable issues
;-----------------------
modify:
{
	match:
	{
		"origin" "-7543.6 1709 106.1"
		"classname" "trigger_once"
		"hammerid" "81362"
	}
	delete:
	{
		"OnStartTouch" "triggertp2Enable51"
	}
	insert:
	{
		"OnStartTouch" "triggertp2Enable101"
	}
}
modify:
{
	match:
	{
		"origin" "-5959.5 2964 -406.4"
		"classname" "trigger_multiple"
		"hammerid" "84728"
	}
	delete:
	{
		"OnStartTouch" "teleport1Enable01"
	}
	insert:
	{
		"OnStartTouch" "teleport1Enable101"
	}
}

;-----------------------
; Add trigger_hurt in a no tp zones
;-----------------------
add:
{
	"model" "*160"
	"StartDisabled" "0"
	"spawnflags" "3"
	"origin" "2976 -11056 -415"
	"nodmgforce" "0"
	"damagetype" "8"
	"damagemodel" "0"
	"damagecap" "9999"
	"damage" "9999"
	"classname" "trigger_hurt"
}
add:
{
	"model" "*160"
	"StartDisabled" "0"
	"spawnflags" "3"
	"origin" "2976 -11376 -415"
	"nodmgforce" "0"
	"damagetype" "8"
	"damagemodel" "0"
	"damagecap" "9999"
	"damage" "9999"
	"classname" "trigger_hurt"
}
add:
{
	"model" "*160"
	"StartDisabled" "0"
	"spawnflags" "3"
	"origin" "5477.62 6691.09 -47"
	"nodmgforce" "0"
	"damagetype" "8"
	"damagemodel" "0"
	"damagecap" "9999"
	"damage" "9999"
	"classname" "trigger_hurt"
}
add:
{
	"model" "*160"
	"StartDisabled" "0"
	"spawnflags" "3"
	"origin" "5173.62 6691.09 -47"
	"nodmgforce" "0"
	"damagetype" "8"
	"damagemodel" "0"
	"damagecap" "9999"
	"damage" "9999"
	"classname" "trigger_hurt"
}
add:
{
	"model" "*160"
	"StartDisabled" "0"
	"spawnflags" "3"
	"origin" "4837.62 6691.09 -47"
	"nodmgforce" "0"
	"damagetype" "8"
	"damagemodel" "0"
	"damagecap" "9999"
	"damage" "9999"
	"classname" "trigger_hurt"
}

;-----------------------
; Fix an elevator being triggered too fast...
;-----------------------
modify:
{
	match:
	{
		"targetname" "plat3_up"
		"origin" "6244 4515 -1131"
		"classname" "trigger_multiple"
	}
	replace:
	{
		"Origin" "6244 4483 -1123"
	}
}
filter:
{
	"targetname" "plat3_down"
	"origin" "6244 4515 -63"
	"classname" "trigger_multiple"
}

;-----------------------
; Apply modelindex to humans & setup spawn
;-----------------------
filter:
{
	"targetname" "tps2"
	"origin" "3488 -5632 -192"
	"classname" "trigger_teleport"
}
modify:
{
	match:
	{
		"targetname" "main_tp_zm"
		"origin" "3488 -5632 -224"
		"classname" "trigger_teleport"
	}
	insert:
	{
		"filtername" "Zombie"
	}
}
modify:
{
	match:
	{
		"targetname" "main_tp"
		"origin" "3488 -5632 -208"
		"classname" "trigger_teleport"
	}
	insert:
	{
		"filtername" "Human"
		"OnStartTouch" "!activator,AddOutput,modelindex 336,0,-1"
	}
}



;; _

;; fix spawntime

modify:
{
	match:
	{
		"classname" "logic_auto"
		"hammerid" "239961"
	}
	insert:
	{
		"OnMapSpawn" "console,Command,zr_infect_spawntime_min 13,0,-1"
		"OnMapSpawn" "console,Command,zr_infect_spawntime_max 16,0,-1"
	}
}