From 1dd125c5797b068e25588909d718aab4bfcb34fa Mon Sep 17 00:00:00 2001 From: yfbsei <61809667+yfbsei@users.noreply.github.com> Date: Tue, 13 Feb 2024 05:32:16 -0500 Subject: [PATCH] feat: add basic integration support for IW6x (#320) Co-authored-by: RaidMax Co-authored-by: Edo --- GameFiles/GameInterface/_integration_iw6.gsc | 58 ++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 GameFiles/GameInterface/_integration_iw6.gsc diff --git a/GameFiles/GameInterface/_integration_iw6.gsc b/GameFiles/GameInterface/_integration_iw6.gsc new file mode 100644 index 00000000..f98bd9ca --- /dev/null +++ b/GameFiles/GameInterface/_integration_iw6.gsc @@ -0,0 +1,58 @@ +Init() +{ + thread Setup(); +} + +Setup() +{ + level endon( "game_ended" ); + waittillframeend; + + level waittill( level.notifyTypes.sharedFunctionsInitialized ); + + scripts\_integration_base::RegisterLogger( ::Log2Console ); + + level.overrideMethods[level.commonFunctions.getTotalShotsFired] = ::GetTotalShotsFired; + level.overrideMethods[level.commonFunctions.setDvar] = ::SetDvarIfUninitializedWrapper; + level.overrideMethods[level.commonFunctions.waittillNotifyOrTimeout] = ::WaitillNotifyOrTimeoutWrapper; + level.overrideMethods[level.commonFunctions.isBot] = ::IsBotWrapper; + level.overrideMethods[level.commonFunctions.getXuid] = ::GetXuidWrapper; + level.overrideMethods[level.commonFunctions.waitTillAnyTimeout] = ::WaitTillAnyTimeout; + + level notify( level.notifyTypes.gameFunctionsInitialized ); +} + +GetTotalShotsFired() +{ + return maps\mp\_utility::getPlayerStat( "mostshotsfired" ); +} + +SetDvarIfUninitializedWrapper( dvar, value ) +{ + SetDvarIfUninitialized( dvar, value ); +} + +WaitillNotifyOrTimeoutWrapper( _notify, timeout ) +{ + common_scripts\utility::waittill_notify_or_timeout( _notify, timeout ); +} + +Log2Console( logLevel, message ) +{ + Print( "[" + logLevel + "] " + message + "\n" ); +} + +IsBotWrapper( client ) +{ + return IsBot( client ); +} + +GetXuidWrapper() +{ + return self GetXUID(); +} + +WaitTillAnyTimeout( timeOut, string1, string2, string3, string4, string5 ) +{ + return common_scripts\utility::waittill_any_timeout( timeOut, string1, string2, string3, string4, string5 ); +}