-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Remove items that shatter instead of dropping them intact #48712
Remove items that shatter instead of dropping them intact #48712
Conversation
This should be done, but perhaps wait for this part until after the problem with slowdowns from lots of objects (#47007 and others) is (mostly?) fixed? |
If it is relevant I'll consider it then, thanks for the indication ! ( except if someone do it of course ) The slowdown caused by thousands of glass shards is maybe mostly caused by broken windows in cities, while the players ( I think ) usually don't throw molotovs/glass items every minute so it should not contribute that much to the glass shard abundance. ( while still be useful for "innawood" character who need a few shards ). If I do it I propose to submit it in a different PR so if it can hurt performance it is easier to sort ( I suppose ). |
In regard to make shattered item drop shards, I ran into the problem that the function that return the mass of an item is only partially implemented. Line 569 in b991a1b
The parameter include_contents is not used.
As a consequence, filled glass containers would drop more shards than the same container when empty. I also noticed some values I question :
As a result, shattered 3L jar would drop less shards than a bottle. Would it make sense to determine the number of shards based on the volume instead of the mass ? I'm not seeing what side effect it could cause, if it do. If this question is out of scope for this particular PR, please tell me so I ask for insights in the Discord instead of here. |
I guess you should use this method, but create new issue about this method is not fully implemented so it would be resolved as separate PR. |
Thanks you for the insight Alex-Folts ! I also thought of using the |
Also some time ago was related to glass shards PR: #42212 |
Summary
Bugfixes "items that shatter were not destroyed on impact. To fix #48707"
Purpose of change
Thrown glass item can display the message "the X shatters", but the item itself was still intact. Led to content duplication for say non empty bottles.
This pull request should remove the shattered item from the game, but not its content.
Describe the solution
Replaced the "drop_item.visit_items" then "add_item_or_charges" with "item( drop_item ).spill_contents;"
This way, the container should never be dropped.
I used this because it is what objects that should burst ( filled condoms ) use, and it works well for the condom.
I just copy pasted.
Describe alternatives you've considered
Also drop glass shards depending of the weight of the object.
Testing
Tests I did :
Tests that need to be done :
Additional context
Sorry if I made someone loose its time testing a flawed PR. ( also I forgot to name and describe the commit )