Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement quest towns and buildings in terms of extended data instead of putting them in separate places #216

Open
Ruin0x11 opened this issue Mar 13, 2021 · 0 comments
Labels
design Concerns the architecture of the engine modding Concerns new modding features beyond the scope of porting vanilla's codebase. standardization Concerns conventions that should be strongly followed in mods

Comments

@Ruin0x11
Copy link
Owner

Ruin0x11 commented Mar 13, 2021

Having lots of state in random places is bad when you end up removing whole areas, because you need extra logic to deal with the cleanup of that state so invalid areas don't get referenced. Building.remove_for_area() ought to be unnecessary, because there should be no easy way for the building to get out of sync with the liveness of the area if it's deleted.

The implicit thing that's being modeled with registered quest towns and buildings is that they carry some extra "metadata" that is linked to an area/map, but isn't part of the schema of either. I'm wary of just making them official fields of InstancedArea/InstancedMap, because applying that methodology to modding doesn't scale. The problem is: if you want to have some extra information saved about a map or area that's not part of the base game, you have to put it somewhere, and at present there isn't a way you can put it in the map/area instance itself in a standardized way, so you have to keep the state outside of the instance. But that means the state can get out of sync if the map/area is deleted.

So I think that there needs to be a standardized way to extend maps and areas with new data. There's ModExtData but it's pretty unstructured at the moment. There's no separation of concerns; each mod would get its own global namespace to put whatever it wants there. The best I can come up with right now is the capabilities system mentioned in #15 (comment). But assuming that works, it would mean the data would be stored on the instance itself and would get cleaned up automatically when the area/map is deleted, so long as there isn't any other bookkeeping going on. Getting the list of buildings would then mean iterating the list of areas and filtering on the ones where area:has_capability(IBuilding) are true.

@Ruin0x11 Ruin0x11 added design Concerns the architecture of the engine standardization Concerns conventions that should be strongly followed in mods modding Concerns new modding features beyond the scope of porting vanilla's codebase. labels Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Concerns the architecture of the engine modding Concerns new modding features beyond the scope of porting vanilla's codebase. standardization Concerns conventions that should be strongly followed in mods
Projects
None yet
Development

No branches or pull requests

1 participant