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

Make thrown glass items drop glass shards when shattered #48727

Merged

Conversation

Zeropol
Copy link
Contributor

@Zeropol Zeropol commented May 1, 2021

Summary

Features "Make thrown glass items drop glass shard when shattered"

Purpose of change

Thrown glass item can shatter, but they don't drop glass shard.
This PR aim to correct this.

Describe the solution

Divide mass of the item by mass of glass shard to get max shards.
Drop between half max and max-1 shards, so the item has to weight at least 2 times a glass shard to yield something.

Describe alternatives you've considered

Using volume instead of mass for calculation but it makes less sense I suppose.
Write a message to user when the shattered item yielded no shards ( it's only when item_mass < 2*shard_mass ).

Testing

  • Thrown a glass shivs : will never drop a shard. It is composed of 1 glass shard, so if it shatter, there is no more shards.
  • Thrown a glass shard : same as glass shiv.
  • Thrown a glass bottle : got 5 shards out of 5 maximum usable ( 6 max based on weight, inconsistency with disassembly ! shard = 75g, empty bottle = 450g, (450/75)-1 = 5 ).
  • Thrown a 3L glass jar : got 2 shards out of 3 max usable. ( 4 based on weight ).
  • Thrown a filled (water) 3L glass jar : debug message say maximum number of dropped charges is the same as empty 3L glass jar. ( got 3 out of 3 ).
  • Thrown a pane of reinforced glass : got 71 shards out of a maximum usable of 132.

Additional context

Does not affect smashed items.

This PR should not be merged if #48712 isn't, because the player could duplicate glass shard by repeatedly throwing glass items ( 48712 make shattered items disappear ).

There is inconsistency with the glass bottle, as discussed in 48712.

Because some of the shards should be usable.

The item has to weight at least 2 times a glass shard.
There is some randomness involved.

Does NOT affect smashed items.
@actual-nh actual-nh added <Bugfix> This is a fix for a bug (or closes open issue) Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Items / Item Actions / Item Qualities Items and how they work and interact 0.F String Freeze labels May 1, 2021
@actual-nh
Copy link
Contributor

I'm not sure about the debug message (it isn't an error message that's supposed to be copied as-is and not translated).

@Zeropol
Copy link
Contributor Author

Zeropol commented May 1, 2021

If you think it is better I remove it, just tell me :)
As a debug message for a minor action it is of limited utility.

@actual-nh
Copy link
Contributor

If you think it is better I remove it, just tell me :)
As a debug message for a minor action it is of limited utility.

Comment it out? If this winds up going into 0.F-dev instead of master leading up to 0.F, uncomment it.

It is a shamy attempt to avoid string freeze.
@Zeropol Zeropol changed the title Make thrown glass items drop glass shard when shattered Make thrown glass items drop glass shards when shattered May 2, 2021
@ZhilkinSerg
Copy link
Contributor

Debug strings aren't translated and can go into master.

@ZhilkinSerg ZhilkinSerg merged commit ba96c30 into CleverRaven:master May 28, 2021
@Zeropol Zeropol deleted the make-shattered-items-drop-shards branch May 28, 2021 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Items / Item Actions / Item Qualities Items and how they work and interact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants