From 3f2d16609a2d002ff2691b26a2fc034261016591 Mon Sep 17 00:00:00 2001 From: Vel-San <13340023+Vel-San@users.noreply.github.com> Date: Sat, 17 Apr 2021 11:41:32 +0200 Subject: [PATCH] [release] v1.0 Public Release - ReloadOptions now fully supports ServerPerks + Vanilla --- ReloadOptionsSP/Classes/ReloadOptionsSP.uc | 13 +- ReloadOptionsSP/Classes/RldOptInteraction.uc | 10 +- .../Classes/RldOptMidGameOptions.uc | 4 +- .../Classes/RldOptMidGameOptions_SP.uc | 135 ------------------ 4 files changed, 12 insertions(+), 150 deletions(-) delete mode 100644 ReloadOptionsSP/Classes/RldOptMidGameOptions_SP.uc diff --git a/ReloadOptionsSP/Classes/ReloadOptionsSP.uc b/ReloadOptionsSP/Classes/ReloadOptionsSP.uc index a977b6b..7f37d19 100644 --- a/ReloadOptionsSP/Classes/ReloadOptionsSP.uc +++ b/ReloadOptionsSP/Classes/ReloadOptionsSP.uc @@ -40,14 +40,15 @@ function Mutate(string MutateString, PlayerController Sender) { /* Add the interaction. */ simulated function Tick(float DeltaTime) { - local PlayerController localController; + local PlayerController PC; + local RldOptInteraction NewInteraction; - localController= Level.GetLocalPlayerController(); - if (localController != none) - { - localController.Player.InteractionMaster.AddInteraction("ReloadOptionsSP.RldOptInteraction", localController.Player); + PC = Level.GetLocalPlayerController(); + if (PC != None && !PC.PlayerReplicationInfo.bIsSpectator) { + NewInteraction = RldOptInteraction(PC.Player.InteractionMaster.AddInteraction("ReloadOptionsSP.RldOptInteraction", PC.Player)); + NewInteraction.RegisterMutator(Self); + Disable('Tick'); } - Disable('Tick'); } defaultproperties diff --git a/ReloadOptionsSP/Classes/RldOptInteraction.uc b/ReloadOptionsSP/Classes/RldOptInteraction.uc index 4ef1091..ea42699 100644 --- a/ReloadOptionsSP/Classes/RldOptInteraction.uc +++ b/ReloadOptionsSP/Classes/RldOptInteraction.uc @@ -7,7 +7,6 @@ var GUI.GUITabItem ReloadOpt_Tab; var config bool bAllowInterrupt, bDisableAuto, bNoAmmoMsg, bInterruptMsg, bNeedReloadMsg; var config array InterruptAliases; var float timeReloaded, timeReceivedMessage; -var string ReloadOptClass_SP; /////////////////////////// // INTERACTION // @@ -32,7 +31,7 @@ function RegisterMutator(ReloadOptionsSP aMut) { function bool KeyEvent(EInputKey Key, EInputAction Action, float Delta) { local string Alias, Alias_SP, LeftPart, RigthPart; - local MidGamePanel panel; + local RldOptMidGameOptions panel; local UT2K4PlayerLoginMenu escMenu; local int i; @@ -72,12 +71,10 @@ function bool KeyEvent(EInputKey Key, EInputAction Action, float Delta) { } escMenu= UT2K4PlayerLoginMenu(KFGUIController(ViewportOwner.GUIController).ActivePage); if (escMenu != none && escMenu.c_Main.TabIndex(ReloadOpt_Tab.caption) == -1) { - if (escMenu.IsA('SRInvasionLoginMenu')) { - ReloadOpt_Tab.ClassName = ReloadOptClass_SP; - } - panel= MidGamePanel(escMenu.c_Main.AddTabItem(ReloadOpt_Tab)); + panel = RldOptMidGameOptions(escMenu.c_Main.AddTabItem(ReloadOpt_Tab)); if (panel != none) { panel.ModifiedChatRestriction= escMenu.UpdateChatRestriction; + panel.MyInteraction = self; } } } @@ -263,7 +260,6 @@ function InterruptReload(optional bool bFireAlias, optional bool bAltFireAlias) defaultproperties { - ReloadOptClass_SP="ReloadOptionsSP.RldOptMidGameOptions_SP" ReloadOpt_Tab=(ClassName="ReloadOptionsSP.RldOptMidGameOptions",Caption="Reload Options",Hint="Options to customize reload.") InterruptAliases(0)="Fire" InterruptAliases(1)="AltFire" diff --git a/ReloadOptionsSP/Classes/RldOptMidGameOptions.uc b/ReloadOptionsSP/Classes/RldOptMidGameOptions.uc index 639dd22..d475f98 100644 --- a/ReloadOptionsSP/Classes/RldOptMidGameOptions.uc +++ b/ReloadOptionsSP/Classes/RldOptMidGameOptions.uc @@ -1,4 +1,4 @@ -class RldOptMidGameOptions extends MidGamePanel DependsOn(ReloadOptionsSP); +class RldOptMidGameOptions extends MidGamePanel; var RldOptInteraction MyInteraction; var automated GUISectionBackground i_BGCenter; @@ -70,7 +70,7 @@ defaultproperties Begin Object Class=GUISectionBackground Name=BGCenter // bFillClient=True Caption="Reload Options" - WinTop=0.05 + WinTop=0.03 WinLeft=0.25 WinWidth=0.5 WinHeight=0.5 diff --git a/ReloadOptionsSP/Classes/RldOptMidGameOptions_SP.uc b/ReloadOptionsSP/Classes/RldOptMidGameOptions_SP.uc deleted file mode 100644 index ae8b219..0000000 --- a/ReloadOptionsSP/Classes/RldOptMidGameOptions_SP.uc +++ /dev/null @@ -1,135 +0,0 @@ -class RldOptMidGameOptions_SP extends MidGamePanel DependsOn(ReloadOptionsSP); - -var RldOptInteraction MyInteraction; -var automated GUISectionBackground i_BGCenter; -var automated moCheckbox ch_AllowInterrupt, ch_DisableAuto, ch_NoAmmoMsg, ch_InterruptMsg, ch_NeedReloadMsg; - -function InitComponent(GUIController MyController, GUIComponent MyOwner) { - Super.Initcomponent(MyController, MyOwner); - - i_BGCenter.ManageComponent(ch_AllowInterrupt); - i_BGCenter.ManageComponent(ch_DisableAuto); - i_BGCenter.ManageComponent(ch_NoAmmoMsg); - i_BGCenter.ManageComponent(ch_InterruptMsg); - i_BGCenter.ManageComponent(ch_NeedReloadMsg); -} - -function ShowPanel(bool bShow) { - Super.ShowPanel(bShow); - - if (bShow) { - ch_AllowInterrupt.SetComponentValue(MyInteraction.bAllowInterrupt, true); - ch_DisableAuto.SetComponentValue(MyInteraction.bDisableAuto, true); - ch_NoAmmoMsg.SetComponentValue(MyInteraction.bNoAmmoMsg, true); - ch_InterruptMsg.SetComponentValue(MyInteraction.bInterruptMsg, true); - ch_NeedReloadMsg.SetComponentValue(MyInteraction.bNeedReloadMsg, true); - } -} - -function UpdateCheckboxVisibility() { - if (ch_AllowInterrupt.IsChecked()) - ch_InterruptMsg.EnableMe(); - else - ch_InterruptMsg.DisableMe(); - - if (ch_DisableAuto.IsChecked()) - ch_NeedReloadMsg.EnableMe(); - else - ch_NeedReloadMsg.DisableMe(); -} - -function InternalOnChange(GUIComponent Sender) { - switch (Sender) { - case ch_AllowInterrupt: - MyInteraction.bAllowInterrupt = ch_AllowInterrupt.IsChecked(); - UpdateCheckboxVisibility(); - MyInteraction.SaveConfig(); - break; - case ch_DisableAuto: - MyInteraction.bDisableAuto = ch_DisableAuto.IsChecked(); - UpdateCheckboxVisibility(); - MyInteraction.SaveConfig(); - break; - case ch_NoAmmoMsg: - MyInteraction.bNoAmmoMsg = ch_NoAmmoMsg.IsChecked(); - MyInteraction.SaveConfig(); - break; - case ch_InterruptMsg: - MyInteraction.bInterruptMsg = ch_InterruptMsg.IsChecked(); - MyInteraction.SaveConfig(); - break; - case ch_NeedReloadMsg: - MyInteraction.bNeedReloadMsg = ch_NeedReloadMsg.IsChecked(); - MyInteraction.SaveConfig(); - break; - } -} - -defaultproperties -{ - Begin Object Class=GUISectionBackground Name=BGCenter - // bFillClient=True - Caption="Reload Options" - WinTop=0.05 - WinLeft=0.25 - WinWidth=0.5 - WinHeight=0.5 - End Object - i_BGCenter=GUISectionBackground'ReloadOptionsSP.RldOptMidGameOptions_SP.BGCenter' - - Begin Object Class=moCheckBox Name=AllowInterrupt - Caption="Allow to interrupt" - OnCreateComponent=AllowInterrupt.InternalOnCreateComponent - Hint="Allow actions to interrupt the reload animation." - TabOrder=0 - bBoundToParent=True - bScaleToParent=True - OnChange=RldOptMidGameOptions_SP.InternalOnChange - End Object - ch_AllowInterrupt=moCheckBox'ReloadOptionsSP.RldOptMidGameOptions_SP.AllowInterrupt' - - Begin Object Class=moCheckBox Name=DisableAuto - Caption="Disable auto-reload" - OnCreateComponent=DisableAuto.InternalOnCreateComponent - Hint="Play a dry-fire sound instead of triggering auto-reload." - TabOrder=2 - bBoundToParent=True - bScaleToParent=True - OnChange=RldOptMidGameOptions_SP.InternalOnChange - End Object - ch_DisableAuto=moCheckBox'ReloadOptionsSP.RldOptMidGameOptions_SP.DisableAuto' - - Begin Object Class=moCheckBox Name=NoAmmoMsg - Caption="'No ammo!' message" - OnCreateComponent=NoAmmoMsg.InternalOnCreateComponent - Hint="Show this message when you try to fire a weapon that has no ammo." - TabOrder=4 - bBoundToParent=True - bScaleToParent=True - OnChange=RldOptMidGameOptions_SP.InternalOnChange - End Object - ch_NoAmmoMsg=moCheckBox'ReloadOptionsSP.RldOptMidGameOptions_SP.NoAmmoMsg' - - Begin Object Class=moCheckBox Name=InterruptMsg - Caption="'Interrupted!' message" - OnCreateComponent=InterruptMsg.InternalOnCreateComponent - Hint="Show this message when the reload animation is interrupted." - TabOrder=1 - bBoundToParent=True - bScaleToParent=True - OnChange=RldOptMidGameOptions_SP.InternalOnChange - End Object - ch_InterruptMsg=moCheckBox'ReloadOptionsSP.RldOptMidGameOptions_SP.InterruptMsg' - - Begin Object Class=moCheckBox Name=NeedReloadMsg - Caption="'You need to reload!' message" - OnCreateComponent=NeedReloadMsg.InternalOnCreateComponent - Hint="Show this message when you need to reload." - TabOrder=3 - bBoundToParent=True - bScaleToParent=True - OnChange=RldOptMidGameOptions_SP.InternalOnChange - End Object - ch_NeedReloadMsg=moCheckBox'ReloadOptionsSP.RldOptMidGameOptions_SP.NeedReloadMsg' - -}