Den Original™ Player Requirements System#78
Draft
portfiend wants to merge 4 commits intoTheDenSS14:masterfrom
Draft
Den Original™ Player Requirements System#78portfiend wants to merge 4 commits intoTheDenSS14:masterfrom
portfiend wants to merge 4 commits intoTheDenSS14:masterfrom
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
About the PR
This PR basically rewrites WizDen's
JobRequirementsto be cleaner, readable, and more flexible. This is drawing a lot from my prebase refactor work on CharacterRequirements.Why / Balance
We used that requirement system A LOT, and my refactors to the prebase system made it pretty easy to add new requirements. In addition, this system should make it possible to run requirements through tests, as making all parameters of the requirements optional means that we can skip over irrelevant requirements.
This is needed for traits and loadouts etc.
Technical details
IPlayerRequirementis a new interface for defining a "player requirement".IPlayerRequirements all have the following fields and methods:bool Inverted: Whether or not this requirement should be inverted. Fails become passes and vice versa.bool MustPassPreCheck: If a context fails the pre-check, normally it would count as an auto-pass so that the requirement gets "ignored" in checks. If this is enabled, instead, requirements that fail pre-checking will auto-fail.bool PreCheck(PlayerRequirementContext context): This method checks a context to make sure all required fields are non-null.bool CheckRequirement(PlayerRequirementContext context): Performs the actual requirement check.string? GetReason(PlayerRequirementContext context): Produces a "reason string" for a requirement. Notice how this logic is now decoupled from requirement checking!PlayerRequirementContextis a new record definition that stores "contextual data" on the player that is being checked, like their current playtimes or selected character. All fields are nullable; null fields are "optional" and ignored in checks (at least, depending onMustPassPreCheck).Media
TBA
Requirements
Licensing
Breaking changes
Changelog