diff options
Diffstat (limited to 'Northstar.Custom')
-rw-r--r-- | Northstar.Custom/keyvalues/playlists_v2.txt | 81 | ||||
-rw-r--r-- | Northstar.Custom/mod.json | 13 | ||||
-rw-r--r-- | Northstar.Custom/mod/models/weapons/shotgun_doublebarrel/ptpov_shotgun_doublebarrel.mdl | bin | 1268987 -> 1277105 bytes | |||
-rw-r--r-- | Northstar.Custom/mod/models/weapons/shotgun_doublebarrel/w_shotgun_doublebarrel.mdl | bin | 743828 -> 924194 bytes | |||
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/_testing.nut | 302 | ||||
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/earn_meter/cl_earn_meter.gnut | 6 | ||||
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut | 11 | ||||
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/sh_damage_types.nut | 4 | ||||
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/weapons/_arc_cannon.nut | 46 | ||||
-rw-r--r-- | Northstar.Custom/paks/mp_weapon_shotgun_doublebarrel.rpak | bin | 264566 -> 197556 bytes | |||
-rw-r--r-- | Northstar.Custom/paks/mp_weapon_shotgun_doublebarrel.starpak | bin | 16539736 -> 9605416 bytes |
11 files changed, 386 insertions, 77 deletions
diff --git a/Northstar.Custom/keyvalues/playlists_v2.txt b/Northstar.Custom/keyvalues/playlists_v2.txt index c22e2174..d60a24e5 100644 --- a/Northstar.Custom/keyvalues/playlists_v2.txt +++ b/Northstar.Custom/keyvalues/playlists_v2.txt @@ -395,7 +395,6 @@ playlists mp_colony02 1 mp_glitch 1 mp_lf_stacks 1 - mp_lf_stacks 1 mp_lf_deck 1 mp_lf_meadow 1 mp_lf_traffic 1 @@ -449,7 +448,6 @@ playlists mp_colony02 1 mp_glitch 1 mp_lf_stacks 1 - mp_lf_stacks 1 mp_lf_deck 1 mp_lf_meadow 1 mp_lf_traffic 1 @@ -498,7 +496,6 @@ playlists mp_colony02 1 mp_glitch 1 mp_lf_stacks 1 - mp_lf_stacks 1 mp_lf_deck 1 mp_lf_meadow 1 mp_lf_traffic 1 @@ -626,35 +623,27 @@ playlists { maps { - mp_complex3 1 - mp_drydock 1 - mp_glitch 1 - mp_homestead 2 - mp_eden 1 mp_forwardbase_kodai 1 - mp_black_water_canal 1 - mp_glitch 1 - mp_angel_city 1 - mp_colony02 1 - mp_relic02 1 mp_grave 1 mp_homestead 1 - mp_drydock 1 - mp_glitch 1 mp_thaw 1 - mp_eden 2 mp_black_water_canal 1 - mp_glitch 1 - mp_relic02 1 - mp_wargames 1 - mp_rise 1 + mp_eden 1 + mp_drydock 1 mp_crashsite3 1 + mp_complex3 1 + mp_angel_city 1 + mp_colony02 1 + mp_glitch 1 mp_lf_stacks 1 mp_lf_deck 1 mp_lf_meadow 1 mp_lf_traffic 1 mp_lf_township 1 mp_lf_uma 1 + mp_relic02 1 + mp_wargames 1 + mp_rise 1 } } } @@ -681,35 +670,27 @@ playlists { maps { - mp_complex3 1 - mp_drydock 1 - mp_glitch 1 - mp_homestead 2 - mp_eden 1 mp_forwardbase_kodai 1 - mp_black_water_canal 1 - mp_glitch 1 - mp_angel_city 1 - mp_colony02 1 - mp_relic02 1 mp_grave 1 mp_homestead 1 - mp_drydock 1 - mp_glitch 1 mp_thaw 1 - mp_eden 2 mp_black_water_canal 1 - mp_glitch 1 - mp_relic02 1 - mp_wargames 1 - mp_rise 1 + mp_eden 1 + mp_drydock 1 mp_crashsite3 1 + mp_complex3 1 + mp_angel_city 1 + mp_colony02 1 + mp_glitch 1 mp_lf_stacks 1 mp_lf_deck 1 mp_lf_meadow 1 mp_lf_traffic 1 mp_lf_township 1 mp_lf_uma 1 + mp_relic02 1 + mp_wargames 1 + mp_rise 1 } } } @@ -747,7 +728,6 @@ playlists mp_colony02 1 mp_glitch 1 mp_lf_stacks 1 - mp_lf_stacks 1 mp_lf_deck 1 mp_lf_meadow 1 mp_lf_traffic 1 @@ -795,7 +775,6 @@ playlists mp_colony02 1 mp_glitch 1 mp_lf_stacks 1 - mp_lf_stacks 1 mp_lf_deck 1 mp_lf_meadow 1 mp_lf_traffic 1 @@ -829,18 +808,18 @@ playlists { maps { - mp_forwardbase_kodai 1 - mp_grave 1 - mp_homestead 1 - mp_thaw 1 - mp_black_water_canal 1 - mp_eden 1 - mp_drydock 1 - mp_crashsite3 1 - mp_complex3 1 - mp_angel_city 1 - mp_colony02 1 - mp_glitch 1 + mp_forwardbase_kodai 1 + mp_grave 1 + mp_homestead 1 + mp_thaw 1 + mp_black_water_canal 1 + mp_eden 1 + mp_drydock 1 + mp_crashsite3 1 + mp_complex3 1 + mp_angel_city 1 + mp_colony02 1 + mp_glitch 1 mp_relic02 1 mp_wargames 1 mp_rise 1 diff --git a/Northstar.Custom/mod.json b/Northstar.Custom/mod.json index 399311e4..69432f49 100644 --- a/Northstar.Custom/mod.json +++ b/Northstar.Custom/mod.json @@ -441,6 +441,19 @@ "RunOn": "CLIENT || SERVER || UI" }, { + "Path": "_testing.nut", + "RunOn": "CLIENT || SERVER || UI", + "ClientCallback": { + "Before": "Testing_Init" + }, + "ServerCallback": { + "Before": "Testing_Init" + }, + "UICallback": { + "Before": "Testing_Init" + } + }, + { "Path": "_event_models.gnut", "RunOn": "SERVER && LOBBY", "ServerCallback": { diff --git a/Northstar.Custom/mod/models/weapons/shotgun_doublebarrel/ptpov_shotgun_doublebarrel.mdl b/Northstar.Custom/mod/models/weapons/shotgun_doublebarrel/ptpov_shotgun_doublebarrel.mdl Binary files differindex 2fcc3439..82b58bec 100644 --- a/Northstar.Custom/mod/models/weapons/shotgun_doublebarrel/ptpov_shotgun_doublebarrel.mdl +++ b/Northstar.Custom/mod/models/weapons/shotgun_doublebarrel/ptpov_shotgun_doublebarrel.mdl diff --git a/Northstar.Custom/mod/models/weapons/shotgun_doublebarrel/w_shotgun_doublebarrel.mdl b/Northstar.Custom/mod/models/weapons/shotgun_doublebarrel/w_shotgun_doublebarrel.mdl Binary files differindex 137d985d..9e660374 100644 --- a/Northstar.Custom/mod/models/weapons/shotgun_doublebarrel/w_shotgun_doublebarrel.mdl +++ b/Northstar.Custom/mod/models/weapons/shotgun_doublebarrel/w_shotgun_doublebarrel.mdl diff --git a/Northstar.Custom/mod/scripts/vscripts/_testing.nut b/Northstar.Custom/mod/scripts/vscripts/_testing.nut new file mode 100644 index 00000000..15bcf18b --- /dev/null +++ b/Northstar.Custom/mod/scripts/vscripts/_testing.nut @@ -0,0 +1,302 @@ +global function Testing_Init +global function RunAllTests +global function RunAllTests_SaveToFile +global function RunTestsByCategory +global function RunTestByCategoryAndName + +global function AddTest + +struct TestInfo +{ + string testName + var functionref() callback + // whether the test completed successfully + // if this is true, actualResult is valid + bool completed + // var not string because then i can just set it to an exception + // which print can then handle + var error + // whether the test is considered successful + var expectedResult + var actualResult + bool passed +} + +struct { + table< string, array< TestInfo > > tests = {} +} file + +void function Testing_Init() +{ + // tests for the testing functions :) + //AddTest( "Example Tests", "example succeeding test", ExampleTest_ReturnsTrue, true ) + //AddTest( "Example Tests", "example failing test", ExampleTest_ReturnsFalse, true ) + //AddTest( "Example Tests", "example erroring test", ExampleTest_ThrowsError, true ) + //AddTest( "Example Tests", "example test with args", var function() { + // return ExampleTest_HasArgs_ReturnsNonVar( 2, 3 ) + //}, 6 ) +} + +int function ExampleTest_HasArgs_ReturnsNonVar( int first, int second ) +{ + return first * second +} + +var function ExampleTest_ReturnsFalse() +{ + return false +} + +var function ExampleTest_ReturnsTrue() +{ + return true +} + +var function ExampleTest_ThrowsError() +{ + throw "Example exception" + return null +} + +void function RunAllTests_SaveToFile() +{ + RunAllTests() + + #if UI + string fileName = "ns-unit-tests-UI.json" + #elseif CLIENT + string fileName = "ns-unit-tests-CLIENT.json" + #elseif SERVER + string fileName = "ns-unit-tests-SERVER.json" + #endif + + // cant encode structs so have to reconstruct a table manually from the structs + table out = {} + foreach ( category, tests in file.tests ) + { + array categoryResults = [] + foreach ( test in tests ) + { + table testTable = {} + testTable[ "name" ] <- test.testName + testTable[ "completed" ] <- test.completed + testTable[ "passed" ] <- test.passed + if ( !test.completed ) + testTable[ "error" ] <- test.error + else if ( !test.passed ) + { + testTable[ "expectedResult" ] <- test.expectedResult + testTable[ "actualResult" ] <- test.actualResult + } + + categoryResults.append( testTable ) + } + out[ category ] <- categoryResults + } + + NSSaveJSONFile( fileName, out ) +} + +void function RunAllTests() +{ + printt( "Running all tests!" ) + + foreach ( category, categoryTests in file.tests ) + { + foreach ( test in categoryTests ) + { + RunTest( test ) + } + } + + PrintAllTestResults() +} + +void function RunTestsByCategory( string category ) +{ + if ( !( category in file.tests ) ) + { + printt( format( "Category '%s' has no tests registered", category ) ) + return + } + + foreach ( categoryTest in file.tests[ category ] ) + { + RunTest( categoryTest ) + } +} + +void function RunTestByCategoryAndName( string category, string testName ) +{ + // find test + if ( !( category in file.tests ) ) + { + printt( format( "Category '%s' has no tests registered", category ) ) + return + } + + TestInfo ornull foundTest = null + foreach ( categoryTest in file.tests[ category ] ) + { + if ( categoryTest.testName == testName ) + { + foundTest = categoryTest + break + } + } + + if ( !foundTest ) + { + printt( format( "Category '%s' does not contain a test with name '%s'", category, testName ) ) + return + } + + expect TestInfo( foundTest ) + + printt( "Running test!" ) + // run test + RunTest( foundTest ) + // print result + PrintTestResult( foundTest ) +} + +void function RunTest( TestInfo test ) +{ + test.completed = false + test.passed = false + test.actualResult = null + test.error = "" + + try + { + test.actualResult = test.callback() + test.completed = true + test.passed = test.actualResult == test.expectedResult + } + catch ( exception ) + { + test.completed = false + test.error = exception + } +} + +void function PrintAllTestResults() +{ + int totalSucceeded = 0 + int totalFailed = 0 + int totalErrored = 0 + + foreach ( category, categoryTests in file.tests ) + { + int categorySucceeded = 0 + int categoryFailed = 0 + int categoryErrored = 0 + + printt( format( "Results for category: '%s'", category ) ) + foreach ( test in categoryTests ) + { + if ( test.completed ) + { + if ( test.passed ) + { + printt( "\t", test.testName, "- Passed!" ) + categorySucceeded++ + } + else + { + printt( "\t", test.testName, "- Failed!" ) + printt( "\t\tExpected:", test.expectedResult ) + printt( "\t\tActual: ", test.actualResult ) + categoryFailed++ + } + } + else + { + printt( "\t", test.testName, "- Errored!" ) + printt( "\t\tError:", test.error ) + categoryErrored++ + } + } + + printt( "Succeeded:", categorySucceeded, "Failed:", categoryFailed, "Errored:", categoryErrored ) + + totalSucceeded += categorySucceeded + totalFailed += categoryFailed + totalErrored += categoryErrored + } + + printt( "TOTAL SUCCEEDED:", totalSucceeded, "TOTAL FAILED:", totalFailed, "TOTAL ERRORED:", totalErrored ) +} + +void function PrintCategoryResults( string category ) +{ + int categorySucceeded = 0 + int categoryFailed = 0 + int categoryErrored = 0 + + printt( format( "Results for category: '%s'", category ) ) + foreach ( test in file.tests[ category ] ) + { + if ( test.completed ) + { + if ( test.passed ) + { + printt( "\t", test.testName, "- Passed!" ) + categorySucceeded++ + } + else + { + printt( "\t", test.testName, "- Failed!" ) + printt( "\t\tExpected:", test.expectedResult ) + printt( "\t\tActual: ", test.actualResult ) + categoryFailed++ + } + } + else + { + printt( "\t", test.testName, "- Errored!" ) + printt( "\t\tError:", test.error ) + categoryErrored++ + } + } + + printt( "Succeeded:", categorySucceeded, "Failed:", categoryFailed, "Errored:", categoryErrored ) +} + +void function PrintTestResult( TestInfo test ) +{ + string resultString = test.testName + + if ( test.completed ) + { + if ( test.passed ) + resultString += " - Passed!" + else + { + resultString += " - Failed!" + resultString += "\n\tExpected: " + test.expectedResult + resultString += "\n\tActual: " + test.actualResult + } + } + else + { + resultString += " - Not completed!" + resultString += "\n\tError: " + test.error + } + + printt( resultString ) +} + +void function AddTest( string testCategory, string testName, var functionref() testFunc, var expectedResult ) +{ + TestInfo newTest + newTest.testName = testName + newTest.callback = testFunc + newTest.expectedResult = expectedResult + + // create the test category if it doesn't exist + if ( !( testCategory in file.tests ) ) + file.tests[ testCategory ] <- [ newTest ] + else + file.tests[ testCategory ].append( newTest ) +} diff --git a/Northstar.Custom/mod/scripts/vscripts/earn_meter/cl_earn_meter.gnut b/Northstar.Custom/mod/scripts/vscripts/earn_meter/cl_earn_meter.gnut index 16908362..3971d2be 100644 --- a/Northstar.Custom/mod/scripts/vscripts/earn_meter/cl_earn_meter.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/earn_meter/cl_earn_meter.gnut @@ -335,7 +335,11 @@ void function EarnMeter_Update() break entity soul = player.GetTitanSoul() - entity core = player.GetOffhandWeapons()[3] + entity core = player.GetOffhandWeapon( OFFHAND_EQUIPMENT ) + + if ( !IsValid( core ) ) + break + string coreName = core.GetWeaponClassName() array<string> coreMods = core.GetMods() diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut index fef4c8b6..02f0799a 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut @@ -45,7 +45,16 @@ void function SelectFirstInfectedDelayed() wait 10.0 + RandomFloat( 5.0 )
array<entity> players = GetPlayerArray()
- entity infected = players[ RandomInt( players.len() ) ]
+
+ // End game if server empty on selecting infected
+ if ( !players.len() )
+ {
+ printt( "Couldn't select first infected: player array was empty" )
+ SetWinner( INFECTION_TEAM_SURVIVOR )
+ return
+ }
+
+ entity infected = players.getrandom()
InfectPlayer( infected )
RespawnInfected( infected )
diff --git a/Northstar.Custom/mod/scripts/vscripts/sh_damage_types.nut b/Northstar.Custom/mod/scripts/vscripts/sh_damage_types.nut index 4987ee01..bae0116e 100644 --- a/Northstar.Custom/mod/scripts/vscripts/sh_damage_types.nut +++ b/Northstar.Custom/mod/scripts/vscripts/sh_damage_types.nut @@ -727,7 +727,7 @@ bool function RegisterWeaponDamageSourceInternal( int id, string newVal, string damageSourceID[ newVal ] <- id file.damageSourceIDToString[ id ] <- newVal file.damageSourceIDToName[ id ] <- stringVal - file.customDamageSourceIDList.extend( [ id.tostring(), newVal, StringReplace( stringVal, " ", MESSAGE_SPACE_PADDING ) ] ) + file.customDamageSourceIDList.extend( [ id.tostring(), newVal, StringReplace( stringVal, " ", MESSAGE_SPACE_PADDING, true ) ] ) return true } @@ -773,6 +773,6 @@ void function ReceiveNewDamageSourceIDs( array<string> args ) { // IDs are inserted to the custom list in triplets, so we can trust these indices exist and the loop will end properly for ( int i = 0; i < args.len(); i += 3 ) - RegisterWeaponDamageSourceInternal( args[ i ].tointeger(), args[ i + 1 ], StringReplace( args[ i + 2 ], MESSAGE_SPACE_PADDING, " " ) ) + RegisterWeaponDamageSourceInternal( args[ i ].tointeger(), args[ i + 1 ], StringReplace( args[ i + 2 ], MESSAGE_SPACE_PADDING, " ", true ) ) } #endif diff --git a/Northstar.Custom/mod/scripts/vscripts/weapons/_arc_cannon.nut b/Northstar.Custom/mod/scripts/vscripts/weapons/_arc_cannon.nut index defb1a56..e198f726 100644 --- a/Northstar.Custom/mod/scripts/vscripts/weapons/_arc_cannon.nut +++ b/Northstar.Custom/mod/scripts/vscripts/weapons/_arc_cannon.nut @@ -85,28 +85,30 @@ global const ARC_CANNON_BEAM_EFFECT_MOD = $"wpn_arc_cannon_beam_mod" global const ARC_CANNON_FX_TABLE = "exp_arc_cannon" global const ArcCannonTargetClassnames = { - [ "npc_drone" ] = true, - [ "npc_dropship" ] = true, - [ "npc_marvin" ] = true, - [ "npc_prowler" ] = true, - [ "npc_soldier" ] = true, - [ "npc_soldier_heavy" ] = true, - [ "npc_soldier_shield" ] = true, - [ "npc_spectre" ] = true, - [ "npc_stalker" ] = true, - [ "npc_super_spectre" ] = true, - [ "npc_titan" ] = true, - [ "npc_turret_floor" ] = true, - [ "npc_turret_mega" ] = true, - [ "npc_turret_sentry" ] = true, - [ "npc_frag_drone" ] = true, - [ "player" ] = true, - [ "prop_dynamic" ] = true, - [ "prop_script" ] = true, - [ "grenade_frag" ] = true, - [ "rpg_missile" ] = true, - [ "script_mover" ] = true, - [ "turret" ] = true, + [ "npc_drone" ] = true, + [ "npc_dropship" ] = true, + [ "npc_gunship" ] = true, + [ "npc_marvin" ] = true, + [ "npc_prowler" ] = true, + [ "npc_soldier" ] = true, + [ "npc_soldier_heavy" ] = true, + [ "npc_soldier_shield" ] = true, + [ "npc_pilot_elite" ] = true, + [ "npc_spectre" ] = true, + [ "npc_stalker" ] = true, + [ "npc_super_spectre" ] = true, + [ "npc_titan" ] = true, + [ "npc_turret_floor" ] = true, + [ "npc_turret_mega" ] = true, + [ "npc_turret_sentry" ] = true, + [ "npc_frag_drone" ] = true, + [ "player" ] = true, + [ "prop_dynamic" ] = true, + [ "prop_script" ] = true, + [ "grenade_frag" ] = true, + [ "rpg_missile" ] = true, + [ "script_mover" ] = true, + [ "turret" ] = true, } struct { diff --git a/Northstar.Custom/paks/mp_weapon_shotgun_doublebarrel.rpak b/Northstar.Custom/paks/mp_weapon_shotgun_doublebarrel.rpak Binary files differindex 3a714d3b..440f16ae 100644 --- a/Northstar.Custom/paks/mp_weapon_shotgun_doublebarrel.rpak +++ b/Northstar.Custom/paks/mp_weapon_shotgun_doublebarrel.rpak diff --git a/Northstar.Custom/paks/mp_weapon_shotgun_doublebarrel.starpak b/Northstar.Custom/paks/mp_weapon_shotgun_doublebarrel.starpak Binary files differindex 3bd34467..93e59c89 100644 --- a/Northstar.Custom/paks/mp_weapon_shotgun_doublebarrel.starpak +++ b/Northstar.Custom/paks/mp_weapon_shotgun_doublebarrel.starpak |