Skip to content

Commit

Permalink
regulars-only mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Distortions81 committed Dec 23, 2023
1 parent 3636b2a commit 47e96a5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions cfg/lcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type localOptions struct {
ExpUpdates bool
HideAutosaves bool
HideResearch bool
RegularsOnly bool
Whitelist bool
CustomWhitelist bool
ModUpdate bool
Expand Down
3 changes: 2 additions & 1 deletion constants/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,6 +24,7 @@ const (
RoleListFile = "../RoleList.dat"
VoteFile = "votes.dat"
MembersPrefix = "M"
RegularsPrefix = "R"
ArchiveFolderSuffix = " maps"
TempSaveName = "softmod.tmp"
BootUpdateDelayMin = 2
Expand Down
12 changes: 10 additions & 2 deletions fact/factConfGen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)

Expand Down
10 changes: 8 additions & 2 deletions fact/factUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

Expand Down

0 comments on commit 47e96a5

Please sign in to comment.