Skip to content

New Relic registration methods #17

Closed as not planned
Closed as not planned
@TacoConKvass

Description

@TacoConKvass

What is the addition?

New ways of registrating Relics from JSON files, to be more aligned to vanilla.

Why?

We might want to encourage mods to be more data driven, storing data in external JSON files instead of all in code.

Example of the usage

string path = "...";
string json = File.ReadAllText(path);

int ID_1 = Relics.RegisterRelicFromJson(json);
// OR
int ID_2 = Relics.RegisterRelicFromJson(path);

We might also consider autoloading all Relics from enabled mods, by searching for files ending with our specific file extension, such as .rl2relic.json or .rl2relic. The issue with this is that there would be no way to disable loading them under some condition. Would also require enforcing the

Note

Texture file name must be the same as the Relic JSON file name

rule, or providing optional parameters, one overload for providing paths, and one for Texture2D objects like this

int ID_1 = Relics.RegisterRelicFromJson(json, textureSmall, textureBig);
// OR
int ID_2 = Relics.RegisterRelicFromJson(path, textureSmallPath, textureBigPath);

Notes

Obsoletes loading RelicData from JSON proposed in #15

Metadata

Metadata

Assignees

Labels

additionAddition suggestionquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions