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

UPS makeshift welder gets confused about tool vs component for vehicle welding rig #19461

Closed
mutability opened this issue Nov 26, 2016 · 11 comments

Comments

Projects
None yet
7 participants
@mutability
Copy link
Contributor

commented Nov 26, 2016

Using 6c4885e + unrelated local changes:

Trying to make a vehicle welding rig, which requires 2 makeshift welders as ingredients, and a welding source (e.g. charged makeshift welder) as tool.

If I have:
a) a charged UPS-mod makeshift welder and 2 additional uncharged makeshift welders: tool requirement is satisfied, ingredient requirement is brown.
b) a charged UPS-mod makeshift welder and 3 additional uncharged makeshift welders: everything is green
c) 1 charged non-UPS makeshift welder and 2 additional uncharged makeshift welders: everything is green

Case (a) should work too.

@saneman226

This comment has been minimized.

Copy link

commented Nov 26, 2016

What I usually do is put the conflicting component somewhere out of sight for a second while I craft with the components I want to use. I have to do this all the time with wheels on vehicles, sometimes it just picks a random size wheel and so I put all wheels for the vehicle under my feet or closer and it works fine.

@mutability

This comment has been minimized.

Copy link
Contributor Author

commented Nov 26, 2016

@saneman226

This comment has been minimized.

Copy link

commented Nov 27, 2016

Have you tried to craft the item with only 2 regular makeshift welders? No additional welders should be needed for the craft. The only problem I can see happening is that the check for the 2 makeshift welders counted the ups-modded one when it shouldn't have. (I'm not sure if the crafting checks for all makeshift welders or if it just tags the first two in your inventory, the former obviously being the better check)
If you are saying that the recipe requires 3 makeshift welders, then it would be a trivial bug to fix.

@mutability

This comment has been minimized.

Copy link
Contributor Author

commented Nov 27, 2016

Have you tried to craft the item with only 2 regular makeshift welders?

That should fail: you do not have a welding source separate from the ingredients.

@mutability

This comment has been minimized.

Copy link
Contributor Author

commented Nov 27, 2016

This is probably (I haven't entirely worked through it) because the "tool is also a component" test in requirement_data::check_enough_materials fires and requires 3 makeshift welders to be available; but then item_comp::has fails to count the charged UPS welder (used as a tool) because it has a toolmod installed and item::allow_crafting_component returns false.

@mutability

This comment has been minimized.

Copy link
Contributor Author

commented Nov 27, 2016

The underlying problem here is that there are three classes of item involved:

  1. Matches the tool requirement, does not match the component requirement
  2. Does not matches the tool requirement, does match the component requirement
  3. Matches both the tool requirement and the component requirement

The current code assumes that if the same item type is needed as both a component and a tool, then it must be case (3) and therefore you need an extra item to handle the separate tool. However, in the situation described in this issue, it is actually case (1) because a modified item cannot be used in crafting; the modified tool that satisfies the tool requirement is not counted as an available component.

To fix that it looks like we need to have requirement_data::check_enough_materials test the inventory more explicitly, looking at each item in isolation rather than trying to combine tool and component counts after the fact:

  foreach (item) {
    if (it is a tool) {
      if (it is also a component) { ++shared_tools }
      else { ++unshared_tools }
    }
    else if (it is a component) { ++components }
  }
  test for (unshared_tools + shared_tools) >= required tools
  if (unshared_tools == 0) { --shared_tools }  // one tool-or-component is needed as the tool
  test for (components + shared_tools) >= required components
@Leland

This comment has been minimized.

Copy link
Contributor

commented May 24, 2017

From #19200:

I have a makeshift welder recharged through a medium storage battery, two discharged makeshift welders and I am not able to craft the vehicle welding rig. The makeshift welder for the welding is marked as green, but the two needed for the crafting are brown.
I do not know if it could be related to this problem, but having a soldering iron recharged with storage batteries gives problem when trying to repair things. The system says that there are not enough charges.

and

I came across this issue as well, crafted 2 makeshift welders, went to craft vehicle welding rig. Not enough makeshift welders. Drop one, tried again and all was fine. Hopefully that gives a useful hint to the problem.

@l29ah

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2018

have three makeshift welders (two usual, one battery compartment), all of them charged enough, still can't do it

@l29ah

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2018

after disassembling the battery compartment one and assembling it as a regular one it works

@KurzedMetal

This comment has been minimized.

Copy link
Contributor

commented Sep 23, 2018

I reproduced this with:

  1. two emtpy makeshift welders as components
  2. one makeshift welder with battery compartment as tool

The recipe was disabled and I couldn't pick it.

You can work around it by making three makeshift welders for components and it will enable the recipe.

@Night-Pryanik

This comment has been minimized.

Copy link
Member

commented Apr 6, 2019

#25890 seems to have fixed this. Tested on latest experimental as of 06 April 2019.

I got 2 empty makeshift welders and 1 fully charged makeshift welder modded with battery compartment mod.
изображение

изображение

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.