Allow aspect settings to be determined by variables - #1707
Open
rubensworks wants to merge 1 commit into
Open
Conversation
Every aspect setting now has an optional variable slot in the aspect settings gui, similar to the variable slots of the part offset gui. When a variable is present, its value overrides the statically configured value of that setting. Closes CyclopsMC/IntegratedTunnels#278 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEB2eDBd8VaFgqeJRwaSyk
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.
Closes CyclopsMC/IntegratedTunnels#278
Aspect settings (aspect properties) could only hold static values before.
Every aspect setting now gets an optional variable slot in the aspect settings gui, just like the variable slots that the part offset gui got.
When a variable is present in that slot, its value overrides the statically configured value of that setting.
This is generic over all aspect properties, so add-ons such as IntegratedTunnels get it for free for their settings (channel, slot, exact match, ...).
Gui
</>buttons, only the slot of the setting that is currently being configured is visible; the gui informs the server which setting is active throughAbstractContainerMenu#clickMenuButton.Behaviour
aspectVariables_<aspect name>) inside the part state, so they are persisted with the part and dropped when the part is broken.PartStateAspectVariablesHandlerevaluates them on each part update tick and reloads a slot when its variable is invalidated, mirroringPartStateOffsetHandler.API
All additive, with defaults, so existing implementations keep working:
IAspect#getStaticProperties: the configured properties without variable-driven overrides.IAspect#getPropertiesnow returns the variable-driven values where present.IPartState#updateAspectVariables,#markAspectVariablesChanged,#markAspectPropertiesChanged,#getAspectVariableError,#getAspectPropertiesVariableDrivenIPartType#onAspectVariablesChangedIPartState#loadInventoryNamednow bounds-checks against the target inventory size, so a shrunken property list can not cause an out-of-bounds crash.Tests
New
GameTestsAspectVariablescovers:./gradlew buildand./gradlew runGameTestServer(907 tests) pass.Note on an existing test helper
GameTestHelpersIntegratedDynamics#setAspectPropertymutated the aspect's shared default properties object whenever a part had no properties stored yet, which leaked configuration across game tests. It now clones instead. Two redstone pulse tests relied on that leak and set their pulse length on the wrong part/aspect; they now set it on the writer part itself.Generated by Claude Code