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

Floating point inaccuracy causes RequiredItem "Condition" check to fail #9703

Closed
2 tasks done
notpeelz opened this issue Aug 13, 2022 · 2 comments
Closed
2 tasks done
Assignees
Labels
Bug Something isn't working Code Programming task Unstable Tickets that are included and being tested in the current Unstable build.

Comments

@notpeelz
Copy link

notpeelz commented Aug 13, 2022

Disclaimers

  • I have searched the issue tracker to check if the issue has already been reported.
  • My issue happened while using mods.

What happened?

Given an item with this recipe:

<Fabricate suitablefabricators="fabricator" requiredtime="10">
  <RequiredSkill identifier="medical" level="30"/>
  <RequiredItem identifier="plastic"/>
  <RequiredItem identifier="rubber"/>
  <RequiredItem identifier="oxygentank"/>
</Fabricate>

It's currently impossible to craft it with an oxygen tank that was refilled in the oxygen generator, due to floating point inaccuracy.

image

This can be fixed by comparing the two values with a margin of error (epsilon).
image

Relevant lines: https://github.com/Regalis11/Barotrauma/blob/b17019db95865cc0551aa3a5a967e885a7f8b50d/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Fabricator.cs#L605-L617

Reproduction steps

No response

Bug prevalence

Happens every time I play

Version

0.18.15.0

-

No response

Which operating system did you encounter this bug on?

Windows

Relevant error messages and crash reports

No response

@Regalis11 Regalis11 added Bug Something isn't working Code Programming task labels Aug 15, 2022
@Regalis11 Regalis11 self-assigned this Aug 15, 2022
@Regalis11
Copy link
Collaborator

@Regalis11 Regalis11 added the Unstable Tickets that are included and being tested in the current Unstable build. label Aug 20, 2022
@NilanthAnimosus
Copy link
Collaborator

Tested against dev commit https://github.com/Regalis11/Barotrauma-development/commit/17a4e29619e49adc0a329be654296cf8f8ddc5d6, works correctly. closing.

Tested in multiplayer by using recharged oxygen tanks with a custom recipe with no observable issues.

Note: this is inside the current unstable build 0.19.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Code Programming task Unstable Tickets that are included and being tested in the current Unstable build.
Projects
None yet
Development

No branches or pull requests

3 participants