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

Better ter/furn copy-from support #73211

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

Procyonae
Copy link
Contributor

@Procyonae Procyonae commented Apr 23, 2024

Summary

Infrastructure "Better ter/furn copy from support, remove legacy alias code"

Purpose of change

copy-from good
Fixes #54702

Describe the solution

Requires #73268 to save me touching No Hope mapgen for no reason
Requires #73415 because I decided it was better to make it a seperate PR

More copy-from support:
"symbol" supports copy-from
TRANSPARENT flag inherits correctly
"flags" support extend/delete
"connect_groups", "connects_to" and "rotates_to" support copy-from

Removes remaining redundant aliases and alias code
Removes LINE_OXOX and LINE_XOXO handling replacing it with better generic unicode character handling. Currently changes symbols to what they were already using but when I add abstracts I'll probably make most walls # instead.
Removes legacy connects_to/rotates_to flag support.

Will attempt to ensure you can overwrite "bash"'s, "deconstruct"'s and "pry"'s "ter_set"/"result" without redefining the other values for stuff like doors where that's the main difference while allowing ie "bash": { } to correctly default all the fields inherited.
May add tests to check stuff like the above works.
Will likely update inheritance docs Nvm I forgot how atrocious our existing inheritance docs were for a moment

Was originally going to add abstract terrains/furniture to cut alot of json bloat but I'll now do that in future PRs

May remove legacy connects_to/rotates_to flag support if applying the necessary JSON changes in this PR isn't too much otherwise I'll leave it till after the follow-up PRs adding copy-from to alot of existing ter/furn
Will add abstract versions of basic terrain (probably just walls/windows/doors/floors/roofs for now)
Moves painted walls to their own file bc they were taking up half the file
Corrects several discrepancies between similar terrains

Describe alternatives you've considered

Testing

Additional context

I'd still like to make paint metadata instead of needing to have individual terrains/furniture but the save/load side of things isn't easy

NTS: Check using copy-from with an id of the wrong type (ter with furn or vice versa) throws an error. (While this could theoretically be supported I don't think it would be a good idea)

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. <Bugfix> This is a fix for a bug (or closes open issue) Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Apr 23, 2024
@PatrikLundell
Copy link
Contributor

What do you mean by paint meta data? My interest stems from the issue of "terrain" completely overwriting information about the actual terrain, and thus making it impossible to restore the actual terrain when the "terrain" is removed (you have to hard code some best guess).
By the way, if you find some way to associate paint info to terrain, I assume the logic would also apply to carpets?

@Procyonae
Copy link
Contributor Author

Procyonae commented Apr 24, 2024

Basically I have a local branch that makes it so piant can be applied to any terrain with a PAINTABLE flag (and consequently removed by a chipper still) without changing the id of the terrain itself, just the visual stuff it displays. For mapgen I think I'm looking at doing it as a "colour": { "!": [ "blue" ] } type thing but autogenerated ids might make sense too (so t_not_painted_blue). I just haven't looked into how to add a new field to track it in savefiles yet and am mildly scared of breaking everyone's saves.
I also needed
It's been a minute since I looked at it but I imagine making it handle furniture too wouldn't be that bad it'd just need to prompt you in the case of both a PAINTABLE terrain and furniture on one tile.
Idk how carpets should be handled tho.

@I-am-Erk
Copy link
Contributor

Can we also inherit colour? I see no reason to have to repeat it every time.

@Procyonae
Copy link
Contributor Author

Can we also inherit colour? I see no reason to have to repeat it every time.

Yes?

@Procyonae
Copy link
Contributor Author

Procyonae commented Apr 26, 2024

Ok going through all our ter/furn in this PR is enormous scope creep I think I'll dial this back to just C++ and removing redundant JSON stuff and do abstract/copy-from stuff in seperate follow-up PRs

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. [Markdown] Markdown issues and PRs labels Apr 30, 2024
@github-actions github-actions bot added Mods Issues related to mods or modding Bionics CBM (Compact Bionic Modules) labels Apr 30, 2024
@github-actions github-actions bot added Monsters Monsters both friendly and unfriendly. Mods: Magiclysm Anything to do with the Magiclysm mod Mods: Aftershock Anything to do with the Aftershock mod Mods: Dinomod Anything to do with the Dinoclysm mod (DinoMod) Mods: No Hope Relating to the mod No Hope Game: Defense Mode Special game mode, only accessible via main menu Mods: TropiCataclysm 🌴 Having to do with the tropical region mod for DDA. Mods: Xedra Evolved Anything to do with Xedra Evolved Mods: Mind Over Matter Mods: Sky Island Anything about the Sky Island mod labels Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions Bionics CBM (Compact Bionic Modules) <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Documentation> Design documents, internal info, guides and help. Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Game: Defense Mode Special game mode, only accessible via main menu [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display [Markdown] Markdown issues and PRs Mods: Aftershock Anything to do with the Aftershock mod Mods: Dinomod Anything to do with the Dinoclysm mod (DinoMod) Mods: Magiclysm Anything to do with the Magiclysm mod Mods: Mind Over Matter Mods: No Hope Relating to the mod No Hope Mods: Sky Island Anything about the Sky Island mod Mods: TropiCataclysm 🌴 Having to do with the tropical region mod for DDA. Mods: Xedra Evolved Anything to do with Xedra Evolved Mods Issues related to mods or modding Monsters Monsters both friendly and unfriendly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inheritance bug
3 participants