orffen / basicfantasyrpg

The Basic Fantasy RPG system for FoundryVTT!
Other
10 stars 8 forks source link

Rename "BASICFANTASYRPG.SpecialAbility" #59

Closed orffen closed 11 months ago

orffen commented 11 months ago

Rename the 'monster' type Actor specialAbility to specialAbilityBonus.

All references will need to be updated as a result.

In en.json, we also have some translation strings which need to be changed:

However we need a migration path to update all existing 'monster' type Actors in the world and also in compendiums (this is also needed to update @Stew-rt's compendiums).

I think this will need to be performed as part of Document.migrateSystemData(). Something along the lines of:

game.actors.forEach(actor => { actor.system.specialAbilityBonus = foundry.utils.deepClone(actor.system.specialAbility) };
orffen commented 11 months ago

I'm not sure if this is entirely necessary; it's really just for consistency and any future translations. I came across this when I was going to use {{localize BASICFANTASYRPG.SpecialAbility}} and realised that string says "Special Abilities" instead of what I expected.

However, developing migration scripts is probably a good idea - eventually we'll make a change to the system that will need to handle pre-existing objects.

orffen commented 11 months ago

Actually I need to figure this out as part of the r13 planned release; I'm making a change to Special Abilities which would allow them to be toggled as roll under/roll over; all pre-existing abilities then need to be set by default to rollUnder: true; since this will be a new field.

orffen commented 11 months ago

In actor.mjs within _prepareMonsterData(), something like:

// Migration code to handle label rename
if (data.specialAbility.label === 'BASICFANTASYRPG.SpecialAbility')
  data.specialAbility.label = 'BASICFANTASYRPG.SpecialAbilityBonus';
orffen commented 11 months ago

This hack would work I think in the short-term; longer term we should move to a system data model instead.