Skip to content

Refactor riot damage + add 'pre-burnt' generator #80753

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

Merged

Conversation

RenechCDDA
Copy link
Member

@RenechCDDA RenechCDDA commented Apr 28, 2025

Summary

None

Purpose of change

#79943

This PR breaks up the bashing, item moving, and fire-setting into separate standardized functions. It aims to eliminate 'magic numbers' and prepare the code to be loaded from JSON definitions.

Additionally, another generator is added along the same principles. 'Pre-brunt'. This is used to simulate fires having already happened before the player visited, and is intended to largely be a 1:1 replacement for fires for later arrivals.

Describe the solution

#79943

For pre-burnt structures we designate a square, or a circle, or some area, and we say "That had a fire". We replace anything with the WALL flag with a hardcoded terrain, burnt wall or whatever. We replace floors with a similar one. Outside areas get torched into dirt. Delete all furniture and items in the affected area, litter some ash piles.

The current implementation simply burns the entire OMT, without trying to make any fun shapes.

Describe alternatives you've considered

Testing

(Taken during development, floors were not properly burned. They are burned now, and look like t_dirtfloor)
image

Additional context

Ugh git makes a really awful looking diff for this.

@github-actions github-actions bot added Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions and removed astyled astyled PR, label is assigned by github actions labels Apr 28, 2025
@RenechCDDA RenechCDDA force-pushed the break_up_riot_damage_functions branch from 260440e to f7aa2be Compare April 29, 2025 13:45
@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. astyled astyled PR, label is assigned by github actions labels Apr 29, 2025
@RenechCDDA RenechCDDA force-pushed the break_up_riot_damage_functions branch from f7aa2be to c90c11c Compare April 29, 2025 14:02
@RenechCDDA RenechCDDA marked this pull request as ready for review April 29, 2025 14:08
@RenechCDDA
Copy link
Member Author

RenechCDDA commented Apr 29, 2025

Known issues:

The blood generators will run on some of the OMTs that get pre-burned. This results in burned buildings with bloodstains in them, which looks weird. This might be resolvable with cleanup code to remove all existing fields, but I'm not sure that's a good idea.

Roofs are unaffected by the burning, which can look odd from a z-level up. Not sure what I'm going to do about that, just replacing all roofs with a burnt roof isn't very interesting.

As previously mentioned, but I must point out again: This burns the entire square OMT to the ground, at roughly the same rate as previous fire prevalence. The squareness can look weird. Yes it all can look weird.

The blood generators were not broken up in this PR. They use a ton of magic numbers and untangling them is going to be a pain. (No offense to quill, I'm just less familiar with it as I didn't write the code)

Because the 'magic numbers' were so bad (my fault), the relative prevalence of each effect may need to be tweaked. Again. But this time it should be able to stick, with no further huge changes in logic. The results should be obviously appropriate to the numbers we put in, in ways that make sense.

-Clean up redundant paranthesis
-repeated branch body in conditional chain [bugprone-branch-clone]
-Don't do integer division
@Maleclypse Maleclypse merged commit e49605e into CleverRaven:master Apr 30, 2025
30 checks passed
@RenechCDDA RenechCDDA deleted the break_up_riot_damage_functions branch April 30, 2025 10:46
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 BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. [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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants