From a30ec6c29cffeea7064c25cf303a7f28232cca23 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Wed, 12 Jan 2022 02:15:39 +0700 Subject: [PATCH] Add `OnModifyLogin()` signal added to `MutatorAPI` --- .../Events/Mutator_OnModifyLogin_Signal.uc | 38 ++++++++++++++++++ .../Events/Mutator_OnModifyLogin_Slot.uc | 40 +++++++++++++++++++ sources/Unreal/MutatorsAPI/MutatorAPI.uc | 32 +++++++++++++-- sources/Unreal/UnrealService.uc | 1 + 4 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 sources/Unreal/MutatorsAPI/Events/Mutator_OnModifyLogin_Signal.uc create mode 100644 sources/Unreal/MutatorsAPI/Events/Mutator_OnModifyLogin_Slot.uc diff --git a/sources/Unreal/MutatorsAPI/Events/Mutator_OnModifyLogin_Signal.uc b/sources/Unreal/MutatorsAPI/Events/Mutator_OnModifyLogin_Signal.uc new file mode 100644 index 0000000..5c806cf --- /dev/null +++ b/sources/Unreal/MutatorsAPI/Events/Mutator_OnModifyLogin_Signal.uc @@ -0,0 +1,38 @@ +/** + * Signal class implementation for `MutatorAPI`'s `OnModifyLogin` signal. + * Copyright 2022 Anton Tarasenko + *------------------------------------------------------------------------------ + * This file is part of Acedia. + * + * Acedia is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License, or + * (at your option) any later version. + * + * Acedia is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Acedia. If not, see . + */ +class Mutator_OnModifyLogin_Signal extends Signal; + +public final function Emit(out string portal, out string options) +{ + local Slot nextSlot; + StartIterating(); + nextSlot = GetNextSlot(); + while (nextSlot != none) + { + Mutator_OnModifyLogin_Slot(nextSlot).connect(portal, options); + nextSlot = GetNextSlot(); + } + CleanEmptySlots(); +} + +defaultproperties +{ + relatedSlotClass = class'Mutator_OnModifyLogin_Slot' +} \ No newline at end of file diff --git a/sources/Unreal/MutatorsAPI/Events/Mutator_OnModifyLogin_Slot.uc b/sources/Unreal/MutatorsAPI/Events/Mutator_OnModifyLogin_Slot.uc new file mode 100644 index 0000000..6d92035 --- /dev/null +++ b/sources/Unreal/MutatorsAPI/Events/Mutator_OnModifyLogin_Slot.uc @@ -0,0 +1,40 @@ +/** + * Slot class implementation for `MutatorAPI`'s `OnModifyLogin` signal. + * Copyright 2022 Anton Tarasenko + *------------------------------------------------------------------------------ + * This file is part of Acedia. + * + * Acedia is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License, or + * (at your option) any later version. + * + * Acedia is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Acedia. If not, see . + */ +class Mutator_OnModifyLogin_Slot extends Slot; + +delegate connect(out string portal, out string options) +{ + DummyCall(); +} + +protected function Constructor() +{ + connect = none; +} + +protected function Finalizer() +{ + super.Finalizer(); + connect = none; +} + +defaultproperties +{ +} \ No newline at end of file diff --git a/sources/Unreal/MutatorsAPI/MutatorAPI.uc b/sources/Unreal/MutatorsAPI/MutatorAPI.uc index 9906ce0..785482e 100644 --- a/sources/Unreal/MutatorsAPI/MutatorAPI.uc +++ b/sources/Unreal/MutatorsAPI/MutatorAPI.uc @@ -1,7 +1,7 @@ /** * Low-level API that provides set of utility methods for working with * `Mutator`s. - * Copyright 2021 Anton Tarasenko + * Copyright 2021 - 2022 Anton Tarasenko *------------------------------------------------------------------------------ * This file is part of Acedia. * @@ -48,8 +48,9 @@ class MutatorAPI extends AcediaObject; * checks and not really used for anything once these checks are complete. * Some [sources] * (https://wiki.beyondunreal.com/Legacy:Chain_Of_Events_At_Level_Startup) - * indicate that it used to omit additional `GameInfo`'s relevancy checks, - * however does not to serve any function in Killing Floor. + * indicate that it is used to omit additional `GameInfo`'s + * relevancy checks, however it does not seem to serve any function in + * Killing Floor. * Mutators might repurpose it for their own uses, but I am not aware of * any that do. * @return `false` if you want `other` to be destroyed and `true` otherwise. @@ -87,6 +88,31 @@ public final function Mutator_OnMutate_Slot OnMutate( return Mutator_OnMutate_Slot(signal.NewSlot(receiver)); } +/** + * Called from the `GameInfo`'s `Login()` function. Allows mutators to change + * any options before the `Login()` function processes them. + * + * [Signature] + * (out string portal, out string options) + * + * @param Portal Likely intended purpose is to indicate which "portal" was + * used to allow player to enter this level, but does not seem to be doing + * much in Killing Floor. + * @param options Options parts of URL that describe players entering + * the server. Example is something like: "?LAN?Class=Engine.Pawn? + * Character=Lieutenant_Masterson?team=1?VAC=1?password=pass?Name=guy". + */ +/* SIGNAL */ +public final function Mutator_OnModifyLogin_Slot OnModifyLogin( + AcediaObject receiver) +{ + local Signal signal; + local UnrealService service; + service = UnrealService(class'UnrealService'.static.Require()); + signal = service.GetSignal(class'Mutator_OnModifyLogin_Signal'); + return Mutator_OnModifyLogin_Slot(signal.NewSlot(receiver)); +} + defaultproperties { } \ No newline at end of file diff --git a/sources/Unreal/UnrealService.uc b/sources/Unreal/UnrealService.uc index 473f4a4..24e53f1 100644 --- a/sources/Unreal/UnrealService.uc +++ b/sources/Unreal/UnrealService.uc @@ -119,4 +119,5 @@ defaultproperties serviceSignals(10) = (signalClass=class'Broadcast_OnHandleTextFor_Signal') serviceSignals(11) = (signalClass=class'Mutator_OnCheckReplacement_Signal') serviceSignals(12) = (signalClass=class'Mutator_OnMutate_Signal') + serviceSignals(13) = (signalClass=class'Mutator_OnModifyLogin_Signal') } \ No newline at end of file