-
Notifications
You must be signed in to change notification settings - Fork 157
Upgrading
Periodically, the supporting library may require breaking changes to be made in order to improve it. When that occurs, an upgrade path will be created, and I'll put notes here detailing what's required to upgrade from one version to the next.
This is the original revision.
August 2014
This is the first revision with an upgrade path.
The library was rebuilt to make use of the new Modes class library for handling state variables.
The Modes class allows consistent management of state variables of various types (list, boolean, string), such that it no longer requires separate variables for tracking lists of option, doesn't require the user perform math directly in their code in order to determine what new value they take, and other niceties to generally make the code cleaner and nicer to deal with.
In doing so, however, any previous use of these state variables would completely break the code. Thus, an upgrade is needed.
Necessary steps to upgrade your code:
If you have your gear set up in a sidecar file, just download a new copy of the job file from the dev branch (for now; will eventually merge to the master branch) of the repository. Then re-copy the user_setup()
function to the sidecar, and adjust to taste.
If you have not yet created sidecar files for your gear, you can do so beforehand to make this simpler.
Copy all job files from the data/<username>
directory to a new data/<username>/gear
directory. Delete all functions from those new files except for init_gear_sets()
. After that, download the new job files from the repository (as instructed above) into the data/<username>
directory (overwriting the old versions).
After that, you can copy the user_setup()
function from the main job files to the sidecar files if you wish to tweak any of the values used in there.
- Add a variable called
mote_include_version
to theget_sets
function, before including the Mote-Include file. Setmote_include_version = 2
, as that is the new version number, and this lets the library know which version of the include to load. - In the
user_setup
function, where all theoptions
lists are defined (this applies to both the main job lua, and the sidecar override), replace them in this manner:
options.OffenseModes = {'Normal', 'Acc'}
becomes
state.OffenseMode:options('Normal', 'Acc')
- Remove any old
state.Defense.PhysicalMode = 'PDT'
type lines inuser_setup
that simply set up the default state value to match theoptions
list that was used. The new version of options automatically assigns the first value of a list as the default. - Any place you assign a value to a state variable in your rules code should be changed to something like the following, depending on how you were using it:
state.OffenseMode:set('Acc')
state.OffenseMode:reset()
state.OffenseMode:reset()
will set it to whatever the default value is (ie: the first value in the list).
- Any string state variables (
state.CombatForm
,state.CombatWeapon
, etc) cannot be assigned to directly. They must use the:set()
function, like so:
state.CombatWeapon:set('Dagger')
state.CombatForm:set('DW')
- Any string variables that need to get blanked, or get set to nil, need to use the
:reset()
function.
state.CombatForm:reset()
-
state.DefenseMode
andoptions.DefenseModes
have been changed tostate.HybridMode
, to better distinguish the purpose of this field from the full defense mode states. -
For any use of
job_state_change(stateField, new, old)
, thestateField
value now uses the mode variable description by default. Sostate.OffenseMode
, which has a description of 'Offense Mode', would pass astateField
parameter value of 'Offense Mode', not 'OffenseMode'.