-
Notifications
You must be signed in to change notification settings - Fork 9
[IMP Port] Visitor Specific Species #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
ddf8ee8
bfc2242
21a829c
68e179e
25a7d8e
097b552
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,6 +105,21 @@ public sealed partial class SpeciesPrototype : IPrototype | |
| /// </summary> | ||
| [DataField] | ||
| public int MaxAge = 120; | ||
|
|
||
| // MACRO start | ||
| /// <summary> | ||
| /// Whether or not the species is available for randomization. | ||
| /// </summary> | ||
| [DataField] | ||
| public bool RandomViable { get; private set; } | ||
|
Comment on lines
+110
to
+114
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. name of this bool is kind of vague. what does 'randomization' mean in this context? |
||
|
|
||
| /// <summary> | ||
| /// When a random species is picked, verify random float is lower than this number | ||
| /// if not, don't pick the species | ||
| /// </summary> | ||
| [DataField] | ||
| public float RandomChance { get; private set; } = 1f; | ||
| // MACRO end | ||
| } | ||
|
|
||
| public enum SpeciesNaming : byte | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -214,19 +214,29 @@ public static HumanoidCharacterProfile DefaultWithSpecies(ProtoId<SpeciesPrototy | |||||
| } | ||||||
|
|
||||||
| // TODO: This should eventually not be a visual change only. | ||||||
| public static HumanoidCharacterProfile Random(HashSet<string>? ignoredSpecies = null) | ||||||
| // MACRO start, extensive changes. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move to line 224 |
||||||
| public static HumanoidCharacterProfile Random(HashSet<string>? speciesBlacklist = null, bool? characterCreation = true) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| { | ||||||
| var prototypeManager = IoCManager.Resolve<IPrototypeManager>(); | ||||||
| var random = IoCManager.Resolve<IRobustRandom>(); | ||||||
|
|
||||||
| var species = random.Pick(prototypeManager | ||||||
| .EnumeratePrototypes<SpeciesPrototype>() | ||||||
| .Where(x => ignoredSpecies == null ? x.RoundStart : x.RoundStart && !ignoredSpecies.Contains(x.ID)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment out instead of deleting |
||||||
| .Where(x => | ||||||
| { | ||||||
| if (speciesBlacklist != null && speciesBlacklist.Contains(x.ID)) | ||||||
| return false; | ||||||
| if (characterCreation == true) | ||||||
| return x.RoundStart; | ||||||
| return random.NextFloat() < x.RandomChance && x.RandomViable; | ||||||
| }) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. macro end here |
||||||
| .ToArray() | ||||||
| ).ID; | ||||||
| ) | ||||||
| .ID; | ||||||
|
Comment on lines
+234
to
+235
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revert |
||||||
|
|
||||||
| return RandomWithSpecies(species); | ||||||
| } | ||||||
| // MACRO end | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete |
||||||
|
|
||||||
| public static HumanoidCharacterProfile RandomWithSpecies(string? species = null) | ||||||
| { | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.