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

Factions don't mind the player smashing zombie corpses #77426

Conversation

RenechCDDA
Copy link
Member

Summary

Balance "Factions don't mind the player smashing zombie corpses"

Purpose of change

Does not close the issue.

Describe the solution

Pre-check the target to see if there's a corpse that might end up getting smashed. Corpses are always smashed before terrain, so if there's a corpse we can't possibly smash terrain. Therefore, skip the warning (and possible relations loss).

This does technically iterate the target tile twice, which is slightly wasteful

Describe alternatives you've considered

I thought about passing the corpse smashing information along as an optional argument to avatar::smash() as a bool or container of item_location, to prevent the double iteration of the map tile.

I thought about refactoring smash() and avatar::smash() so target information is available before the checks for whether we should smash

But in the end I went with this. It could be unknowingly broken in the future if avatar::smash() changes the order of checks, but at worst it would produce a obviously-unintended exploit (e.g. being able to put a corpse on a tile and then bash the terrain). I think this possibility for breakage is a safer idea than refactoring which could introduce other bugs.

Testing

Smash left, then smash right

2024-10-29.00-44-58.mp4

Additional context

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` Game: Balance Balancing of (existing) in-game features. json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Oct 29, 2024
@RenechCDDA RenechCDDA force-pushed the factions_dont_mind_u_smashing_corpses branch from 9f7cc9f to d4bcc22 Compare October 29, 2024 06:22
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Oct 29, 2024
@Maleclypse Maleclypse merged commit 64914b4 into CleverRaven:master Oct 29, 2024
20 of 26 checks passed
@RenechCDDA RenechCDDA deleted the factions_dont_mind_u_smashing_corpses branch October 29, 2024 14:28
@ashGlaw
Copy link
Contributor

ashGlaw commented Oct 29, 2024

Thank you! This was frustrating me last night

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` Game: Balance Balancing of (existing) in-game features. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants