diff --git a/MskGs/Classes/MskGsMut.uc b/MskGs/Classes/MskGsMut.uc index 0199a99..ed4f2cf 100644 --- a/MskGs/Classes/MskGsMut.uc +++ b/MskGs/Classes/MskGsMut.uc @@ -120,6 +120,12 @@ function Initialize() MyKFGI.KFGFxManagerClass = class'MskGsGFxMoviePlayer_Manager'; MyKFGI.MyKFGRI.VoteCollectorClass = class'MskGsVoteCollector'; + if (MyKFGI.PlayerControllerClass == class'KFGame.KFPlayerController') + MyKFGI.PlayerControllerClass = class'MskGsPlayerController'; + else if (MyKFGI.PlayerControllerClass == class'KFGameContent.KFPlayerControllerVersus') + MyKFGI.PlayerControllerClass = class'MskGsPlayerControllerVersus'; + else if (MyKFGI.PlayerControllerClass == class'KFGame.KFPlayerController_WeeklySurvival') + MyKFGI.PlayerControllerClass = class'MskGsPlayerController_WeeklySurvival'; MyKFGI.MyKFGRI.VoteCollector = new(MyKFGI.MyKFGRI) MyKFGI.MyKFGRI.VoteCollectorClass; VoteCollector = MskGsVoteCollector(MyKFGI.MyKFGRI.VoteCollector); @@ -292,6 +298,8 @@ function NotifyLogin(Controller C) Initialize(); + `log("NotifyLogin:" @ C); + RepInfo = Spawn(class'MskGsRepInfo', KFPlayerController(C)); RepInfo.C = C; RepInfo.Mut = Self; diff --git a/MskGs/Classes/MskGsPlayerController.uc b/MskGs/Classes/MskGsPlayerController.uc new file mode 100644 index 0000000..02de53d --- /dev/null +++ b/MskGs/Classes/MskGsPlayerController.uc @@ -0,0 +1,65 @@ +class MskGsPlayerController extends KFPlayerController; + +event Destroyed() +{ + local KFProjectile KFProj; + local int i; + + // Stop currently playing stingers when the map is being switched + if( StingerAkComponent != none ) + { + StingerAkComponent.StopEvents(); + } + + // Useful: + // https://wiki.beyondunreal.com/What_happens_when_an_Actor_is_destroyed + for (i = DeployedTurrets.Length - 1; i >= 0; --i) + { + if (DeployedTurrets[i] != None) + if (!DeployedTurrets[i].bPendingDelete && !DeployedTurrets[i].bDeleteMe) + DeployedTurrets[i].Destroy(); + + // don't worry about the Destroyed event on Turret + // because it doesn't do anything if the turret is not in the list + DeployedTurrets.Remove(i, 1); + } + + SetRTPCValue( 'Health', 100, true ); + PostAkEvent( LowHealthStopEvent ); + bPlayingLowHealthSFX = false; + + // Update projectiles in the world + foreach DynamicActors( class'KFProjectile', KFProj ) + { + if( KFProj.InstigatorController == self ) + { + KFProj.OnInstigatorControllerLeft(); + } + } + + if( LocalCustomizationPawn != none && !LocalCustomizationPawn.bPendingDelete ) + { + LocalCustomizationPawn.Destroy(); + } + + if (OnlineSub != none) + { + OnlineSub.ClearAllReadOnlineAvatarByNameCompleteDelegates(); + OnlineSub.ClearAllReadOnlineAvatarCompleteDelegates(); + } + + if (WorldInfo.NetMode != NM_DedicatedServer) + { + ClearMixerDelegates(); + ClearDiscord(); + } + + ClientMatchEnded(); + + Super(GamePlayerController).Destroyed(); +} + +defaultproperties +{ + +} \ No newline at end of file diff --git a/MskGs/Classes/MskGsPlayerControllerVersus.uc b/MskGs/Classes/MskGsPlayerControllerVersus.uc new file mode 100644 index 0000000..17b2154 --- /dev/null +++ b/MskGs/Classes/MskGsPlayerControllerVersus.uc @@ -0,0 +1,65 @@ +class MskGsPlayerControllerVersus extends KFPlayerControllerVersus; + +event Destroyed() +{ + local KFProjectile KFProj; + local int i; + + // Stop currently playing stingers when the map is being switched + if( StingerAkComponent != none ) + { + StingerAkComponent.StopEvents(); + } + + // Useful: + // https://wiki.beyondunreal.com/What_happens_when_an_Actor_is_destroyed + for (i = DeployedTurrets.Length - 1; i >= 0; --i) + { + if (DeployedTurrets[i] != None) + if (!DeployedTurrets[i].bPendingDelete && !DeployedTurrets[i].bDeleteMe) + DeployedTurrets[i].Destroy(); + + // don't worry about the Destroyed event on Turret + // because it doesn't do anything if the turret is not in the list + DeployedTurrets.Remove(i, 1); + } + + SetRTPCValue( 'Health', 100, true ); + PostAkEvent( LowHealthStopEvent ); + bPlayingLowHealthSFX = false; + + // Update projectiles in the world + foreach DynamicActors( class'KFProjectile', KFProj ) + { + if( KFProj.InstigatorController == self ) + { + KFProj.OnInstigatorControllerLeft(); + } + } + + if( LocalCustomizationPawn != none && !LocalCustomizationPawn.bPendingDelete ) + { + LocalCustomizationPawn.Destroy(); + } + + if (OnlineSub != none) + { + OnlineSub.ClearAllReadOnlineAvatarByNameCompleteDelegates(); + OnlineSub.ClearAllReadOnlineAvatarCompleteDelegates(); + } + + if (WorldInfo.NetMode != NM_DedicatedServer) + { + ClearMixerDelegates(); + ClearDiscord(); + } + + ClientMatchEnded(); + + Super(GamePlayerController).Destroyed(); +} + +defaultproperties +{ + +} \ No newline at end of file diff --git a/MskGs/Classes/MskGsPlayerController_WeeklySurvival.uc b/MskGs/Classes/MskGsPlayerController_WeeklySurvival.uc new file mode 100644 index 0000000..95b2f74 --- /dev/null +++ b/MskGs/Classes/MskGsPlayerController_WeeklySurvival.uc @@ -0,0 +1,65 @@ +class MskGsPlayerController_WeeklySurvival extends KFPlayerController_WeeklySurvival; + +event Destroyed() +{ + local KFProjectile KFProj; + local int i; + + // Stop currently playing stingers when the map is being switched + if( StingerAkComponent != none ) + { + StingerAkComponent.StopEvents(); + } + + // Useful: + // https://wiki.beyondunreal.com/What_happens_when_an_Actor_is_destroyed + for (i = DeployedTurrets.Length - 1; i >= 0; --i) + { + if (DeployedTurrets[i] != None) + if (!DeployedTurrets[i].bPendingDelete && !DeployedTurrets[i].bDeleteMe) + DeployedTurrets[i].Destroy(); + + // don't worry about the Destroyed event on Turret + // because it doesn't do anything if the turret is not in the list + DeployedTurrets.Remove(i, 1); + } + + SetRTPCValue( 'Health', 100, true ); + PostAkEvent( LowHealthStopEvent ); + bPlayingLowHealthSFX = false; + + // Update projectiles in the world + foreach DynamicActors( class'KFProjectile', KFProj ) + { + if( KFProj.InstigatorController == self ) + { + KFProj.OnInstigatorControllerLeft(); + } + } + + if( LocalCustomizationPawn != none && !LocalCustomizationPawn.bPendingDelete ) + { + LocalCustomizationPawn.Destroy(); + } + + if (OnlineSub != none) + { + OnlineSub.ClearAllReadOnlineAvatarByNameCompleteDelegates(); + OnlineSub.ClearAllReadOnlineAvatarCompleteDelegates(); + } + + if (WorldInfo.NetMode != NM_DedicatedServer) + { + ClearMixerDelegates(); + ClearDiscord(); + } + + ClientMatchEnded(); + + Super(GamePlayerController).Destroyed(); +} + +defaultproperties +{ + +} \ No newline at end of file diff --git a/tools b/tools index 49fcaf6..02222cf 160000 --- a/tools +++ b/tools @@ -1 +1 @@ -Subproject commit 49fcaf67a29c5b478dc10f1f0ae08ed43017cd36 +Subproject commit 02222cf4536ac3b4dc9341c17549f77bd8efd4a4