Skip to content

Commit

Permalink
Split tankwarps into map specific scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Treescrub committed Jul 13, 2021
1 parent 651b258 commit ca4fc6e
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 91 deletions.
26 changes: 14 additions & 12 deletions scripts/vscripts/anv_mapfixes.nut
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,26 @@ __CollectEventCallbacks( this, "OnGameEvent_", "GameEventCallbacks", RegisterScr
** Speedy code goes in, speedy fix comes out.
*****************************************************************************/

g_FixScriptTable <- {};

::Apply_Quadmode_Map_Specific_Fixes <- function()
{
// Add reliably-named Survivor and Infected team filters to every map.
// These are deleted if it's a "COMMUNITY" (unknown) map.

SpawnGlobalFilters();

// Only run if it's Versus and not Taaannnk!! Mutation. Instantly warps
// Tanks that spawn unreasonably far away from Survivors or exposed.
// Note this runs even for all "COMMUNITY" maps and other Mutations so
// requires unique scope to not overwrite their "tank_spawn" events.
// Needs to run for both rounds or else both teams won't get warped.

if ( g_BaseMode == "versus" && g_MutaMode != "mutation19" )
{
EntFire( "worldspawn", "RunScriptFile", "anv_tankwarps" );
}

// If it's VS Survival (mutation15), delete new props that obstruct
// Survivor movement since their play space is already limited. This
// includes c2m5's hittable dumpsters, c3m3's hittable log, & c10m5's
Expand All @@ -96,17 +109,6 @@ __CollectEventCallbacks( this, "OnGameEvent_", "GameEventCallbacks", RegisterScr
EntFire( g_UpdateName + "_hittable_rock", "Kill", null, 0.1 );
}

// Only run if it's Versus and not Taaannnk!! Mutation. Instantly warps
// Tanks that spawn unreasonably far away from Survivors or exposed.
// Note this runs even for all "COMMUNITY" maps and other Mutations so
// requires unique scope to not overwrite their "tank_spawn" events.
// Needs to run for both rounds or else both teams won't get warped.

if ( g_BaseMode == "versus" && g_MutaMode != "mutation19" )
{
EntFire( "worldspawn", "RunScriptFile", "anv_tankwarps" );
}

// Map fixes for Valve.
// Dev Thread: https://steamcommunity.com/app/550/discussions/1/1651043320659915818/

Expand All @@ -123,7 +125,7 @@ __CollectEventCallbacks( this, "OnGameEvent_", "GameEventCallbacks", RegisterScr
}
}

if( !IncludeScript( "anv_mapfixes/" + g_MapName ) )
if( !IncludeScript( "anv_mapfixes/" + g_MapName, g_FixScriptTable ) )
{
/*==============================
|| ||
Expand Down
9 changes: 9 additions & 0 deletions scripts/vscripts/anv_mapfixes/c12m4_barn.nut
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,13 @@ if ( HasPlayerControlledZombies() )
make_prop( "dynamic", "_solidify_finalchimney1", "models/props/cs_militia/fireplacechimney01.mdl", "11020 -4586 329", "0 135 0", "shadow_no" );
make_prop( "dynamic", "_solidify_finalchimney2", "models/props/cs_militia/fireplacechimney01.mdl", "11020 -4073 329", "0 135 0", "shadow_no" );
patch_ladder( "11314.7 -4535 -259.108", "0 -22 9" );
}

function DoTankWarp( hndTank )
{
// move tank spawn from hillside before event area to top of trains (~60% boss flow)
if( anv_tankwarps.CheckToWarpTank( hndTank, [10535, -5508, 11360, -4625] ) )
{
hndTank.SetOrigin( Vector( 10492, -4633, 57.9 ) );
}
}
13 changes: 13 additions & 0 deletions scripts/vscripts/anv_mapfixes/c13m4_cutthroatcreek.nut
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,17 @@ if ( HasPlayerControlledZombies() )
patch_ladder( "159 4845.5 159", "-15 0 0" );
patch_ladder( "178 4845.5 109.5", "-17 0 0" );
patch_ladder( "195 4845.5 -18.624", "-17 0 0" );
}

function DoTankWarp( hndTank )
{
// move tank spawns back a bit to discourage rushing
if( anv_tankwarps.CheckToWarpTank( hndTank, [-1910, -2100, -470, -850] ) )
{
hndTank.SetOrigin( Vector( -488, -516, -374.9 ) );
}
else if( anv_tankwarps.CheckToWarpTank( hndTank, [-960, -850, -195, 50] ) )
{
hndTank.SetOrigin( Vector( -672, 362, -381.8 ) );
}
}
9 changes: 9 additions & 0 deletions scripts/vscripts/anv_mapfixes/c1m2_streets.nut
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,13 @@ if ( HasPlayerControlledZombies() )

con_comment( "FIX/ANTI-GRIEF:\tRemoved trigger which disables common infected spawns in Save 4 Less area for Versus only." );
kill_entity( Entities.FindByClassnameNearest( "trigger_once", Vector( -5128, -992, 548 ), 1 ) );
}

function DoTankWarp( hndTank )
{
// move tank spawn at ceda truck drop to the top of the stairs (~44% boss flow)
if( anv_tankwarps.CheckToWarpTank( hndTank, [-4755, 555, -4295, 1110] ) )
{
hndTank.SetOrigin( Vector( -5025, 725, 384.1 ) );
}
}
9 changes: 9 additions & 0 deletions scripts/vscripts/anv_mapfixes/c2m2_fairgrounds.nut
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,13 @@ if ( HasPlayerControlledZombies() )
// Manually fix the 2009 forklift since it is spawned after anv_mapfixes runs
NetProps.SetPropInt( Entities.FindByName( null, g_UpdateName + "_hittable_2009forklift" ), "m_iMinHealthDmg", 400 );
NetProps.SetPropInt( Entities.FindByName( null, g_UpdateName + "_hittable_2009forklift" ), "m_takedamage", 3 );
}

function DoTankWarp( hndTank )
{
// move tank spawn inside carousel fence to behind the carousel (~80% boss flow)
if( anv_tankwarps.CheckToWarpTank( hndTank, [-2750, -5450, -1450, -4925] ) )
{
hndTank.SetOrigin( Vector( -1725, -5900, 68.0 ) );
}
}
19 changes: 19 additions & 0 deletions scripts/vscripts/anv_mapfixes/c2m3_coaster.nut
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,23 @@ if ( HasPlayerControlledZombies() )
patch_ladder( "-4164 2274 128", "0 -2 0" );
patch_ladder( "-484 506 160", "0 -3 0" );
patch_nav_checkpoint( "3852 2037 -64" );
}

function DoTankWarp( hndTank )
{
// move tank spawn in the swan room to the next room forward (~25% boss flow)
if( anv_tankwarps.CheckToWarpTank( hndTank, [-300, 4100, 720, 4850] ) )
{
hndTank.SetOrigin( Vector( -312, 4155, 128.1 ) );
}
// move tank spawn after the coaster one way drop to the button area (76-79% boss flow)
else if( anv_tankwarps.CheckToWarpTank( hndTank, [-3700, 400, -3100, 1775] ) )
{
hndTank.SetOrigin( Vector( -3810, 1845, 160.1 ) );
}
// additional warp for the coaster one way drop area (80-83% boss flow)
else if( anv_tankwarps.CheckToWarpTank( hndTank, [-3700, 1775, -3100, 2850] ) )
{
hndTank.SetOrigin( Vector( -3423, 3480, 368.1 ) );
}
}
17 changes: 17 additions & 0 deletions scripts/vscripts/anv_mapfixes/c5m5_bridge.nut
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,21 @@ if ( HasPlayerControlledZombies() )
make_prop( "dynamic", "_solidify_finalsidehouse_acunit", "models/props_rooftop/acunit01.mdl", "10092.1 4520.26 491", "0 150 0", "shadow_no" );
make_prop( "dynamic", "_solidify_finalsidehouse_acvent", "models/props_rooftop/acvent03.mdl", "10185.5 4360.08 594", "0 150 0", "shadow_no" );
patch_ladder( "9271.145 4057.18 273.355", "0 0 0", "-1 0 0" );
}

function DoTankWarp( hndTank )
{
// move all bridge tank spawns a bit further down the bridge to discourage rushing
if( anv_tankwarps.CheckToWarpTank( hndTank, [-1450, 5955, -100, 6705] ) )
{
hndTank.SetOrigin( Vector( 830, 6328, 792 ) );
}
else if( anv_tankwarps.CheckToWarpTank( hndTank, [-100, 5955, 2000, 6705] ) )
{
hndTank.SetOrigin( Vector( 2720, 6338, 792 ));
}
else if( anv_tankwarps.CheckToWarpTank( hndTank, [2000, 5955, 4740, 6705] ) )
{
hndTank.SetOrigin( Vector( 4285, 6325, 792 ) );
}
}
81 changes: 2 additions & 79 deletions scripts/vscripts/anv_tankwarps.nut
Original file line number Diff line number Diff line change
Expand Up @@ -20,86 +20,9 @@ Does not support maps with more than 1 tank spawn (ie finales) - but could in th

if( iTankCount == 1 )
{
switch( g_MapName )
if( g_FixScriptTable != null && "DoTankWarp" in g_FixScriptTable )
{
case "c1m2_streets":
{
// move tank spawn at ceda truck drop to the top of the stairs (~44% boss flow)
if( CheckToWarpTank( hndTank, [-4755, 555, -4295, 1110] ) )
{
hndTank.SetOrigin( Vector( -5025, 725, 384.1 ) );
}
break;
}
case "c2m2_fairgrounds":
{
// move tank spawn inside carousel fence to behind the carousel (~80% boss flow)
if( CheckToWarpTank( hndTank, [-2750, -5450, -1450, -4925] ) )
{
hndTank.SetOrigin( Vector( -1725, -5900, 68.0 ) );
}
break;
}
case "c2m3_coaster":
{
// move tank spawn in the swan room to the next room forward (~25% boss flow)
if( CheckToWarpTank( hndTank, [-300, 4100, 720, 4850] ) )
{
hndTank.SetOrigin( Vector( -312, 4155, 128.1 ) );
}
// move tank spawn after the coaster one way drop to the button area (76-79% boss flow)
else if( CheckToWarpTank( hndTank, [-3700, 400, -3100, 1775] ) )
{
hndTank.SetOrigin( Vector( -3810, 1845, 160.1 ) );
}
// additional warp for the coaster one way drop area (80-83% boss flow)
else if( CheckToWarpTank( hndTank, [-3700, 1775, -3100, 2850] ) )
{
hndTank.SetOrigin( Vector( -3423, 3480, 368.1 ) );
}
break;
}
case "c5m5_bridge":
{
// move all bridge tank spawns a bit further down the bridge to discourage rushing
if( CheckToWarpTank( hndTank, [-1450, 5955, -100, 6705] ) )
{
hndTank.SetOrigin( Vector( 830, 6328, 792 ) );
}
else if( CheckToWarpTank( hndTank, [-100, 5955, 2000, 6705] ) )
{
hndTank.SetOrigin( Vector( 2720, 6338, 792 ));
}
else if( CheckToWarpTank( hndTank, [2000, 5955, 4740, 6705] ) )
{
hndTank.SetOrigin( Vector( 4285, 6325, 792 ) );
}
break;
}
case "c12m4_barn":
{
// move tank spawn from hillside before event area to top of trains (~60% boss flow)
if( CheckToWarpTank( hndTank, [10535, -5508, 11360, -4625] ) )
{
hndTank.SetOrigin( Vector( 10492, -4633, 57.9 ) );
}
break;
}
case "c13m4_cutthroatcreek":
{
// move tank spawns back a bit to discourage rushing
if( CheckToWarpTank( hndTank, [-1910, -2100, -470, -850] ) )
{
hndTank.SetOrigin( Vector( -488, -516, -374.9 ) );
}
else if( CheckToWarpTank( hndTank, [-960, -850, -195, 50] ) )
{
hndTank.SetOrigin( Vector( -672, 362, -381.8 ) );
}
break;
}
default:
break;
g_FixScriptTable["DoTankWarp"]( hndTank );
}
}
}
Expand Down

0 comments on commit ca4fc6e

Please sign in to comment.