;ze_arid_lands_of_king_theba_b1_0 -- Stripper fixes -- Last Updated May 17th, 2024
;Thanks to NiDE for helping with testing the map before and after Stripper changes were made.
;Extra comment -- If your server has a hitmarkers plugin of sorts, please disable it as this map uses custom overlays of its own and will cause flickering.

;------------------
; General Stuff
;------------------

;Spawns an extra radar template to reset the effects of Jammer in case a template radar isn't in the map at the moment Jammer is used.

modify:
{
	match:
	{
		"targetname" "item_radar_jammer_filter"
	}
	insert:
	{
		"OnPass" "template_radar_maker,ForceSpawnAtEntityOrigin,item_radar_jammer_button,8.05,-1"
	}
}

;Enables bhop every round due to Stripper config disabling it at parts

modify:
{
	match:
	{
		"classname" "logic_auto"
	}
	insert:
	{
		"OnNewGame" "main_console,FireUser3,,2,1"
		"OnNewGame" "main_console,Command,sv_airaccelerate 16,2,1"
	}
}

;------------------
; Stage 1
;------------------

;------------------
; Oasis
;------------------

;Increases the time the zombie tp stays active for in the sewer section

modify:
{
	match:
	{
		"targetname" "s1_oasis_hold3_break_tp"
	}
	replace:
	{
		"spawnflags" "1"
	}
}

modify:
{
	match:
	{
		"targetname" "s1_oasis_hold3_trigger"
	}
	delete:
	{
		"OnTrigger" "s1_oasis_hold3_break_tp,Kill,,30,1"
	}	
	insert:
	{
		"OnTrigger" "s1_oasis_hold3_break_tp,Kill,,31,1"
	}
}

;Adds a push trigger that I meant to add before but forgor skull emoji

add:
{
	"model" "*80"
	"targetname" "s1_oasis_hold7_push_zm"
	"StartDisabled" "1"
	"speed" "450"
	"spawnflags" "1"
	"pushdir" "0 135 0"
	"origin" "2400 -1520 768"
	"filtername" "main_filter_zombies"
	"alternateticksfix" "0"
	"classname" "trigger_push"
}

modify:
{
	match:
	{
		"targetname" "s1_oasis_hold7_trigger"
	}
	insert:
	{
		"OnTrigger" "s1_oasis_hold7_push_zm,Enable,,32,1"
		"OnTrigger" "s1_oasis_hold7_push_zm,Kill,,38,1"
	}
}

;------------------
; Alley of the Sphinxes
;------------------

;Disables bhop when humans get teleported to the canyon area

modify:
{
	match:
	{
		"targetname" "s1_aos_hold1_push"
	}
	insert:
	{
		"OnStartTouch" "main_console,FireUser2,,0,1"
	}
}

;Shortens the first hold time in the canyon area to 20 seconds from 25

filter:
{
	"targetname" "s1_aos_hold1_relay"
}

add:
{
	"origin" "-8000 10400 -2880"
	"targetname" "s1_aos_hold1_relay"
	"StartDisabled" "0"
	"spawnflags" "0"
	"classname" "logic_relay"
	"hammerid" "114379"
	
	"OnTrigger" "c4_maker,ForceSpawnAtEntityOrigin,!caller,5,1"
	"OnTrigger" "item_detonator_template,ForceSpawn,,18,1"
	"OnTrigger" "c4_prop*,Kill,,20,1"
	"OnTrigger" "explosion_huge_maker,ForceSpawnAtEntityOrigin,!caller,20,1"
	"OnTrigger" "s1_aos_hold1_break,Break,,20,1"
	"OnTrigger" "s1_aos_hold1_prop,Kill,,20,1"
	"OnTrigger" "s1_music_aos_peace,FireUser2,,20,1"
	"OnTrigger" "!self,Kill,,20.08,1"
	"OnTrigger" "s1_music_aos_medium,FireUser1,,22,1"
	"OnTrigger" "main_console,Command,say **[A.M.I.G.O.] Look! There's a clean water stream up ahead**,23,1"
	"OnTrigger" "main_console,Command,say **[A.M.I.G.O.] Aren't we lucky? This one's running down in the direction we're headed to**,27,1"
	"OnTrigger" "main_console,Command,say **[A.M.I.G.O.] Let's not take it down all the way though -- My readings also point out a dead end further ahead**,31,1"
	"OnTrigger" "s1_aos_hold1_tp,Enable,,45,1"
}

;Filters out the prop_dynamics used in the Detonator item and replaces them with an info_teleport_destination entity

filter:
{
	"classname" "prop_dynamic"
	"targetname" "item_detonator_exp_spawner_l"
}

filter:
{
	"classname" "prop_dynamic"
	"targetname" "item_detonator_exp_spawner_r"
}

add:
{
	"origin" "-7456 8576 -2016"
	"targetname" "item_detonator_exp_spawner_l"
	"parentname" "item_detonator_prop"
	"angles" "0 270 0"
	"classname" "info_teleport_destination"
	
	"OnUser1" "explosion_huge_maker,ForceSpawnAtEntityOrigin,!caller,0.05,1"
}

add:
{
	"origin" "-8480 8576 -2016"
	"targetname" "item_detonator_exp_spawner_r"
	"parentname" "item_detonator_prop"
	"angles" "0 270 0"
	"classname" "info_teleport_destination"
	
	"OnUser1" "explosion_huge_maker,ForceSpawnAtEntityOrigin,!caller,0.05,1"
}

;Adds a new breakable at the river hold as there's a gap there where humans can currently bug through -- Thanks to Hobgoblin for reporting

add:
{
	"model" "*157"
	"targetname" "s1_aos_hold2_break"
	"spawnobject" "0"
	"spawnflags" "1"
	"rendermode" "0"
	"renderfx" "0"
	"rendercolor" "255 255 255"
	"renderamt" "255"
	"propdata" "0"
	"pressuredelay" "0"
	"physdamagescale" "1.0"
	"PerformanceMode" "0"
	"origin" "1408 5136 -3520"
	"nodamageforces" "0"
	"minhealthdmg" "0"
	"material" "8"
	"health" "0"
	"gibdir" "0 0 0"
	"explosion" "0"
	"ExplodeRadius" "0"
	"explodemagnitude" "0"
	"ExplodeDamage" "0"
	"disableshadows" "1"
	"disablereceiveshadows" "1"
	"classname" "func_breakable"
	"hammerid" "122376"
}


;Increases the hold time by 10 seconds at the waterfall / bridge part so zombies have a chance to catch up

filter:
{
	"targetname" "s1_aos_hold3_relay"
}

add:
{
	"origin" "-6240 3136 -4800"
	"targetname" "s1_aos_hold3_relay"
	"StartDisabled" "0"
	"spawnflags" "0"
	"classname" "logic_relay"
	"hammerid" "143516"
	
	"OnTrigger" "c4_maker,ForceSpawnAtEntityOrigin,!caller,5,1"
	"OnTrigger" "s1_aos_hold4_pfx_spawner,Trigger,,21.08,1"
	"OnTrigger" "c4_prop*,Kill,,25,1"
	"OnTrigger" "explosion_huge_maker,ForceSpawnAtEntityOrigin,!caller,25,1"
	"OnTrigger" "s1_aos_hold3_break,Break,,25,1"
	"OnTrigger" "s1_aos_hold3_prop,Kill,,25,1"
	"OnTrigger" "!self,Kill,,25.08,1"
}

;------------------
; Dunes
;------------------

;Moves the ZM td further back and the fog trigger with it as they spawn too close to humans

modify:
{
	match:
	{
		"origin" "11136 -14656 -10143"
		"targetname" "s1_dunes_hold1_td_zm"
	}
	replace:
	{
		"origin" "11136 -15168 -10180"
	}
}

modify:
{
	match:
	{
		"targetname" "s1_dunes_hold1_fog_zm"
	}
	replace:
	{
		"origin" "11136 -15168 -10080"
	}
	insert:
	{
		"OnStartTouch" "main_console,Command,sv_airaccelerate 10,3,1"
	}
}

;Adds a clone of the zm trigger at the Dunes section to apply fog to humans as it's currently not long enough to cover both TPs

add:
{
	"model" "*174"
	"targetname" "s1_dunes_hold1_fog_human_alt"
	"wait" "1"
	"StartDisabled" "0"
	"origin" "11136 -15168 -10080"
	"spawnflags" "1"
	"filtername" "main_filter_humans"
	"classname" "trigger_multiple"
	
	"OnStartTouch" "!activator,SetFogController,main_fog_humans,0,-1"
}

;Lowers the zombie health nerfs even more to accommodate for high zombie numbers

modify:
{
	match:
	{
		"targetname" "s1_dunes_hold1_nerf"
	}
	delete:
	{
		"OnStartTouch" "!activator,AddOutput,health 1250,0,-1"
	}
	insert:
	{
		"OnStartTouch" "!activator,AddOutput,health 350,0,-1"
		"OnEndTouch" "!activator,AddOutput,health 350,0,-1"
	}
}

modify:
{
	match:
	{
		"targetname" "s1_dunes_hold3_nerf"
	}
	delete:
	{
		"OnStartTouch" "!activator,AddOutput,health 3000,0,-1"
	}
	insert:
	{
		"OnStartTouch" "!activator,AddOutput,health 2500,0,-1"
		"OnEndTouch" "!activator,AddOutput,health 2500,0,-1"
	}
}

;Moves zombie teleports everytime humans get to a new hold so they can spawn closer every time

modify:
{
	match:
	{
		"targetname" "s1_dunes_hold2_trigger"
	}
	insert:
	{
		"OnTrigger" "s1_dunes_hold1_fog_zm,AddOutput,OnStartTouch !activator:AddOutput:origin 11136 -8288 -10176:0.02:-1,0,1"
	}
}

modify:
{
	match:
	{
		"targetname" "s1_dunes_hold3_trigger"
	}
	insert:
	{
		"OnTrigger" "s1_dunes_hold1_fog_zm,AddOutput,OnStartTouch !activator:AddOutput:origin 11136 -5344 -10176:0.04:-1,0,1"
		"OnTrigger" "s1_dunes_hold3_nerf,AddOutput,OnEndTouch !activator:AddOutput:health 500:0.05:-1,18.05,1"
	}
}

;Changes some outputs on Dunes to apply fades only once

modify:
{
	match:
	{
		"targetname" "s1_aos_hold5_fade"
	}
	delete:
	{
		"OnStartTouch" "s1_fade_to_dunes,Fade,,0,-1"
	}
	insert:
	{
		"OnStartTouch" "s1_fade_to_dunes,Fade,,0,1"
	}
}

modify:
{
	match:
	{
		"targetname" "s1_dunes_run_trigger"
	}
	delete:
	{
		"OnStartTouch" "s1_fade_to_dunes,Fade,,2,-1"
	}
	insert:
	{
		"OnStartTouch" "s1_fade_to_dunes,Fade,,2,1"
	}
}

;Reenables proper bhop settings after the Dunes fog section

modify:
{
	match:
	{
		"targetname" "s1_dunes_outside_trigger"
	}
	insert:
	{
		"OnStartTouch" "!self,FireUser1,,0,1"
		"OnStartTouch" "main_console,FireUser3,,2,1"
		"OnStartTouch" "main_console,Command,sv_airaccelerate 16,2,1"
	}
}

;Applies the nuke_ignore filter in the teleport after the funny to ensure everyone gets it

modify:
{
	match:
	{
		"targetname" "s1_post_end_tp_humans"
	}
	insert:
	{
		"OnStartTouch" "!activator,SetDamageFilter,nuke_ignore,0,-1"
	}
}



;; _

;; restart round on warmup

modify:
{
	match:
	{
		"targetname" "level_case"
		"classname" "logic_case"
	}
	delete:
	{
		"OnCase16" "nuke_zone,FireUser1,,52,1"
	}
	insert:
	{
		"main_console,Command,mp_restartgame 1,52,1"
	}
}