From 35dfd937798d105238db23ea86f90f21be46694b Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Sun, 7 Nov 2021 03:53:07 +0000 Subject: code cleanup, xp, postgame and some small changes --- .../mod/scripts/vscripts/_disallowed_weapons.gnut | 48 ++++++++++++++++++++++ .../scripts/vscripts/gamemodes/_gamemode_hs.gnut | 1 + .../scripts/vscripts/gamemodes/_gamemode_inf.gnut | 3 +- .../vscripts/sh_3psequence_to_1p_hacks.gnut | 20 ++++++--- .../vscripts/sh_northstar_custom_precache.gnut | 1 + 5 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut (limited to 'Northstar.Custom/mod/scripts') diff --git a/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut b/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut new file mode 100644 index 00000000..8dc0300f --- /dev/null +++ b/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut @@ -0,0 +1,48 @@ +global function DisallowedWeapons_Init + +struct { + array disallowedWeapons + string disallowedWeaponsStringLastVal + string disallowedWeaponReplacement +} file + +void function DisallowedWeapons_Init() +{ + UpdateDisallowedWeaponList() + AddCallback_OnPlayerRespawned( ReplacePlayerWeaponsForSpawn ) +} + +void function UpdateDisallowedWeaponList() +{ + string cvar = GetConVarString( "ns_disallowed_weapons" ) + if ( file.disallowedWeaponsStringLastVal == cvar ) + return + + file.disallowedWeapons = split( cvar, "," ) + foreach ( string weapon in file.disallowedWeapons ) + StringReplace( weapon, " ", "" ) + + file.disallowedWeaponReplacement = GetConVarString( "ns_disallowed_weapon_primary_replacement" ) +} + +void function ReplacePlayerWeaponsForSpawn( entity player ) +{ + UpdateDisallowedWeaponList() + if ( file.disallowedWeapons.len() == 0 ) + return + + bool hadDisallowedWeapon = false + + foreach ( entity weapon in player.GetMainWeapons() ) + { + if ( file.disallowedWeapons.contains( weapon.GetWeaponClassName() ) ) + { + player.TakeWeaponNow( weapon.GetWeaponClassName() ) + player.GiveWeapon( file.disallowedWeaponReplacement ) + hadDisallowedWeapon = true + } + } + + if ( hadDisallowedWeapon ) + SendHudMessage( player, "Restricted weapons were removed", -1, 0.4, 255, 255, 255, 255, 0.15, 3.0, 0.5 ) +} \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut index bc65e0b6..ccdd5b85 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut @@ -20,6 +20,7 @@ void function GamemodeHideAndSeek_Init() SetTimeoutWinnerDecisionFunc( HideAndSeekDecideWinner ) ClassicMP_SetCustomIntro( GamemodeHideAndSeekIntroSetup, 0.0 ) + ClassicMP_ForceDisableEpilogue( true ) AddCallback_OnPlayerRespawned( SetupHideAndSeekPlayer ) AddCallback_OnPlayerKilled( TryNotifyLastPlayerAlive ) diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut index cdf03edd..c2b2b021 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut @@ -12,6 +12,7 @@ void function GamemodeInfection_Init() SetWeaponDropsEnabled( false ) Riff_ForceTitanAvailability( eTitanAvailability.Never ) Riff_ForceBoostAvailability( eBoostAvailability.Disabled ) + ClassicMP_ForceDisableEpilogue( true ) SetShouldPlayerStartBleedoutFunc( InfectionShouldPlayerStartBleedout ) AddCallback_OnClientConnected( InfectionInitPlayer ) @@ -169,7 +170,7 @@ void function SetLastSurvivor( entity player ) Remote_CallFunction_NonReplay( otherPlayer, "ServerCallback_AnnounceLastSurvivor", player.GetEncodedEHandle() ) Highlight_SetEnemyHighlight( player, "enemy_sonar" ) - thread CreateTitanForPlayerAndHotdrop( player, GetTitanReplacementPoint( player, false ) ) + //thread CreateTitanForPlayerAndHotdrop( player, GetTitanReplacementPoint( player, false ) ) if ( GameTime_TimeLeftSeconds() > 45 ) SetServerVar( "gameEndTime", Time() + 45.0 ) 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 8b50811a..202e199a 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 @@ -35,7 +35,6 @@ void function FirstPersonSequenceForce1P_Init() void function FirstPersonSequenceForce1P_InitPlaylistVars() { - PrecacheModel( $"models/weapons/sentry_turret/sentry_turret.mdl" ) AddPrivateMatchModeSettingEnum( "#MODE_SETTING_CATEGORY_RIFF", "fp_embark_enabled", [ "Disabled", "Enabled" ], "0" ) } @@ -86,6 +85,7 @@ Forced1PSequenceData function FirstPersonSequenceForce1P( FirstPersonSequenceStr ownerProxy.SetModel( player.GetModelName() ) ownerProxy.SetValueForModelKey( player.GetModelName() ) ownerProxy.SetInvulnerable() + HideName( ownerProxy ) cleanupData.ownerProxy = ownerProxy int bodygroupValue = 1 @@ -112,6 +112,7 @@ Forced1PSequenceData function FirstPersonSequenceForce1P( FirstPersonSequenceStr thirdPersonProxy.SetModel( player.GetModelName() ) thirdPersonProxy.SetValueForModelKey( player.GetModelName() ) thirdPersonProxy.SetInvulnerable() + HideName( thirdPersonProxy ) cleanupData.thirdPersonProxy = thirdPersonProxy if ( player.IsTitan() ) @@ -126,9 +127,14 @@ Forced1PSequenceData function FirstPersonSequenceForce1P( FirstPersonSequenceStr camera.SetParent( ownerProxy, attachment ) camera.kv.spawnflags = 56 DispatchSpawn( camera ) - player.SetViewEntity( camera, false ) + player.SetViewEntity( camera, true ) cleanupData.camera = camera + // note for potential thing that could be done + // entity e = CreatePropDynamic($"models/weapons/arms/pov_titan_light_cockpit.mdl"); e.SetParent(GetPlayerArray()[0].GetPetTitan(), "HATCH_HEAD"); e.SetOrigin(<0.75,0,-195>) + // this is so we get a cockpit in these anims, issue with it is that the cockpit seems to break alot of rendering stuff + // which really sucks since it'd be awesome to have a cockpit over these anims, really makes them better, even the client func to render through cockpits doesn't seem to work for it, just makes stuff rendering through the cockpit invisible rather than rendering in a broken way + Remote_CallFunction_NonReplay( player, "ServerCallback_HideHudForFPHackAnim" ) // play this anim now, so we can cleanup after it's done thread CleanupForced1PSequenceAfterAnimDone( sequence, ownerProxy, other, cleanupData ) @@ -161,9 +167,13 @@ void function CleanupForced1PSequence( Forced1PSequenceData cleanupData ) #if CLIENT void function ServerCallback_HideHudForFPHackAnim() { - thread MainHud_TurnOff_RUI( true ) - HidePermanentCockpitRui() - + // these functions just set hud positions to infront of/behind the camera, manually set them up here so they'll be far enough away so we don't see them in these anims + // 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 > ) + thread EnableHudOnViewRestored() } diff --git a/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut b/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut index 3e66b5ca..d5af4cde 100644 --- a/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut @@ -7,5 +7,6 @@ void function NorthstarCustomPrecache() PrecacheWeapon( "melee_pilot_kunai" ) // create kunai damage source so game won't crash when we hit smth with it + // just using the default melee one, easier than making a new one getconsttable()[ "eDamageSourceId" ][ "melee_pilot_kunai" ] <- eDamageSourceId.melee_pilot_emptyhanded } \ No newline at end of file -- cgit v1.2.3