From 47e96a56466087752fda7dca0650367b95810441 Mon Sep 17 00:00:00 2001 From: Distortions81 Date: Fri, 22 Dec 2023 18:54:35 -0700 Subject: [PATCH] regulars-only mode --- cfg/lcfg.go | 1 + constants/consts.go | 3 ++- fact/factConfGen.go | 12 ++++++++++-- fact/factUtils.go | 10 ++++++++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/cfg/lcfg.go b/cfg/lcfg.go index b1a9672e..c57cc334 100644 --- a/cfg/lcfg.go +++ b/cfg/lcfg.go @@ -61,6 +61,7 @@ type localOptions struct { ExpUpdates bool HideAutosaves bool HideResearch bool + RegularsOnly bool Whitelist bool CustomWhitelist bool ModUpdate bool diff --git a/constants/consts.go b/constants/consts.go index 2dee2b47..50bef029 100755 --- a/constants/consts.go +++ b/constants/consts.go @@ -3,7 +3,7 @@ package constants import "time" const ( - Version = "2609-12.21.2023-0258p" + Version = "2610-12.22.2023-0654p" CWEpoch = 1653239822390688174 SeenDivisor = 60 SeenEpoch = 1546326000 @@ -24,6 +24,7 @@ const ( RoleListFile = "../RoleList.dat" VoteFile = "votes.dat" MembersPrefix = "M" + RegularsPrefix = "R" ArchiveFolderSuffix = " maps" TempSaveName = "softmod.tmp" BootUpdateDelayMin = 2 diff --git a/fact/factConfGen.go b/fact/factConfGen.go index c1a6e8c2..ed2ab923 100755 --- a/fact/factConfGen.go +++ b/fact/factConfGen.go @@ -58,7 +58,11 @@ func GenerateFactorioConfig() bool { var servName string if cfg.Local.Options.Whitelist { - cfg.ServerPrefix = constants.MembersPrefix + if cfg.Local.Options.RegularsOnly { + cfg.ServerPrefix = constants.RegularsPrefix + } else { + cfg.ServerPrefix = constants.MembersPrefix + } servName = "\u0080[" + cfg.Global.GroupName + "-" + cfg.ServerPrefix + "] " + strings.ToUpper(cfg.Local.Callsign) + "-" + cfg.Local.Name } else { @@ -133,7 +137,11 @@ func GenerateFactorioConfig() bool { if cfg.Local.Options.CustomWhitelist { tags = append(tags, "INVITE-ONLY") } else if cfg.Local.Options.Whitelist { - tags = append(tags, "MEMBERS-ONLY") + if cfg.Local.Options.RegularsOnly { + tags = append(tags, "REGULARS-ONLY") + } else { + tags = append(tags, "MEMBERS-ONLY") + } } tags = append(tags, cfg.Global.Paths.URLs.Domain) diff --git a/fact/factUtils.go b/fact/factUtils.go index deb416dc..1639bd8b 100755 --- a/fact/factUtils.go +++ b/fact/factUtils.go @@ -335,8 +335,14 @@ func WriteWhitelist() int { localPlayerList = make([]*glob.PlayerData, len(localPlayerList)) for _, player := range glob.PlayerList { - if player.Level > 0 { - localPlayerList = append(localPlayerList, player) + if cfg.Local.Options.RegularsOnly { + if player.Level > 1 { + localPlayerList = append(localPlayerList, player) + } + } else { + if player.Level > 0 { + localPlayerList = append(localPlayerList, player) + } } }