Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vscript godspots only active when all players stand on it #505

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion root/scripts/vscripts/community/functions.nut
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,46 @@ function make_navblock ( user_strTargetname,
}
}

function make_trig_godspot(godspot_area_origin, disconnect_areas_origins, name="_dynamic_godspot") {
local area_origins = [godspot_area_origin];
area_origins.extend(disconnect_areas_origins);
local areas = [];
foreach(origin in area_origins) {
local area = NavMesh.GetNearestNavArea(origin, 16, true, true);
if(area == null) {
printl("Godspot couldn't be created because area at " + origin + " wasn't found");
return;
}
areas.append(area);
}
local godspot = areas[0];
local disconnect = areas.slice(1);

local trigger = SpawnEntityFromTable("script_trigger_multiple", {
targetname = g_UpdateName + name,
origin = godspot.GetCenter() + Vector(0,0,30),
extent = Vector(5 + godspot.GetSizeX() / 2, 5 + godspot.GetSizeY() / 2, 30),
entireteam = 2,
allowincap = 1,
spawnflags = 1,
OnEntireTeamStartTouch = "!self,CallScriptFunction,CreateGodspot",
OnEntireTeamEndTouch = "!self,CallScriptFunction,DestroyGodspot"
});
trigger.ValidateScriptScope();
local scope = trigger.GetScriptScope();
scope.CreateGodspot <- function() {
foreach(area in disconnect) {
area.Disconnect(godspot);
}
}
scope.DestroyGodspot <- function() {
foreach(area in disconnect) {
area.ConnectTo(godspot, -1);
}
}
DoEntFire("!self", "CallScriptFunction", "DestroyGodspot", 0, null, trigger);
}

/*****************************************************************************
** MAKE_TRIGPUSH
**
Expand Down Expand Up @@ -1801,4 +1841,4 @@ function devchap( mode )
printl( "Community Map Fixes: Restart with Launch Option -dev to reveal verbose entity debug dumps." );
printl( "Community Demo Mode: Run \"script_execute community/z_developer_showupdate\" >> \"script ShowUpdate()\"." );
}
}
}
17 changes: 7 additions & 10 deletions root/scripts/vscripts/community/maps/c10m5_houseboat.nut
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,12 @@ function DoRoundFixes()
if ( g_BaseMode == "coop" || g_BaseMode == "realism" )
{
// Get nav tiles by position because IDS can change if edited later on
local navMain = NavMesh.GetNearestNavArea(Vector(1612.500000, -3662.500000, 26.890617), 16, true, true)
local navConnection1 = NavMesh.GetNearestNavArea(Vector(1750.000000, -3655.000000, -101.112030), 16, true, true)
local navConnection2 = NavMesh.GetNearestNavArea(Vector(1625.000000, -3527.500000, -62.369400), 16, true, true)
local navConnection3 = NavMesh.GetNearestNavArea(Vector(1537.500000, -3650.000000, -93.773209), 16, true, true)
local navConnection4 = NavMesh.GetNearestNavArea(Vector(1600.000000, -3735.000000, -123.070557), 16, true, true)
navConnection1.Disconnect(navMain);
navConnection2.Disconnect(navMain);
navConnection3.Disconnect(navMain);
navConnection4.Disconnect(navMain);
make_trig_godspot( Vector(1623, -3652, 38), [
Vector(1750, -3655, -101),
Vector(1625, -3527, -62),
Vector(1537, -3650, -94),
Vector(1600, -3735, -123)
]);
}
if ( g_BaseMode == "versus" )
{
Expand Down Expand Up @@ -175,4 +172,4 @@ function DoMapSpawnFixes()
patch_nav_obscured( "5298 328 153" );
patch_nav_obscured( "5020 664 190" );
}
}
}
10 changes: 5 additions & 5 deletions root/scripts/vscripts/community/maps/c2m5_concert.nut
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ function DoRoundFixes()

make_prop( "dynamic", "_helistuck_caseunique", "models/props_fairgrounds/bass_case.mdl", "-3466 2899 -106", "-15 1 89.73", "shadow_yes" );
make_prop( "dynamic", "_helistuck_casecaster", "models/props_fairgrounds/anvil_case_casters_64.mdl", "-3488 2870 -128", "0 180 0", "shadow_yes" );

// Get nav tiles by position because IDS can change if edited later on
local navConnection = NavMesh.GetNearestNavArea(Vector(-3400.000000, 3400.000000, -165.604355), 16, true, true);
local navMain = NavMesh.GetNearestNavArea(Vector(-3396.963867, 3449.818848, -112.538177), 16, true, true);
navConnection.Disconnect(navMain);
make_trig_godspot( Vector(-3397, 3450, -112), [
Vector(-3400, 3400, -166)
]);
}
if ( g_BaseMode == "versus" )
{
Expand Down Expand Up @@ -156,4 +156,4 @@ function DoRoundFixes()
kill_entity( Entities.FindByClassnameNearest( "weapon_pain_pills_spawn", Vector( -2534, 3449, -105 ), 6 ) );
kill_entity( Entities.FindByClassnameNearest( "weapon_pain_pills_spawn", Vector( -2526, 3449, -105 ), 6 ) );
}
}
}
11 changes: 5 additions & 6 deletions root/scripts/vscripts/community/maps/c3m4_plantation.nut
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ function DoRoundFixes()
if ( g_BaseMode == "coop" || g_BaseMode == "realism" )
{
// Get nav tiles by position because IDS can change if edited later on
local navMain = NavMesh.GetNearestNavArea(Vector(2377.853516, 161.838699, 194.000000), 16, true, true);
local navConnection1 = NavMesh.GetNearestNavArea(Vector(2300.000000, 162.500000, 131.307587), 16, true, true);
local navConnection2 = NavMesh.GetNearestNavArea(Vector(2337.500000, 120.000000, 232.031250), 16, true, true);
navConnection1.Disconnect(navMain);
navConnection2.Disconnect(navMain);
make_trig_godspot( Vector(2378, 162, 194), [
Vector(2300, 162, 131),
Vector(2337, 120, 232)
]);
}
if ( g_BaseMode == "versus" )
{
Expand Down Expand Up @@ -83,4 +82,4 @@ function DoRoundFixes()
make_ladder( "_ladder_shelfpileleft_cloned_minigunleft", "1948 466 296", "-721 -1018 48" );
make_ladder( "_ladder_shelfpileright_cloned_minigunright", "1376 466 296", "2598 515 48", "0 -180 0", "0 -1 0" );
}
}
}
8 changes: 4 additions & 4 deletions root/scripts/vscripts/community/maps/c4m5_milltown_escape.nut
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ function DoRoundFixes()
if ( g_BaseMode == "coop" || g_BaseMode == "realism" )
{
// Get nav tiles by position because IDS can change if edited later on
local navMain = NavMesh.GetNearestNavArea(Vector(-7188.924805, 7411.930664, 85.820847), 16, true, true);
local navConnection = NavMesh.GetNearestNavArea(Vector(-7145.000000, 7415.000000, 116.481155), 16, true, true);
navConnection.Disconnect(navMain);
make_trig_godspot(Vector(-7189, 7412, 86), [
Vector(-7145, 7415, 116)
]);
}
if ( HasPlayerControlledZombies() )
{
Expand Down Expand Up @@ -77,4 +77,4 @@ function DoRoundFixes()
function DoMapSpawnFixes()
{
make_decal( "decals/rollermine_crater", "-5671 6579 225" );
}
}
17 changes: 6 additions & 11 deletions root/scripts/vscripts/community/maps/c8m5_rooftop.nut
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,11 @@ function DoRoundFixes()
make_ladder( "_ladder_saferoomlulz_cloned_rooftopmain", "5924 8561.1 6018", "13896 2362 -447", "0 90 0", "0 1 0", 0 );

// Get nav tiles by position because IDS can change if edited later on
local navMain1 = NavMesh.GetNearestNavArea(Vector(5575.740234, 8499.918945, 6097.730957), 16, true, true);
local navMain2 = NavMesh.GetNearestNavArea(Vector(5575.740234, 8450.000000, 6097.730957), 16, true, true);
local navConnection1 = NavMesh.GetNearestNavArea(Vector(5518.500000, 8468.500000, 6000.031250), 16, true, true);
local navConnection2 = NavMesh.GetNearestNavArea(Vector(5627.500000, 8495.000000, 6153.142578), 16, true, true);
local navConnection3 = NavMesh.GetNearestNavArea(Vector(5627.500000, 8442.500000, 6153.142578), 16, true, true);
local navConnection4 = NavMesh.GetNearestNavArea(Vector(5575.740234, 8412.500000, 6097.730957), 16, true, true);
navConnection1.Disconnect(navMain1);
navConnection2.Disconnect(navMain1);
navConnection3.Disconnect(navMain2);
navConnection4.Disconnect(navMain2);
make_trig_godspot( Vector(5576, 8500, 6097), [
Vector(5518, 8468, 6000),
Vector(5627, 8495, 6153),
Vector(5576, 8450, 6098)
]);
}
if ( g_BaseMode == "scavenge" )
{
Expand Down Expand Up @@ -115,4 +110,4 @@ function DoMapSpawnFixes()
make_decal( "decals/debris_concrete001a", "7283 8926 6088" );
make_decal( "decals/prodconcrete04", "5942 9424 5983" );
make_decal( "decals/infstains", "6188 7616 5967" );
}
}
8 changes: 4 additions & 4 deletions root/scripts/vscripts/community/maps/c9m2_lots.nut
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ function DoRoundFixes()
if ( g_BaseMode == "coop" || g_BaseMode == "realism" )
{
// Get nav tiles by position because IDS can change if edited later on
local navMain = NavMesh.GetNearestNavArea(Vector(4766.412109, 7269.738281, 96.031250), 16, true, true)
local navConnection = NavMesh.GetNearestNavArea(Vector(4803.833984, 7260.107422, 128.313324), 16, true, true)
navConnection.Disconnect(navMain);
make_trig_godspot( Vector(4766, 7270, 96), [
Vector(4804, 7260, 128)
]);
}
if ( HasPlayerControlledZombies() )
{
Expand Down Expand Up @@ -99,4 +99,4 @@ function DoRoundFixes()

make_clip( "_tankstuck_startback", "SI Players", 1, "-120 -900 0", "120 900 1370", "-835 -110 -223" );
}
}
}
6 changes: 4 additions & 2 deletions root/scripts/vscripts/community/z_developer_showupdate.nut
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ function ShowUpdate( showGroup = "community" )
case "func_brush":
case "func_nav_blocker":
case "trigger_multiple":
case "script_trigger_multiple":
case "trigger_once":
case "trigger_push":
case "trigger_hurt":
Expand Down Expand Up @@ -490,6 +491,7 @@ function DebugRedraw()
// Restore Keyvalues from several "trigger_" entities to draw visible boxes for them.

case "trigger_multiple":
case "script_trigger_multiple":
case "trigger_once":
case "trigger_push":
case "trigger_hurt":
Expand Down Expand Up @@ -978,7 +980,7 @@ function FilterHelp()
printl( "2\tShows all nav blockers (including those with a brush model)" );

printl( "\n\"trigger\"" );
printl( "Sets filters for trigger entities: trigger_multiple, trigger_once, trigger_push, trigger_hurt,trigger_hurt_ghost, trigger_auto_crouch, trigger_playermovement, trigger_teleport" );
printl( "Sets filters for trigger entities: trigger_multiple, script_trigger_multiple, trigger_once, trigger_push, trigger_hurt,trigger_hurt_ghost, trigger_auto_crouch, trigger_playermovement, trigger_teleport" );
printl( "0\tHide all triggers" );
printl( "1\tShows all triggers created via scripting (without a brush model) (default)" );
printl( "2\tShows all triggers (including those with a brush model)" );
Expand All @@ -1002,4 +1004,4 @@ function FilterHelp()
printl( "1\tShows all text (default)" );
printl( "2\tShows text only for named entities" );
printl( "3\tShows text only if there is a direct line of sight with the entity" );
}
}