add:
{
	"origin" "472 -1016 1064"
	"targetname" "TheCurrentLevelPlugin"
	"min" "1"
	"max" "2"
	"startvalue" "1"
	"classname" "math_counter"
}

modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1211605"
	}
	insert:
	{
		"OnStartTouch" "TheCurrentLevelPlugin,SetValue,1,0,1"
	}
}
modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1268906"
	}
	insert:
	{
		"OnStartTouch" "TheCurrentLevelPlugin,SetValue,2,0,1"
	}
}


;; _

;; increase lava damage to prevent early triggering, which can lead to zombies evading cage teleport
 
modify:
{
	match:
	{
		"origin" "-11871 3348 -12854"
		"classname" "trigger_hurt"
	}
	replace:
	{
		"damage" "1000"
	}
}

;; delay door opening a bit
 
modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1258237"
	}
	delete:
	{
		"OnTrigger" "door1_5,Open,,0,-1"
	}
	insert:
	{
		"OnTrigger" "door1_5,Open,,5,-1"
	}
}
 
;; stage 1 - fix zm teleport evading zone
 
add:
{
	"model" "*160"
	"targetname" "tele_zombie1"
	"StartDisabled" "1"
	"spawnflags" "1"
	"origin" "-10640 906 -12001"
	"filtername" "zombie"
	"classname" "trigger_teleport"
}
 
;; stage 1 - add human afk teleport
 
add:
{
	"model" "*160"
	"targetname" "tele_human1"
	"target" "ztele1_3"
	"StartDisabled" "1"
	"spawnflags" "1"
	"origin" "-10640 906 -12001"
	"filtername" "human"
	"classname" "trigger_teleport"
}
add:
{
	"model" "*165"
	"targetname" "tele_human1"
	"target" "ztele1_3"
	"StartDisabled" "1"
	"spawnflags" "1"
	"origin" "-11679.5 2941.5 -12308"
	"filtername" "human"
	"classname" "trigger_teleport"
}
 
modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1271019"
	}
	insert:
	{
		"OnTrigger" "tele_human1,Enable,,15,-1"
	}
}
;; ze_tloz_stone_tower_temple_v1
 
;; stage 1 - don't close doors if blocked
 
modify:
{
	match:
	{
		"targetname" "/door1_[2-11]/"
		"classname" "func_door"
	}
	replace:
	{
		"wait" "-1"
		"dmg" "50000"
	}
}
 
;; stage 1 - close door after mass teleport
 
modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1271019"
	}
	insert:
	{
		"OnTrigger" "door1_5,Close,,15,-1"
	}
}
 
;; stage 1 - extended ztele
 
modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1375071"
	}
	insert:
	{
		"OnTrigger" "tele_base,AddOutput,target alltele1_0,10,1"
	}
}
modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1379623"
	}
	insert:
	{
		"OnTrigger" "tele_base,AddOutput,target ztele1_8,10,1"
	}
}
 
;; stage 2 - extended ztele
 
modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1426062"
	}
	insert:
	{
		"OnTrigger" "tele_base,AddOutput,target alltele2_1,10,1"
	}
}
modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1429481"
	}
	insert:
	{
		"OnTrigger" "tele_base,AddOutput,target ztele2_2,10,1"
	}
}
modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1434450"
	}
	insert:
	{
		"OnTrigger" "tele_base,AddOutput,target alltele2_3,15,1"
	}
}
modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1449282"
	}
	insert:
	{
		"OnTrigger" "tele_base,AddOutput,target alltele2_4,10,1"
	}
}
modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1452824"
	}
	insert:
	{
		"OnTrigger" "tele_base,AddOutput,target alltele2_5,10,1"
	}
}

;; stage 1 - delay spawn teleport

modify:
{
	match:
	{
		"classname" "trigger_once"
		"hammerid" "1275312"
	}
	delete:
	{
		"OnTrigger" "tele_base,AddOutput,target ztele1_6,35,1"
	}
	insert:
	{
		"OnTrigger" "tele_base,AddOutput,target ztele1_6,45,1"
	}
}

;; stage 1 - fix final door timing

modify:
{
	match:
	{
		"targetname" "breakable1_13"
		"classname" "func_breakable"
	}
	delete:
	{
		"OnBreak" "winner_multiple1_0,Enable,,57,-1"
		"OnBreak" "door1_0,Close,,30,-1"
	}
	insert:
	{
		"OnBreak" "winner_multiple1_0,Enable,,65,-1"
		"OnBreak" "door1_0,Close,,38,-1"
	}
}

;; 'easter egg' after winning both stages

modify:
{
	match:
	{
		"origin" "-430 -614 1067"
		"classname" "trigger_once"
		"hammerid" "1211605"
	}
	insert:
	{
		"OnStartTouch" "level1_brush,FireUser1,,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "win2_0"
		"classname" "logic_relay"
	}
	insert:
	{
		"OnTrigger" "level1_brush,AddOutput,OnUser1 stage1_moon:FireUser1::0:1,0,1"
	}
}
modify:
{
	match:
	{
		"targetname" "stage1_moon"
		"classname" "prop_dynamic"
	}
	insert:
	{
		"OnUser1" "!self,AddOutput,origin -350 120 -450,0,1"
		"OnUser1" "link_moon,Enable,,0,1"
	}
}

add:
{
	"origin" "-8927 445 -12078"
	"targetname" "link_moon"
	"StartDisabled" "1"
	"spawnflags" "0"
	"solid" "0"
	"skin" "0"
	"SetBodyGroup" "0"
	"rendermode" "0"
	"renderfx" "0"
	"rendercolor" "255 255 255"
	"renderamt" "255"
	"RandomAnimation" "0"
	"pressuredelay" "0"
	"PerformanceMode" "0"
	"modelscale" "1.0"
	"model" "models/empty_link/empty_link.mdl"
	"mindxlevel" "0"
	"MinAnimTime" "5"
	"maxdxlevel" "0"
	"MaxAnimTime" "10"
	"fadescale" "1"
	"fademindist" "-1"
	"fademaxdist" "0"
	"ExplodeRadius" "0"
	"ExplodeDamage" "0"
	"disableshadows" "0"
	"disablereceiveshadows" "0"
	"DisableBoneFollowers" "0"
	"angles" "0 -90 0"
	"classname" "prop_dynamic"
}

modify:
{
	match:
	{
		"targetname" "door1_1"
		"classname" "func_door"
	}
	insert:
	{
		"OnFullyClosed" "link_moon,Kill,,8,1"
	}
}

;; music volume

filter:
{
	"hammerid" "1684742"
}
{
	"hammerid" "1684745"
}
{
	"hammerid" "1211534"
}
{
	"hammerid" "1211555"
}

modify:
{
	match:
	{
		"targetname" "music1_0"
		"classname" "ambient_generic"
	}
	replace:
	{
		"message" "#mapping/ze_tloz_stone_tower_temple/#music1_0.mp3"
	}
}
modify:
{
	match:
	{
		"targetname" "music1_1"
		"classname" "ambient_generic"
	}
	replace:
	{
		"message" "#mapping/ze_tloz_stone_tower_temple/#music1_1.mp3"
	}
}
modify:
{
	match:
	{
		"targetname" "music2_0"
		"classname" "ambient_generic"
	}
	replace:
	{
		"message" "#mapping/ze_tloz_stone_tower_temple/#music2_0.mp3"
	}
}



modify:
{
	match:
	{
		"DisableBoneFollowers" "0"
		"classname" "prop_dynamic"
	}
	replace:
	{
		"DisableBoneFollowers" "1"
	}
}
