Auto-gate reworked jokers from layer membership#412
Merged
Conversation
Wrap SMODS.Joker so that any joker whose full key appears in some layer's reworked_jokers gets a default mp_include attached when none is provided. Joker files no longer need to repeat the is_layer_active(...) check the layer already declared. Bespoke gating still wins (sandbox rotation, extra-credit checks, etc.). Demonstrated on the five standard reworks. j_mp_bloodstone added to standard.reworked_jokers since it was the only standard rework not listed there (silent rework, no UI side effects).
Override SMODS.Joker:register directly instead of wrapping the whole table in a metatable proxy. self.key is already prefixed at register time, so the manual prefix reconstruction goes away too. Same behavior, fewer moving parts. Per smods maintainer's suggestion.
Bloodstone already pulls its PvP proc rolls from a shared sequence (by round + play order), but the sticker tooltip never explained why. Add the localized text so players see that both bloodstones fire on the same hands.
f836cdf to
8bccaf9
Compare
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.
Summary
Layers already declare which jokers they own via
reworked_jokers. So the boilerplate every standard-layer joker was carrying:...is now redundant.
SMODS.Joker:registeris overridden so it consults a reverse index (MP._JOKER_LAYERS) and auto-attaches a defaultmp_includewhen the joker doesn't define one. Bespoke gates win; the override stays out of their way.What changed
MP.Layer(): full joker key → owning layers.SMODS.Joker:registeroverridden to inject a defaultmp_includefor jokers whose key is in the index. By the timeregisterruns, SMODS has already prefixed the key, so lookups are direct (no manual"j_<prefix>_<key>"reconstruction).mp_includeboilerplate.Migration landscape (63 total
mp_includecalls)objects/jokers/standard/*is_layer_active("standard") and LOBBY.codeobjects/jokers/*.lua(top level)LOBBY.code and config.multiplayer_jokers(8); conjoined addsnot is_layer_active("sandbox")objects/jokers/sandbox/*MP.SANDBOX.is_joker_allowed(self.key)joker_mappingsobjects/jokers/sandbox/extra-credit/*error.lua,magnet_sandbox.luaTest plan
mp_includejokers (sandbox, top-level MP, error, magnet_sandbox) unaffected