It would be pretty nice if it were possible to define variants in JSON files, making variants super portable.
Actually for most of the fields it's trivial, but there are some exceptions.
Firstly, piece types called with the fromBetza (i.e. almost all of them) constructor, though that isn't too bad, we just check for a betza field in the json and vice versa.
The more complex exceptions are those with custom logic callbacks, such as the new actions and promo logic. I see two possible solutions:
allow embedding code in the json file (ugly, maybe risky?)
require registering functions for json export in some way - like when you create an Action, it has an optional id field, which links to some table you can provide to the json import function
It would be pretty nice if it were possible to define variants in JSON files, making variants super portable. Actually for most of the fields it's trivial, but there are some exceptions.
Firstly, piece types called with the
fromBetza
(i.e. almost all of them) constructor, though that isn't too bad, we just check for a betza field in the json and vice versa.The more complex exceptions are those with custom logic callbacks, such as the new actions and promo logic. I see two possible solutions:
Action
, it has an optional id field, which links to some table you can provide to the json import function