diff --git a/MskGs/Classes/MskGsMut.uc b/MskGs/Classes/MskGsMut.uc index 6e5282c..f266fe8 100644 --- a/MskGs/Classes/MskGsMut.uc +++ b/MskGs/Classes/MskGsMut.uc @@ -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 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)); @@ -26,6 +37,30 @@ function Initialize() MyKFGI.KFGFxManagerClass = class'MskGsGFxMoviePlayer_Manager'; 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 } diff --git a/MskGs/Classes/MskGsVoteCollector.uc b/MskGs/Classes/MskGsVoteCollector.uc index 4645ab1..c12a7a5 100644 --- a/MskGs/Classes/MskGsVoteCollector.uc +++ b/MskGs/Classes/MskGsVoteCollector.uc @@ -1,6 +1,6 @@ class MskGsVoteCollector extends KFVoteCollector; -var private const array ImportantPersonList; +var public array ImportantPersonList; var private array PunishList; function ServerStartPunishment() @@ -36,15 +36,15 @@ 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); SetTimer(2.0f, false, 'ServerStartPunishment', self); } @@ -235,7 +235,4 @@ function int GetNextMap() DefaultProperties { - ImportantPersonList.Add("0x0110000103143A23") // Spazm* - ImportantPersonList.Add("0x011000010276FBCB") // GenZmeY - ImportantPersonList.Add("0x011000010F661D88") // Janis } diff --git a/make.sh b/make.sh index d9f10e7..59d3221 100644 --- a/make.sh +++ b/make.sh @@ -159,7 +159,7 @@ echo "Map=\"KF-Outpost\" Game=\"KFGameContent.KFGameInfo_Survival\" Difficulty=\"0\" GameLength=\"0\" -Mutators=\"TAWOD.TAWODMut\" +Mutators=\"MskGs.MskGsMut\" Args=\"\"" > "$MutTestingIni" }