Skip to content
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

Add backwards compatibility scripts #38

Open
twanvl opened this issue May 15, 2020 · 0 comments
Open

Add backwards compatibility scripts #38

twanvl opened this issue May 15, 2020 · 0 comments
Labels
enhancement New feature or request proposal A propsal for a larger change, affecting internal data structures

Comments

@twanvl
Copy link
Owner

twanvl commented May 15, 2020

Currently templates have to try hard to maintain backwards compatibility. They can't remove fields or rename choices. A solution would be to allow a template to define scripts to use when a set made with an earlier version of mse or an earlier version of the template is imported.

It might look something like this:

compatibility:
    before game version: 2020-01-01
    # card fields that no longer exist or have otherwise changed
    old card field:
        name: ability1
        type: text
    # how to calculate values in this template from the old ones
    # these scripts are run once when an old set is loaded
    # can refer to both 'old' and new fields
    card field:
        name: ability_1
        script: old_card.ability1
    set field:
        name: frames
        script: if set.frames == "old choice" then "new choice" else set.frames
  • Multiple compatibility blocks can be defined for different versions. All that apply are ran, from old to new version.
  • Currently MSE doesn't store the game/stylesheet versions in set files. That is a first step to making this work.
@twanvl twanvl added the enhancement New feature or request label May 15, 2020
@twanvl twanvl added the proposal A propsal for a larger change, affecting internal data structures label May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request proposal A propsal for a larger change, affecting internal data structures
Projects
None yet
Development

No branches or pull requests

1 participant