config for important persons

This commit is contained in:
GenZmeY 2021-02-26 02:55:43 +03:00
parent cb6a0e28c3
commit 9a0163491c
3 changed files with 44 additions and 10 deletions

View File

@ -1,4 +1,10 @@
Class MskGsMut extends KFMutator;
Class MskGsMut extends KFMutator
config(MskGs);
var const int SteamIDLen;
var const int UniqueIDLen;
var config array<string> ImportantPersonList;
simulated event PostBeginPlay()
{
@ -17,6 +23,11 @@ simulated event PostBeginPlay()
function Initialize()
{
local MskGsVoteCollector VoteCollector;
local OnlineSubsystem steamworks;
local string Person;
local UniqueNetId PersonUID;
if (MyKFGI == None || MyKFGI.MyKFGRI == None)
{
SetTimer(2.f, false, nameof(Initialize));
@ -27,6 +38,30 @@ function Initialize()
MyKFGI.MyKFGRI.VoteCollectorClass = class'MskGsVoteCollector';
MyKFGI.MyKFGRI.PostBeginPlay();
steamworks = class'GameEngine'.static.GetOnlineSubsystem();
VoteCollector = MskGsVoteCollector(MyKFGI.MyKFGRI.VoteCollector);
if (VoteCollector == None)
{
`Log("[MskGsMut] ERROR: VoteCollector is None!");
return;
}
foreach ImportantPersonList(Person)
{
if (Len(Person) == UniqueIDLen && steamworks.StringToUniqueNetId(Person, PersonUID))
{
if (VoteCollector.ImportantPersonList.Find('Uid', PersonUID.Uid) == -1)
VoteCollector.ImportantPersonList.AddItem(PersonUID);
}
else if (Len(Person) == SteamIDLen && steamworks.Int64ToUniqueNetId(Person, PersonUID))
{
if (VoteCollector.ImportantPersonList.Find('Uid', PersonUID.Uid) == -1)
VoteCollector.ImportantPersonList.AddItem(PersonUID);
}
else `Log("[MskGsMut] WARN: Can't add person:"@Person);
}
`Log("[MskGsMut] Mutator loaded.");
}
@ -43,4 +78,6 @@ function AddMutator(Mutator Mut)
defaultproperties
{
SteamIDLen=17
UniqueIDLen=18
}

View File

@ -1,6 +1,6 @@
class MskGsVoteCollector extends KFVoteCollector;
var private const array<string> ImportantPersonList;
var public array<UniqueNetId> ImportantPersonList;
var private array<KFPlayerController> PunishList;
function ServerStartPunishment()
@ -37,12 +37,12 @@ function bool ImportantKickee(PlayerReplicationInfo PRI_Kickee, PlayerReplicatio
local string PunishMessage;
local KFPlayerController KFPC_Kicker;
if (ImportantPersonList.Find(class'OnlineSubsystem'.Static.UniqueNetIdToString(PRI_Kickee.UniqueId)) != -1)
if (ImportantPersonList.Find('Uid', PRI_Kickee.UniqueId.Uid) != -1)
{
KFPC_Kicker = KFPlayerController(PRI_Kicker.Owner);
if (PunishList.Find(KFPC_Kicker) == -1)
{
PunishMessage = PRI_Kicker.PlayerName@"tried to kick"@PRI_Kickee.PlayerName@", but sat down on the bottle instead (^_^)";
PunishMessage = PRI_Kicker.PlayerName@"tried to kick"@PRI_Kickee.PlayerName@", but sat down on the bottle instead.";
WorldInfo.Game.Broadcast(KFPC_Kicker, PunishMessage);
PunishList.AddItem(KFPC_Kicker);
@ -235,7 +235,4 @@ function int GetNextMap()
DefaultProperties
{
ImportantPersonList.Add("0x0110000103143A23") // Spazm*
ImportantPersonList.Add("0x011000010276FBCB") // GenZmeY
ImportantPersonList.Add("0x011000010F661D88") // Janis
}

View File

@ -159,7 +159,7 @@ echo "Map=\"KF-Outpost\"
Game=\"KFGameContent.KFGameInfo_Survival\"
Difficulty=\"0\"
GameLength=\"0\"
Mutators=\"TAWOD.TAWODMut\"
Mutators=\"MskGs.MskGsMut\"
Args=\"\"" > "$MutTestingIni"
}