From feb8e2bcdea3e69d45bcd53c353b65d841d527f9 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Thu, 28 Apr 2022 00:07:06 +0000 Subject: improvements to fp executions, including the ability to use tf1 pilot/titan executions --- .../vscripts/melee/_melee_synced_human.gnut | 33 ++++++++++++++++++---- .../vscripts/melee/_melee_synced_titan.gnut | 31 ++++++++++++-------- .../vscripts/sh_3psequence_to_1p_hacks.gnut | 30 ++++++++++++++++---- .../scripts/vscripts/titan/sh_titan_embark.gnut | 24 ++++++++++------ 4 files changed, 86 insertions(+), 32 deletions(-) diff --git a/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_human.gnut b/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_human.gnut index 2f94e759..fb0a40a6 100644 --- a/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_human.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_human.gnut @@ -21,7 +21,30 @@ bool function MeleeThread_PilotVsEnemyInternal( SyncedMelee action, entity attac Assert( IsAlive( attacker ) ) Assert( IsAlive( target ) ) - bool isAttackerRef = IsAttackerRef( action, target ) + bool isAttackerRef + if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", eFirstPersonSequenceForce1PSetting.DISABLED ) >= eFirstPersonSequenceForce1PSetting.CLASSIC_EXECUTION ) + { + action.attackerAnimation1p = "ptpov_rspn101_melee_necksnap_rear" + action.attackerAnimation3p = "pt_rspn101_melee_necksnap_rear" + action.targetAnimation1p = "ptpov_melee_necksnap_rear_attacked" + action.targetAnimation3p = "pt_melee_necksnap_rear_attacked" + action.isAttackerRef = false + action.minDot = 0.2 + + /* here be dragons + action.attackerAnimation1p = "ptpov_assassin_melee_necksnap_rear" + action.attackerAnimation3p = "pt_assassin_melee_necksnap_rear" + action.targetAnimation1p = "ptpov_assassin_melee_necksnap_rear_attacked" + action.targetAnimation3p = "pt_assassin_melee_necksnap_rear_attacked" + action.attachModel1p = $"models/weapons/bolo_sword/w_bolo_sword.mdl" + action.attachTag1p = "PROPGUN" + */ + + // need to hardcode false here otherwise it just doesnt work for some reason?? + isAttackerRef = false + } + else + isAttackerRef = IsAttackerRef( action, target ) vector attackerOrigin = attacker.GetOrigin() vector targetOrigin = target.GetOrigin() @@ -259,7 +282,7 @@ void function MeleeThread_PilotVsEnemy_Attacker( SyncedMelee action, entity atta if ( isAttackerRef ) { #if MP - if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) + if ( ShouldForce1PFirstPersonSequence() && GetCurrentPlaylistVarInt( "fp_embark_enabled", eFirstPersonSequenceForce1PSetting.DISABLED ) < eFirstPersonSequenceForce1PSetting.CLASSIC_EXECUTION ) FirstPersonSequenceForce1P( attackerSequence, attacker ) #endif @@ -268,7 +291,7 @@ void function MeleeThread_PilotVsEnemy_Attacker( SyncedMelee action, entity atta else { #if MP - if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) + if ( ShouldForce1PFirstPersonSequence() && GetCurrentPlaylistVarInt( "fp_embark_enabled", eFirstPersonSequenceForce1PSetting.DISABLED ) < eFirstPersonSequenceForce1PSetting.CLASSIC_EXECUTION ) FirstPersonSequenceForce1P( attackerSequence, attacker, target ) #endif @@ -410,7 +433,7 @@ void function MeleeThread_PilotVsEnemy_Target( SyncedMelee action, entity attack if ( isAttackerRef ) { #if MP - if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) + if ( ShouldForce1PFirstPersonSequence() && target.IsPlayer() && GetCurrentPlaylistVarInt( "fp_embark_enabled", eFirstPersonSequenceForce1PSetting.DISABLED ) < eFirstPersonSequenceForce1PSetting.CLASSIC_EXECUTION ) FirstPersonSequenceForce1P( targetSequence, target, attacker ) #endif @@ -419,7 +442,7 @@ void function MeleeThread_PilotVsEnemy_Target( SyncedMelee action, entity attack else { #if MP - if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) + if ( ShouldForce1PFirstPersonSequence() && GetCurrentPlaylistVarInt( "fp_embark_enabled", eFirstPersonSequenceForce1PSetting.DISABLED ) < eFirstPersonSequenceForce1PSetting.CLASSIC_EXECUTION ) FirstPersonSequenceForce1P( targetSequence, target ) #endif diff --git a/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_titan.gnut b/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_titan.gnut index d9e995f7..19f3dda3 100644 --- a/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_titan.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_titan.gnut @@ -255,7 +255,12 @@ void functionref( SyncedMelee action, entity attacker, entity target ) function if ( SoulHasPassive( soul, ePassives.PAS_VANGUARD_COREMETER ) ) executionRef = "execution_vanguard_kit" - if ( executionRef in file.executionData_3p ) + bool fpEmbarkShouldNotForceClassic = true + #if MP + fpEmbarkShouldNotForceClassic = GetCurrentPlaylistVarInt( "fp_embark_enabled", eFirstPersonSequenceForce1PSetting.DISABLED ) < eFirstPersonSequenceForce1PSetting.CLASSIC_EXECUTION || executionRef == "execution_vanguard_kit" + #endif + + if ( executionRef in file.executionData_3p && fpEmbarkShouldNotForceClassic ) return TitanVsTitan_3p if ( target.IsNPC() ) @@ -319,15 +324,15 @@ void function MeleeThread_AtlasVsTitanShort( SyncedMelee action, entity attacker target.e.syncedMeleeAttacker = attacker - // attacker.SetInvulnerable() + attacker.SetInvulnerable() target.SetInvulnerable() //HACK: Have to SetInvulnerable first before attacker holsters weapon, because if the attacker is vortexing, holster will release bullets caught and kill off the victim if low enough health //HACK! This function was originally for NPCs only, but now that it is being used for players, we need to holster their weapon if ( target.IsPlayer() ) HolsterAndDisableWeapons( target ) - if ( ShouldHolsterWeaponForSyncedMelee( attacker ) ) - HolsterAndDisableWeapons( attacker ) + //if ( ShouldHolsterWeaponForSyncedMelee( attacker ) ) + HolsterAndDisableWeapons( attacker ) local attackerViewBody @@ -358,7 +363,7 @@ void function MeleeThread_AtlasVsTitanShort( SyncedMelee action, entity attacker if ( IsValid( attacker ) ) { - //attacker.ClearInvulnerable() + attacker.ClearInvulnerable() attacker.UnforceStand() attacker.ClearParent() ClearPlayerAnimViewEntity( attacker ) @@ -904,10 +909,10 @@ void function MeleeThread_OgreVsTitan( SyncedMelee action, entity attacker, enti targetSequence.blendTime = 0.25 target.e.syncedMeleeAttacker = attacker - DisableWeapons( attacker, [] ) - DisableWeapons( target, [] ) + HolsterViewModelAndDisableWeapons( attacker ) + HolsterViewModelAndDisableWeapons( target ) - // attacker.SetInvulnerable() + attacker.SetInvulnerable() target.SetInvulnerable() entity soul = target.GetTitanSoul() @@ -930,10 +935,11 @@ void function MeleeThread_OgreVsTitan( SyncedMelee action, entity attacker, enti if ( IsValid( attacker ) ) { + attacker.ClearInvulnerable() attacker.UnforceStand() attacker.ClearParent() ClearPlayerAnimViewEntity( attacker ) - EnableWeapons( attacker, [] ) + DeployViewModelAndEnableWeapons( attacker ) attacker.PlayerMelee_ExecutionEndAttacker() if ( IsAlive( attacker ) ) @@ -1331,8 +1337,9 @@ void function TitanVsTitan_3p( SyncedMelee action, entity attacker, entity targe attackerBodySequence.useAnimatedRefAttachment = true #if MP + // used for monarch's energy thief execution // could use FirstPersonSequenceForce1P here, but since this uses a propdynamic rather than a player, easier to do it manually - if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) + if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", eFirstPersonSequenceForce1PSetting.DISABLED ) != eFirstPersonSequenceForce1PSetting.DISABLED ) { // hide from everyone else attackerViewBody.kv.VisibilityFlags = ENTITY_VISIBLE_TO_EVERYONE & ~ENTITY_VISIBLE_TO_OWNER @@ -1372,7 +1379,7 @@ void function TitanVsTitan_3p( SyncedMelee action, entity attacker, entity targe if ( isAttackerRef ) { #if MP - if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) + if ( ShouldForce1PFirstPersonSequence() ) { if ( attacker.IsPlayer() && !attackerDoing1PViewbodyAnim ) FirstPersonSequenceForce1P( attackerSequence, attacker ) @@ -1388,7 +1395,7 @@ void function TitanVsTitan_3p( SyncedMelee action, entity attacker, entity targe else { #if MP - if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) + if ( ShouldForce1PFirstPersonSequence() ) { if ( target.IsPlayer() ) FirstPersonSequenceForce1P( targetSequence, target ) diff --git a/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut b/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut index abfd269a..1c009b76 100644 --- a/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut @@ -1,5 +1,6 @@ global function FirstPersonSequenceForce1P_Init global function FirstPersonSequenceForce1P_InitPlaylistVars +global function ShouldForce1PFirstPersonSequence #if SERVER global function FirstPersonSequenceForce1P @@ -9,6 +10,16 @@ global function FirstPersonSequenceForce1P_InitPlaylistVars global function ServerCallback_HideHudForFPHackAnim #endif +global enum eFirstPersonSequenceForce1PSetting +{ + DISABLED, + ENABLED, // force all embark/execution anims to 1p + + // assume these are above ENABLED + CLASSIC_EXECUTION, // don't force any animations to 1p, but use the tf1 animations for titan executions (tf1 necksnap is not ingame unfortunately) + CLASSIC_EXECUTION_CUSTOM_EMBARK // use the classic animations for executions, but force everything else to 1p +} + global const string FORCE1P_PILOT_1P_ATTACHMENT = "HEADFOCUS" global const string FORCE1P_TITAN_1P_ATTACHMENT = "HATCH_HEAD" // CHEST_LASER could be better, but is only on atlas titans @@ -35,7 +46,7 @@ void function FirstPersonSequenceForce1P_Init() void function FirstPersonSequenceForce1P_InitPlaylistVars() { - AddPrivateMatchModeSettingEnum( "#MODE_SETTING_CATEGORY_RIFF", "fp_embark_enabled", [ "#SETTING_DISABLED", "#SETTING_ENABLED" ], "0" ) + AddPrivateMatchModeSettingEnum( "#MODE_SETTING_CATEGORY_RIFF", "fp_embark_enabled", [ "#SETTING_DISABLED", "#SETTING_ENABLED", "#SETTING_FPEMBARK_CLASSIC", "#SETTING_FPEMBARK_CLASSIC_AND_NEW_EMBARK" ], "0" ) } void function FirstPersonSequenceForce1P_RegisterCustomNetworkFunctions() @@ -43,6 +54,12 @@ void function FirstPersonSequenceForce1P_RegisterCustomNetworkFunctions() Remote_RegisterFunction( "ServerCallback_HideHudForFPHackAnim" ) } +bool function ShouldForce1PFirstPersonSequence() +{ + int ret = GetCurrentPlaylistVarInt( "fp_embark_enabled", eFirstPersonSequenceForce1PSetting.DISABLED ) + return ret == eFirstPersonSequenceForce1PSetting.ENABLED || ret == eFirstPersonSequenceForce1PSetting.CLASSIC_EXECUTION_CUSTOM_EMBARK +} + #if SERVER Forced1PSequenceData function FirstPersonSequenceForce1P( FirstPersonSequenceStruct sequence, entity player, entity other = null ) { @@ -172,9 +189,11 @@ void function ServerCallback_HideHudForFPHackAnim() // in an ideal world we wouldn't even have to turn off this rui stuff because it would be parented to our camera but unfortunately we do not live in an ideal world //thread MainHud_TurnOff_RUI( true ) //HidePermanentCockpitRui() - RuiTopology_UpdatePos( clGlobal.topoCockpitHud, < -1000, -1000, -1000 >, < -1000, -1000, -1000 >, < -1000, -1000, -1000 > ) - RuiTopology_UpdatePos( clGlobal.topoCockpitHudPermanent, < -1000, -1000, -1000 >, < -1000, -1000, -1000 >, < -1000, -1000, -1000 > ) - + + if ( !GetConVarBool( "rui_drawEnable" ) ) + return + + SetConVarBool( "rui_drawEnable", false ) thread EnableHudOnViewRestored() } @@ -183,7 +202,6 @@ void function EnableHudOnViewRestored() while ( GetViewEntity() != GetLocalClientPlayer() ) WaitFrame() - thread MainHud_TurnOn_RUI( true ) - ShowPermanentCockpitRui() + SetConVarBool( "rui_drawEnable", true ) } #endif \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/vscripts/titan/sh_titan_embark.gnut b/Northstar.Custom/mod/scripts/vscripts/titan/sh_titan_embark.gnut index 4fd4d0c6..65a20f85 100644 --- a/Northstar.Custom/mod/scripts/vscripts/titan/sh_titan_embark.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/titan/sh_titan_embark.gnut @@ -952,7 +952,7 @@ function TitanEmbark_PlayerEmbarks( entity player, entity titan, table e ) ) #if MP - if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 && !doFirstPersonAnim ) + if ( ShouldForce1PFirstPersonSequence() && !doFirstPersonAnim ) FirstPersonSequenceForce1P( sequence, player, titan ) #endif @@ -1015,17 +1015,19 @@ void function Embark_DelayedFadeOut( entity player, entity titan, float delay ) wait delay - EMBARK_FADE_TIME - if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 0 ) - { - ScreenFadeToBlack( player, EMBARK_FADE_TIME, EMBARK_FADE_TIME + 0.2 ) // a little extra so we stay black - wait EMBARK_FADE_TIME - } - else + #if MP + if ( ShouldForce1PFirstPersonSequence() ) { wait EMBARK_FADE_TIME - 0.2 ScreenFadeToBlack( player, 0.2, 0.4 ) wait 0.2 } + else + #endif + { + ScreenFadeToBlack( player, EMBARK_FADE_TIME, EMBARK_FADE_TIME + 0.2 ) // a little extra so we stay black + wait EMBARK_FADE_TIME + } ScreenFadeFromBlack( player, EMBARK_FADE_TIME, EMBARK_FADE_TIME ) } @@ -1088,8 +1090,10 @@ void function PhaseEmbarkPhaseStart( entity player ) PlayPhaseShiftDisappearFX( player ) EmitSoundOnEntity( player, "pilot_phaseembark_activate_3p" ) - if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) + #if MP + if ( ShouldForce1PFirstPersonSequence() ) player.PhaseShiftBegin( 0.0, 0.2 ) + #endif thread PhaseEmbarkPhaseCleanup( player ) } @@ -1117,8 +1121,10 @@ void function PhaseEmbarkPhaseStop( entity player ) PlayPhaseShiftDisappearFX( player ) EmitSoundOnEntity( player, "pilot_phaseembark_end_3p" ) - if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) + #if MP + if ( ShouldForce1PFirstPersonSequence() ) player.PhaseShiftCancel() + #endif } function ShouldSkipAheadIntoEmbark( standing, player, titan, e ) -- cgit v1.2.3