Skip to content

Commit

Permalink
Add nav_compare and talker_debug with instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsuey committed Oct 2, 2021
1 parent ac8832a commit 6e46f4b
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# nav_compare.nut

Use to load two revisions separately for comparison.

- First load map with original nav file
- Do script_execute nav_compare
- Then nav_load the new nav file
- Do script_execute nav_compare again

Note that DebugDrawFilled may not draw areas outside of your view.

Be sure to look from far above the map when running script the second time.

# talker_debug.vpk

Talker Scripts: General and Addon guide

https://steamcommunity.com/sharedfiles/filedetails/?id=2310605204

This is a Debug Mutation that prints the concept that is fired and in the table below it, all the usable criterias with each having the exact value upon the frame they were fired. This is best done in Single Player so that you can actually freeze the game to check. Keep in mind that many concepts have been blocked because they tend to flood the console.

# Other

Entities for Custom RocketDude Map Creation

https://steamcommunity.com/sharedfiles/filedetails/?id=2254092403
74 changes: 74 additions & 0 deletions tools/nav_compare.nut
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
allAreas <- {};
newAreas <- {};
NavMesh.GetAllAreas(allAreas);
DebugDrawClear();

foreach(area in allAreas) {
newAreas[area.GetID()] <- area;
}

g_ModeScript.DeepPrintTable(allAreas);

//DebugDrawBoxAngles(Vector origin, Vector min, Vector max, QAngle direction, Vector rgb, int alpha, float duration)

function DebugDrawRectangle(a, b, color, alpha, duration) {
local center = (a + b) * 0.5;
DebugDrawBoxAngles(center, center - a - Vector(5,5,0), center - b + Vector(5,5,0) , QAngle(0,0,0), color, alpha, duration)
}

if(!("storedAreas" in DirectorScript)) {
DirectorScript.storedAreas <- {};

foreach(area in allAreas) {
DirectorScript.storedAreas[area.GetID()] <- {
origin = area.GetCenter(),
nw = area.GetCorner(0),
ne = area.GetCorner(1),
se = area.GetCorner(2),
sw = area.GetCorner(3),
xSize = area.GetSizeX(),
ySize = area.GetSizeY(),
spawnAttr = area.GetSpawnAttributes(),
attr = area.GetAttributes()
}
}
}
else {
foreach(area in DirectorScript.storedAreas) {
local r = 0, g = 0, b = 0;
local rayStart = area.origin + Vector(0,0,50);
local rayEnd = rayStart - Vector(0,0,100);
local newArea = NavMesh.FindNavAreaAlongRay(rayStart, rayEnd, null);

if(newArea) {
if(newArea.GetSizeX() != area.xSize || newArea.GetSizeY() != area.ySize) {
r = 255;
}
if((newArea.GetSpawnAttributes() ^ area.spawnAttr) & ~117587968) {
g = 255;
}
if((newArea.GetAttributes() ^ area.attr) & ~(-134217728)) {
b = 255;
}

if(r||g||b) {
DebugDrawRectangle(area.nw, area.se, Vector(r,g,b), 128, 120);
//newArea.DebugDrawFilled(r, g, b, 150, 999999, true);
}
newAreas.rawdelete(newArea.GetID());
}
else {
DebugDrawRectangle(area.nw, area.se, Vector(0,0,0), 128, 120);
}

}
foreach(area in newAreas) {
area.DebugDrawFilled(255, 255, 255, 128, 120, true);
}
}

function resetStored() {
DirectorScript.rawdelete("storedAreas");
g_ModeScript.rawdelete("allAreas");
g_ModeScript.rawdelete("newAreas");
}
Binary file added tools/talker_debug.vpk
Binary file not shown.
21 changes: 21 additions & 0 deletions tools/talker_debug/addoninfo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// The addoninfo.txt file is a metadata file that is required by all Source Engine Add-ons.

"AddonInfo"
{
addonSteamAppID 550 // 500 is the app ID for Left 4 Dead, 550 for Left 4 Dead 2
addontitle "TalkerDebug" // Add-on title that shows up in Add-ons list. ~20 chars max
addonversion 1.0 // Add-on version.
addontagline "A mutation to debug talker related instances." // Add-on tagline or wrap-up- a short description. ~100 chars max
addonauthor "Xanaguy" // Name/alias of the author
addonSteamGroupName "" // (Optional) Steam group related to the add-on. We use this to construct a URL to the group page.
addonauthorSteamID "" // (Optional) Steam ID of author. We use this to construct a URL to the author's page.
addonURL0 "" //An html home page for the add-on that includes a download link.

// short description that appears in the Add-on list screen...
addonDescription "Just like it is in the actual Xbox 360 version of L4D2... Except, no infinite melee range :c"

// Authors can add localized descriptions here. (Not yet supported)
//addonDescription_FR ""

addonContent_Script 1 // Has Scripts
}
18 changes: 18 additions & 0 deletions tools/talker_debug/modes/talkertest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"talkertest"
{
"base" "coop"
"maxplayers" "4"

"DisplayTitle" "Talker Test"
"ShortDescription" "A debugging mode for talker scripts"
"Description" ""

"Image" "maps/any"
"Author" "Rayman1103"

convar
{

}
}

18 changes: 18 additions & 0 deletions tools/talker_debug/modes/talkertestsurvival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"talkertestsurvival"
{
"base" "survival"
"maxplayers" "4"

"DisplayTitle" "Talker Test (Survival)"
"ShortDescription" "A debugging mode for talker scripts"
"Description" ""

"Image" "maps/any"
"Author" "Rayman1103"

convar
{

}
}

19 changes: 19 additions & 0 deletions tools/talker_debug/scripts/vscripts/talkertest.nut
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//-----------------------------------------------------
Msg("Activating test.nut file\n");

// Include the VScript Library
IncludeScript("VSlib/VSLib.nut");

function Notifications::OnConcept::TestConcept( query )
{
// Information
// query is the table of data about the concept that just fired

// If the concept is "TLK_REMARK" or "TLK_IDLE" just return so it isn't too spammy
if ( query.concept == "TLK_REMARK" || query.concept == "TLK_IDLE" )
return;

// General print of the concept name in-console
printl("Concept: " + query.concept);
Utils.PrintTable(query);
}
19 changes: 19 additions & 0 deletions tools/talker_debug/scripts/vscripts/talkertestsurvival.nut
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//-----------------------------------------------------
Msg("Activating test.nut file\n");

// Include the VScript Library
IncludeScript("VSlib/VSLib.nut");

function Notifications::OnConcept::TestConcept( query )
{
// Information
// query is the table of data about the concept that just fired

// If the concept is "TLK_REMARK" or "TLK_IDLE" just return so it isn't too spammy
if ( query.concept == "TLK_REMARK" || query.concept == "TLK_IDLE" )
return;

// General print of the concept name in-console
printl("Concept: " + query.concept);
Utils.PrintTable(query);
}

0 comments on commit 6e46f4b

Please sign in to comment.