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

fix: Grenade rework #5297

Merged
merged 5 commits into from
Sep 27, 2024
Merged

Conversation

KheirFerrum
Copy link
Collaborator

@KheirFerrum KheirFerrum commented Sep 1, 2024

Checklist

Required

Purpose of change

Describe the solution

  • Grenade logic reworked such that exploding is handled in active turn processing by tick instead of requiring a fake player invoke from the process_tool code. This has hit a snag that I am commiserating with @joveeater on, as the explosion_iuse::use function is incapable of destroying the item it is called on due to how process_internal code functions. Reworked so that for now it doesn't require this, but it's a hack, detailed in the code.
  • Separate from this also fixes an issue that causes active item processing to process items more than they should due to bad handling in get_for_processing() where num_to_process is checking for >= 0 instead of > 0 Apparently this was used for food item processing, but that has been updated to not be broken by me.

Describe alternatives you've considered

  • Reinserting the weird code used to handle item charges.
    • Would appreciate not doing so, as it presents some very weird edge cases.

Testing

  • Makeshift gas canisters, incendiary grenades and grenades function as they should, exploding and forming appropriate fields, while not lingering beyond their turn.
  • Atomic lamps and other active items that do not use charge do not spontaneously turn themselves off for some reason.
  • Electric lamps still use more or less the same number of charges over time on the floor and in inventory.
  • Grenades in inventory and on floor explode at the same time rather than the one on the floor having it's timer move at double speed.
  • Check that food still rots when placed on the ground.

Additional context

Redoes the logic used by grenade/incendiary/granade iuse actions. Stuck on the inability to destroy a grenade item in the `iuse_actor` functions
@github-actions github-actions bot added the src changes related to source code. label Sep 1, 2024
Reworks how `process_tool` handles items running out of charges. It's a bit hacky, so a comment has been applied

Should work once I merge from upstream, right now it's coming up with curious blocking errors I've never seen in my life
@KheirFerrum KheirFerrum marked this pull request as ready for review September 26, 2024 20:36
@KheirFerrum KheirFerrum marked this pull request as draft September 26, 2024 20:41
@KheirFerrum
Copy link
Collaborator Author

I screwed something up somehow.

@KheirFerrum
Copy link
Collaborator Author

Oh, never mind, I was building on a test build for reworking our active item cache. Look forward to that next PR.

@KheirFerrum KheirFerrum marked this pull request as ready for review September 26, 2024 20:44
@chaosvolt
Copy link
Member

Oh hecc, lemme see...

@RoyalFox2140
Copy link
Collaborator

I live. I can test this then

@RoyalFox2140
Copy link
Collaborator

image
image

Copy link
Collaborator

@RoyalFox2140 RoyalFox2140 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiled, tested, it does what it says it does. Screenshots in previous comment.

@scarf005 scarf005 merged commit f91f417 into cataclysmbnteam:main Sep 27, 2024
13 of 16 checks passed
@chaosvolt
Copy link
Member

I got interrupted by offline errands before I could fully playtest, but can at least confirm compile-test worked fine, so. :>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gas and incendiary grenades do not work
4 participants