-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add GSC * Change GSC color * Add heuristic tests * heuristics: Fix wrong alphabetical sorting * Put smaller GSC samples * heuristics: fix regexes Co-authored-by: John Gardner <[email protected]>
- Loading branch information
1 parent
ba3451b
commit 7469c79
Showing
14 changed files
with
1,349 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include clientscripts\_utility; | ||
#include clientscripts\_filter; | ||
|
||
#using_animtree("player"); | ||
|
||
|
||
init() | ||
{ | ||
clientscripts\_driving_fx::add_vehicletype_callback( "spiderbot_large", ::drive_spiderbot ); | ||
} | ||
|
||
|
||
// | ||
// | ||
drive_spiderbot( localClientNum ) | ||
{ | ||
self endon( "entityshutdown" ); | ||
|
||
while( 1 ) | ||
{ | ||
self waittill( "enter_vehicle", player ); | ||
|
||
init_filter_karma_spiderbot( player ); | ||
enable_filter_karma_spiderbot( player, 0 ); | ||
SetSavedDvar( "r_stereo3DEyeSeparationScaler", 0.01); | ||
|
||
|
||
//TODO: Get this to work in the vehicle GDT, somehow overcoming the lack of wheels | ||
if( isdefined( level._audio_spiderbot_override ) ) | ||
{ | ||
self thread [[level._audio_spiderbot_override]](player); | ||
} | ||
|
||
// This compass isn't working they way it needs to. | ||
// Create the compass | ||
// spider_compass = Spawn( player GetLocalClientNumber(), player GetOrigin(), "script_model" ); | ||
// spider_compass SetModel( "p6_3d_gizmo" ); | ||
// spider_compass SetViewmodelRenderflag( true ); | ||
// spider_compass LinkToCamera( 5, (16, 0, 12) ); // in/out, left/right, up/down | ||
|
||
self waittill( "exit_vehicle" ); | ||
|
||
disable_filter_karma_spiderbot( player, 0 ); | ||
SetSavedDvar( "r_stereo3DEyeSeparationScaler", 1); | ||
|
||
// spider_compass delete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
#using scripts\shared\array_shared; | ||
#using scripts\shared\callbacks_shared; | ||
#using scripts\shared\flag_shared; | ||
#using scripts\shared\util_shared; | ||
#insert scripts\shared\shared.gsh; | ||
#insert scripts\zm\array_override\array_override_common.gsh; | ||
|
||
#namespace array_override; | ||
|
||
#define NOTIFY_SELF(n_add) self notify("override_state_change",n_type,str_name,n_add,is_override_exluded_from_notif(str_name)) | ||
|
||
function register(str_name,n_type,func) | ||
{ | ||
switch(n_type) | ||
{ | ||
case ARRAY_RANDOM: | ||
DEFAULT(self.array_random_override,array()); | ||
self.array_random_override[str_name] = func; | ||
break; | ||
case ARRAY_RANDOMIZE: | ||
DEFAULT(self.array_randomize_override,array()); | ||
self.array_randomize_override[str_name] = func; | ||
break; | ||
} | ||
NOTIFY_SELF(1); | ||
} | ||
|
||
function unregister(str_name,n_type) | ||
{ | ||
switch(n_type) | ||
{ | ||
case ARRAY_RANDOM: | ||
ArrayRemoveIndex(self.array_random_override,str_name,1); | ||
break; | ||
case ARRAY_RANDOMIZE: | ||
ArrayRemoveIndex(self.array_randomize_override,str_name,1); | ||
break; | ||
} | ||
NOTIFY_SELF(-1); | ||
} | ||
|
||
function private reregister(str_name,n_type) | ||
{ | ||
switch(n_type) | ||
{ | ||
case ARRAY_RANDOM: | ||
func = self.array_random_override[str_name]; | ||
break; | ||
case ARRAY_RANDOMIZE: | ||
func = self.array_randomize_override[str_name]; | ||
break; | ||
} | ||
if (!isdefined(func)) return; | ||
increment_exclude_from_notif(str_name); | ||
unregister(str_name,n_type); | ||
register(str_name,n_type,func); | ||
decrement_exclude_from_notif(str_name); | ||
} | ||
|
||
#define EXCLUDE_FROM_NOTIF_DEFAULTS MAKE_ARRAY(self.override_notif_exclude) DEFAULT(self.override_notif_exclude[str_name],0); | ||
function increment_exclude_from_notif(str_name) | ||
{ | ||
EXCLUDE_FROM_NOTIF_DEFAULTS | ||
self.override_notif_exclude[str_name]++; | ||
} | ||
|
||
function decrement_exclude_from_notif(str_name) | ||
{ | ||
EXCLUDE_FROM_NOTIF_DEFAULTS | ||
self.override_notif_exclude[str_name]--; | ||
if (self.override_notif_exclude[str_name] <= 0) ArrayRemoveIndex(self.override_notif_exclude,str_name,1); | ||
} | ||
|
||
function private is_override_exluded_from_notif(str_name) | ||
{ | ||
MAKE_ARRAY(self.override_notif_exclude) | ||
return IS_TRUE(self.override_notif_exclude[str_name]); | ||
} | ||
|
||
function autoexec init_player_overrides() | ||
{ | ||
callback::on_connect(&on_player_connect); | ||
} | ||
|
||
function private on_player_connect() | ||
{ | ||
self.array_random_override = array(); | ||
self.array_randomize_override = array(); | ||
} | ||
|
||
function register_recursive(str_name,n_type,func,b_ex_notif = false) | ||
{ | ||
switch(n_type) | ||
{ | ||
case ARRAY_RANDOM: | ||
DEFAULT(level.recursive_random_override,array()); | ||
level.recursive_random_override[str_name] = SpawnStruct(); | ||
struct = level.recursive_random_override[str_name]; | ||
break; | ||
case ARRAY_RANDOMIZE: | ||
DEFAULT(level.recursive_randomize_override,array()); | ||
level.recursive_randomize_override[str_name] = SpawnStruct(); | ||
struct = level.recursive_randomize_override[str_name]; | ||
break; | ||
} | ||
struct.func = func; | ||
struct.b_ex_notif = b_ex_notif; | ||
struct.count = 0; | ||
struct.a_flag = array(); | ||
} | ||
|
||
#define RECURSIVE_SWITCHBLOCK switch(n_type){\ | ||
case ARRAY_RANDOM: struct = level.recursive_random_override[str_name];break;\ | ||
case ARRAY_RANDOMIZE: struct = level.recursive_randomize_override[str_name];break;}\ | ||
if (!isdefined(struct)) return; | ||
|
||
function increment_register(str_name,n_type) | ||
{ | ||
RECURSIVE_SWITCHBLOCK | ||
if (struct.count <= 0) | ||
{ | ||
struct.count = 0; | ||
if (struct.b_ex_notif) level increment_exclude_from_notif(str_name); | ||
level register(str_name,n_type,struct.func); | ||
} | ||
struct.count++; | ||
thread update_recursive_flags(struct); | ||
} | ||
|
||
function decrement_register(str_name,n_type,b_unregister = false) | ||
{ | ||
RECURSIVE_SWITCHBLOCK | ||
struct.count--; | ||
if (b_unregister || struct.count <= 0) | ||
{ | ||
level unregister(str_name,n_type); | ||
if (struct.b_ex_notif) level decrement_exclude_from_notif(str_name); | ||
struct.count = 0; | ||
} | ||
thread update_recursive_flags(struct); | ||
} | ||
|
||
function run_recursive_override_instance(str_name,n_type,func) | ||
{ | ||
//fix this | ||
id = self GetEntityNumber() + 1; | ||
wait(.05 * id); | ||
// | ||
increment_register(str_name,n_type); | ||
[[func]](); | ||
decrement_register(str_name,n_type); | ||
} | ||
|
||
function add_recursive_override_flag(str_name,n_type,a_flags) | ||
{ | ||
RECURSIVE_SWITCHBLOCK | ||
DEFAULT(struct.a_flag,array()); | ||
foreach (flag in a_flags) | ||
{ | ||
if (!IsArray(flag)) flag_array = array(flag); | ||
else flag_array = flag; | ||
str_flag = flag_array[0]; | ||
if (!IsString(str_flag)) continue; | ||
n_count = VAL(flag_array[1],0); | ||
flag_struct = SpawnStruct(); | ||
flag_struct.flag = str_flag; | ||
flag_struct.required_count = n_count; | ||
flag_struct.comparison = flag_array[2]; | ||
struct.a_flag[struct.a_flag.size] = flag_struct; | ||
level flag::init(str_flag); | ||
update_specific_flag(flag_struct,struct.count); | ||
} | ||
} | ||
|
||
function update_recursive_flags(struct) | ||
{ | ||
foreach (flag_struct in struct.a_flag) | ||
{ | ||
update_specific_flag(flag_struct,struct.count); | ||
} | ||
} | ||
|
||
function private update_specific_flag(flag_struct,n_count) | ||
{ | ||
if (IsFunctionPtr(flag_struct.required_count)) required_count = [[flag_struct.required_count]](); | ||
else required_count = flag_struct.required_count; | ||
|
||
if (IsFunctionPtr(flag_struct.comparison)) b_val = [[flag_struct.comparison]](n_count,required_count); | ||
else b_val = n_count === required_count; | ||
|
||
if (isdefined(b_val)) level flag::set_val(flag_struct.flag,b_val); | ||
} | ||
|
||
function link_to_recursive_flag(str_name,n_type,a_flag,b_waitForAll = false) | ||
{ | ||
level endon("end_game"); | ||
if (!isdefined(a_flag)) return; | ||
if (!IsArray(a_flag)) a_flag = array(a_flag); | ||
if (b_waitForAll) {waitFunc = &flag::wait_till_all; waitClearFunc = &flag::wait_till_clear_all;} | ||
else {waitFunc = &flag::wait_till_any; waitClearFunc = &flag::wait_till_clear_all;} | ||
|
||
while(1) | ||
{ | ||
level [[waitFunc]](a_flag); | ||
level [[waitClearFunc]](a_flag); | ||
wait .05; | ||
level reregister(str_name,n_type); | ||
} | ||
} |
Oops, something went wrong.