Opened 6 years ago

Closed 4 years ago

Last modified 4 years ago

#4801 closed defect (fixed)

Move damage types to json files

Reported by: leper Owned by: Freagarach
Priority: Should Have Milestone: Alpha 24
Component: Simulation Keywords:
Cc: Patch: Phab:D2337

Description

Currently damage type definitions are specified in globalscripts/DamageTypes.js.

The structure of this is quite similar to how we handle Resources (see Resources.js in the same folder).

It would be nice to move the actual damage types to JSON files and load them from there. This would make it easier for modders to add new damage types (eg magic damage).

Since we don't need as many properties for damage types as for resources we should be good with a code, a name (which is currently the same as the code, but translated), and some order property (which is used to sort the damage types, thus allowing to change the display order in the gui).

An extension to this would be changing the schemas (and adjusting the code to deal with that) of all users of damage types (cmpAttack, cmpDamageReceiver, cmpDeathDamage) to allow specifying only a few damage types.

Change History (14)

comment:1 by leper, 6 years ago

It might be a good idea to also create a wiki page similar to ModdingResources once this is done.

comment:2 by elexis, 6 years ago

Milestone: Alpha 23Backlog

comment:3 by donnacha, 6 years ago

Owner: set to donnacha
Status: newassigned

Taking a look at this now.

comment:4 by Imarok, 5 years ago

Component: UI & SimulationSimulation

Move tickets to Simulation as UI & Simulation got some sub components.

comment:5 by Freagarach, 5 years ago

@donnacha, how are you progressing? Otherwise I can take a look at this?

comment:6 by Freagarach, 5 years ago

Milestone: BacklogWork In Progress
Patch: Phab:D1836

comment:7 by Freagarach, 5 years ago

Patch: Phab:D1836Phab:D1936

comment:8 by wraitii, 5 years ago

In 22527:

Easier introduction of new damage types.

rP20203 introduced a DamageTypes.js global script similar to the resources one. However, we never actually need to refer to this script since we can always use the damage types provided by the template/context/object we are looping over/...
There is one exception to this for AI weighting of damage types. However, since damage types are not stored in files, this is strictly equivalent to hardcoding them in the global script and was deemed acceptable.

Patch By: freagarach

Reviewed By: wraitii

Refs #4801 (by invalidating it for now, though such helper files might be useful in the future if damage types require more metadata).

Differential Revision: https://code.wildfiregames.com/D1938

comment:9 by wraitii, 5 years ago

Keywords: simple removed
Milestone: Work In ProgressBacklog
Owner: donnacha removed
Patch: Phab:D1936
Priority: Should HaveIf Time Permits
Status: assignednew

Backlogging again for this is no longer useful following r22527, but might become so again in the future if damage types start requiring metadata (I'm thinking of status effects GUI for example).

comment:10 by elexis, 5 years ago

In 22836:

Remove two GetTemplateDataHelper unused arguments following rP18977 and rP22527, refs #3934, #4801 / D1938.

Reported By: Polakrity

comment:11 by elexis, 5 years ago

Patch: Phab:D1936
Priority: If Time PermitsShould Have

Looks like this is a should-have if we want to store the strings "Hack", "Pierce", ... only once, and if we want the order to be defined, but not defined in the JS code.

comment:12 by Freagarach, 4 years ago

Milestone: BacklogWork In Progress
Owner: set to Freagarach
Patch: Phab:D1936Phab:D2337
Type: enhancementdefect

comment:13 by wraitii, 4 years ago

Resolution: fixed
Status: newclosed

In 23681:

Internationalise Damage Types and Status Effects using (optional) JSON files.

.json files in simulation/data/template/helpers/damage_types and status_effects will be used to internationalise damage types and status effects, as well as share common text.
Fixes the order of damage types being inconsistent.

Add the possibility for i10n xml extractor to set a custom context.

Fixes #4801
Related to D2296.

Featuring work from: Freagarach

Differential Revision: https://code.wildfiregames.com/D2337

comment:14 by elexis, 4 years ago

Milestone: Work In ProgressAlpha 24
Note: See TracTickets for help on using tickets.