Mutator pattern Mutator pattern Consider the minimal template of any mutator: GroupName parameter So, In general, this is already from the commentary to the description of the variable in the Engine.Mutator class it becomes clear tha...
#1
Posted:
Mutator pattern
Consider the minimal template of any mutator:
class TestMut extends Mutator;
defaultproperties
{
GroupName="KF-TestMut"
FriendlyName="TestMut"
Description="Тестовый мутатор. Базовый шаблон"
}
GroupName parameter
So, In general, this is already from the commentary to the description of the variable in the Engine.Mutator class
var() cache string GroupName; // Will only allow one mutator with this tag to be selected.
it becomes clear that this variable is used to provide the ability to block the addition of mutators of the same group. If you wish, you can also look at the implementation of this mechanism in Engine.GameInfo.AddMutator - I won’t copy the code here, those who are curious will have a look for themselves, others don’t need it)
Usage: 1. Insurance against adding mutators that implement the same thing (or ideologically similar things) 2. Insurance against adding conflicting mutators 3. I’ve never used this much - I’m looking for ideas from you on how to use it
Important Note: KF has a page for adding mutators to the game - KFGui.KFMutatorPage And if we look closely at the SetCurrentGame function, we will see the following code:
// ...
for (i = 0; i < MutatorList.Length; i++)
{
if (Left(MutatorList[i].GroupName, 2) == "KF")
lb_Avail.List.Add(MutatorList[i].FriendlyName,, MutatorList[i].Description);
}
Which means that in the list of available mutators only GroupName mutators whose beginning with “KF” will be displayed Therefore, do not forget to write GroupName=“KFwhattotam” if you want your mutator to be available in this menu Common approach: GroupName = “KF-MutatorName”
FriendlyName parameter
Well, everything seems to be simple here - this is the name of the mutator, which is displayed in the mutator selection window. The name of the variable hints at friendliness. There is the concept of a friendly user interface. So it is here - the mutator class itself can be named in any indecipherable way, but in this variable it is worth writing a concise and understandable name, ideally so that even the Description is not needed for the average player.
You can write the name of the mutator in Cyrillic (just don’t forget to switch to Little Endian encoding), for example
FriendlyName="Тестовый мутатор"
Moreover, you can color the name of the mutator if you really don’t mind doing it) The generally accepted method of “coloring” for anrial is described here, for example. Let’s make the word “Test” red and “mutator” green.
You can use the ServerColor program, but I will use the HEX editor (I love the Hex Editor Neo). So, I won’t take pure colors, but just those that I liked.
The prefix for red is 1B D1 60 60 The prefix for green is 1B 3D B7 74 Let’s put these values into the HEX editor and get C“ for red and =·t for green.
FriendlyName="С``Тестовый =·tмутатор"
Parameter Description
This is a description of the mutator. Again, you can do it in Russian and in color. Let’s make it blue Prefix: X“P
Description="X“ПТестовый мутатор. Базовый шаблон"
Result
As a result, we got the following mutator:
class TestMut extends Mutator;
defaultproperties
{
GroupName="KF-TestMut"
FriendlyName="С``Тестовый =·tмутатор"
Description="X“ПТестовый мутатор. Базовый шаблон"
}
![[Image: Bs4cx3u.png]](http://i.imgur.com/Bs4cx3u.png)
Author of the article: Team 2/5