diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-06-22 14:30:49 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-06-22 14:30:49 +0100 |
commit | 207facbc402f5639cbcd31f079214351ef605cf2 (patch) | |
tree | 4710b2a88dd64f3dfea1609d31a5de9141640951 /bobthebob.testing/scripts/vscripts/_bobtestingfunctions_mp.gnut | |
parent | c2d438568df6d98cf731807e30eaa7da31e5ea52 (diff) | |
download | NorthstarMods-207facbc402f5639cbcd31f079214351ef605cf2.tar.gz NorthstarMods-207facbc402f5639cbcd31f079214351ef605cf2.zip |
initial commit after moving to new repo
Diffstat (limited to 'bobthebob.testing/scripts/vscripts/_bobtestingfunctions_mp.gnut')
-rw-r--r-- | bobthebob.testing/scripts/vscripts/_bobtestingfunctions_mp.gnut | 239 |
1 files changed, 239 insertions, 0 deletions
diff --git a/bobthebob.testing/scripts/vscripts/_bobtestingfunctions_mp.gnut b/bobthebob.testing/scripts/vscripts/_bobtestingfunctions_mp.gnut new file mode 100644 index 00000000..b782243a --- /dev/null +++ b/bobthebob.testing/scripts/vscripts/_bobtestingfunctions_mp.gnut @@ -0,0 +1,239 @@ +untyped +globalize_all_functions + +void function SvTestingMPInit() +{ + Bleedout_Init() + AddCallback_EntitiesDidLoad( CreateSpawns ) +} + +void function CreateSpawns() +{ + //thread CreateSpawns_Threaded() +} + +void function CreateSpawns_Threaded() +{ + WaitEndFrame() // wait for spawns to get cleared, game ctds if we don't do this + entity validSpawn = GetEntArrayByClass_Expensive( "info_spawnpoint_human" )[ 0 ] + + for ( int i = 0; i < 50; i++ ) + { + entity newSpawn = CreateEntity( "info_spawnpoint_human" ) + newSpawn.SetOrigin( validSpawn.GetOrigin() ) + DispatchSpawn( newSpawn ) + } +} + +void function TestSpawnpoints( bool titan = false ) +{ + entity player = GetPlayerArray()[0] + array<entity> spawnpoints + if ( !titan ) + spawnpoints = SpawnPoints_GetPilotStart( player.GetTeam() ) + else + spawnpoints = SpawnPoints_GetTitanStart( player.GetTeam() ) + + SpawnPoints_InitRatings( player, player.GetTeam() ) + + foreach ( entity spawnpoint in spawnpoints ) + spawnpoint.CalculateRating( titan ? TD_TITAN : TD_PILOT, player.GetTeam(), RandomFloat( 7.0 ) - 3.5, RandomFloat( 7.0 ) - 3.5 ) + + if ( !titan ) + { + SpawnPoints_SortPilotStart() + spawnpoints = SpawnPoints_GetPilotStart( player.GetTeam() ) + } + else + { + SpawnPoints_SortTitanStart() + spawnpoints = SpawnPoints_GetTitanStart( player.GetTeam() ) + } + + entity chosenPoint + foreach ( entity spawnpoint in spawnpoints ) + if ( IsSpawnpointValid( spawnpoint, player.GetTeam() ) ) + { + chosenPoint = spawnpoint + break + } + + player.SetOrigin( chosenPoint.GetOrigin() ) + player.SetAngles( chosenPoint.GetAngles() ) + + //SpawnPoints_DiscardRatings() // somehow the game seems to call this automatically so unneeded +} + +bool function IsSpawnpointValid( entity spawnpoint, int team ) +{ + if ( GameModeRemove( spawnpoint ) ) + return false + + // ultra temp + print( spawnpoint.GetTeam() ) + if ( spawnpoint.GetTeam() == 0 ) + return false + + if ( spawnpoint.GetTeam() > 0 && spawnpoint.GetTeam() != team ) + return false + + + + return true +} + +void function TestScoreEvent( entity player, int id ) +{ + ScoreEvent event = ScoreEvent_FromId( id ) + + Remote_CallFunction_NonReplay( player, "ServerCallback_ScoreEvent", id, event.pointValue, event.displayType, player.GetEncodedEHandle(), event.earnMeterOwnValue, event.earnMeterEarnValue ) +} + +void function TestDrop( entity player ) +{ + thread CreateTitanForPlayerAndHotdrop( player, GetTitanReplacementPoint( player, false ) ) +} + +void function WarpThroughSpawnpoints( string modeOverride = "" ) +{ + if ( !modeOverride.len() ) + modeOverride = GAMETYPE + + entity player = GetPlayerArray()[0] + + array<entity> spawnpoints = GetEntArrayByClass_Expensive( "info_hardpoint" ) //SpawnPoints_GetPilot() + foreach ( entity spawnpoint in spawnpoints ) + { + //string gamemodeKey = "gamemode_" + modeOverride + //if ( spawnpoint.HasKey( gamemodeKey ) && ( spawnpoint.kv[ gamemodeKey ] == "0" || spawnpoint.kv[ gamemodeKey ] == "" ) ) + // continue + // + //if ( !spawnpoint.HasKey( gamemodeKey ) ) + // continue + + if ( spawnpoint.HasKey( "hardpointGroup" ) ) + print( spawnpoint.kv.hardpointGroup ) + + player.SetOrigin( spawnpoint.GetOrigin() ) + player.SetAngles( spawnpoint.GetAngles() ) + + wait 0.5 + } +} + +void function AttemptSpawnBuddyTitan() +{ + PrecacheModel( $"models/titans/buddy/titan_buddy.mdl" ) + PrecacheModel( $"models/weapons/arms/buddypov.mdl" ) + + entity player = GetPlayerArray()[0] + entity titan = CreateNPCTitan( "titan_buddy", player.GetTeam(), player.GetOrigin(), <0, 0, 0> ) + SetSpawnOption_AISettings( titan, "npc_titan_buddy" ) + SetSpawnOption_Weapon( titan, "mp_titanweapon_xo16_vanguard", [ ] ) + + DispatchSpawn( titan ) + + player.SetPetTitan( titan ) + titan.SetOwner( player ) + titan.SetUsable() +} + + +void function SetPlayerCameraToHead() +{ + entity viewControl = CreateEntity( "point_viewcontrol" ) + viewControl.kv.spawnflags = 56 + DispatchSpawn( viewControl ) + + viewControl.SetParent( GetPlayerArray()[0], "headshot" ) + viewControl.SetOrigin( < 4, 0, 1 > ) + viewControl.SetAngles( < 0, 0, 0 > ) + GetPlayerArray()[0].SetViewEntity( viewControl, true ) +} + +void function CreateTestControlPanel() +{ + entity player = GetPlayerArray()[0] + + entity panel = CreateEntity( "prop_control_panel" ) + panel.SetValueForModelKey( $"models/communication/terminal_usable_imc_01.mdl" ) + panel.SetOrigin( player.GetOrigin() ) + panel.SetAngles( player.GetAngles() ) + panel.kv.solid = SOLID_VPHYSICS + SetTargetName( panel, "cpanel" ) + DispatchSpawn( panel ) + + panel.SetModel( $"models/communication/terminal_usable_imc_01.mdl" ) + panel.s.onPlayerFinishesUsing_func = TestOnPanelHacked + +} + +function TestOnPanelHacked( panel, player, success ) +{ + expect entity( panel ) + expect entity( player ) + expect bool( success ) + + if ( !success ) + return + + print( panel + " was hacked by " + player ) + PanelFlipsToPlayerTeamAndUsableByEnemies( panel, player ) +} + +void function TestFastball() +{ + PrecacheModel( $"models/titans/buddy/titan_buddy.mdl" ) + RegisterSignal( "fastball_start_throw" ) + RegisterSignal( "fastball_release" ) + PrecacheParticleSystem( $"P_BT_eye_SM" ) + + entity player = GetPlayerArray()[0] + + entity prop = CreatePropDynamic( $"models/titans/buddy/titan_buddy.mdl", player.GetOrigin(), player.GetAngles() ) + thread PlayAnim( prop, "bt_beacon_fastball_throw_end" ) + + player.ContextAction_SetFastball() + FirstPersonSequenceStruct throwSequence + throwSequence.attachment = "REF" + throwSequence.useAnimatedRefAttachment = true + throwSequence.hideProxy = true + throwSequence.firstPersonAnim = "ptpov_beacon_fastball_throw_end" + //throwSequence.thirdPersonAnim = "pt_beacon_fastball_throw_end" + throwSequence.firstPersonBlendOutTime = 0.0 + + thread FirstPersonSequence( throwSequence, player, prop ) + player.HolsterWeapon() + + EmitSoundOnEntityOnlyToPlayer( player, player, "Music_Beacon_14_BTThrowThruFirstCrane" ) + + prop.WaitSignal( "fastball_start_throw" ) + float duration = EmitSoundOnEntity( prop, "diag_sp_spoke1_BE117_04_01_mcor_bt" ) // trust me + vector eyeAngles = player.EyeAngles() + + // particle effect + StartParticleEffectOnEntity( prop, GetParticleSystemIndex( $"P_BT_eye_SM" ), FX_PATTACH_POINT_FOLLOW, prop.LookupAttachment( "EYEGLOW" ) ) + wait duration + + prop.WaitSignal( "fastball_release" ) + player.ContextAction_ClearFastball() + player.ClearParent() + ClearPlayerAnimViewEntity( player ) + player.SetVelocity( AnglesToForward( eyeAngles ) * 1250 ) + player.DeployWeapon() + + wait 0.5 + prop.Destroy() +} + +void function TestPlanetExplosion() // won't look good until we can load textures from rpak for these models +{ + PrecacheModel( $"models/vistas/planet_ex_static.mdl" ) + PrecacheModel( $"models/vistas/planet_explosion_animated.mdl" ) + + entity cam = GetEnt( "skybox_cam_level" ) + cam.SetOrigin( < 7000, 7000, 7000 > ) // arbitrary point + CreatePropDynamic( $"models/vistas/planet_ex_static.mdl", cam.GetOrigin(), cam.GetAngles() ) + entity explosion = CreatePropDynamic( $"models/vistas/planet_explosion_animated.mdl", cam.GetOrigin(), cam.GetAngles() ) + thread PlayAnim( explosion, "planet_ex_ending" ) +}
\ No newline at end of file |