The system you're trying to understand is called Chain.
Simply, GameInfo contains the variable pointing to the first mutator which registered, this mutator contains a variable pointing to the second mutator which registered and so on...
Why do we need this chain? whatever class you make, you know for sure that all the mutators that registered are registered into that variable into GameInfo. It's just a way to standardize, organize and optimize the code making it more readable. Indeed, if you wouldn't have this chain, every class would need to use its own method to look for a mutator, like using a foreach etc...
You can see all the functions that call mutator's callback functions, call the callback from within the first mutator in GameInfo, that's cause all the mutator's callbacks, call the same callbacks from within the next mutator and so on.
Same happens to the Inventory. It doesn't happen to the TournamentPickup's when they are used as TournamentWeapon's Affector, indeed it leads to a bug. Look at this code from within ClientFire() function in TournamentWeapon.uc:
Code: Select all
if ( Affector != None )
Affector.FireEffect();
Affector is a TournamentPickup, for example an Amplifier. Now, this is the function FIreEffect() from within TournamentPickup:
Look at the difference with mutator's functions code, for example the function Mutate():
Code: Select all
function Mutate(string MutateString, PlayerPawn Sender)
{
if ( NextMutator != None )
NextMutator.Mutate(MutateString, Sender);
}
Do you see the difference? If you extend Mutator class, if you need the Mutate() function, you can just type super.Mutate(MutateString, Sender), and it would call the above code, calling the same function from within the NextMutator and so on, but look at the TournamentPickup code (remember TournamentPickup is an Actor and Actor has a variable pointing to the next Inventory), let's suppose you extend the class TournamentPickup and need the FireEffect() function, can you do the same that you would do for the mutator? No, you would need to handle the chain directly writing code in your class, and everyone that would extend TournamentPickup would need to do it. Thing that no one did, so for example, if you pickup 2 Amplifier they won't work properly.