forked from Nyanotrasen/Nyanotrasen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
522cb3c
commit f60484b
Showing
9 changed files
with
83 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Robust.Shared.Serialization.Manager.Attributes; | ||
|
||
namespace Content.Server.Maps.NameGenerators; | ||
|
||
[ImplicitDataDefinitionForInheritors] | ||
public abstract class GameMapNameGenerator | ||
{ | ||
public abstract string FormatName(string input); | ||
} |
26 changes: 26 additions & 0 deletions
26
Content.Server/Maps/NameGenerators/NanotrasenNameGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using JetBrains.Annotations; | ||
using Robust.Shared.IoC; | ||
using Robust.Shared.Random; | ||
using Robust.Shared.Serialization.Manager.Attributes; | ||
|
||
namespace Content.Server.Maps.NameGenerators; | ||
|
||
[UsedImplicitly] | ||
public class NanotrasenNameGenerator : GameMapNameGenerator | ||
{ | ||
/// <summary> | ||
/// Where the map comes from. Should be a two or three letter code, for example "VG" for Packedstation. | ||
/// </summary> | ||
[DataField("prefixCreator")] public string PrefixCreator = default!; | ||
|
||
private string Prefix => "NT"; | ||
private string[] SuffixCodes => new []{ "LV", "NX", "EV", "QT", "PR" }; | ||
|
||
public override string FormatName(string input) | ||
{ | ||
var random = IoCManager.Resolve<IRobustRandom>(); | ||
|
||
// No way in hell am I writing custom format code just to add nice names. You can live with {0} | ||
return string.Format(input, $"{Prefix}{PrefixCreator}", $"{random.Pick(SuffixCodes)}-{random.Next(0, 999):D3}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters