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

NPC's cant use modded welding tools because of tag restrictions #5527

Closed
PanmanS opened this issue Apr 16, 2021 · 9 comments
Closed

NPC's cant use modded welding tools because of tag restrictions #5527

PanmanS opened this issue Apr 16, 2021 · 9 comments
Assignees
Labels
Bug Something isn't working Code Programming task Modding Modding-related feature request or issue, or a bug that only occurs with mods

Comments

@PanmanS
Copy link

PanmanS commented Apr 16, 2021

I have searched the issue tracker to check if the issue has already been reported.
Description
Bots can only refuel welding tanks with the basic weldingfuel item, not any item with a weldingfuel tag.
(also they cant use modded welding tools like foam sprayer from EK utilities since canister it not containing weldingfuel tag and bots will try to fill sprayer with default welding fuel instead of proper one)
Steps To Reproduce

Remove all weldingfuel item from the sub (I recommend using a shuttle)
Spawn a bunch of incendium fuel tanks.
Create a leak.
Version
v0.12.0.3+

Additional information
I'm pretty sure I've tracked it down to this line here:
Barotrauma/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveFixLeak.cs

Line 93 in 245b48c

TryAddSubObjective(ref refuelObjective, () => new AIObjectiveContainItem(character, "weldingfuel", weldingTool.GetComponent(), objectiveManager, spawnItemIfNotFound: character.TeamID == CharacterTeamType.FriendlyNPC),
On line 91, the bot checks if it doesn't have any weldingfuel by tag. When it creates this objective, it is looking for weldingfuel by identifier.

Possible fix: replace every "weldingfuel" with "weldingequipment" in AIObjectiveFixLeak.cs and add "weldingequipment" to both weldings tanks.
(description was taken from Jlobblet thread)

@Regalis11 Regalis11 added Bug Something isn't working Code Programming task Modding Modding-related feature request or issue, or a bug that only occurs with mods labels Apr 17, 2021
@CurePindal
Copy link

I would totally love to see this issue solved. Helpful for "bots vs a handful of mods".

@Regalis11
Copy link
Collaborator

I'm afraid I couldn't reproduce this. The bots don't seem to have any trouble using the incendium tanks:
image

I don't think the line mentioned is the issue either: AIObjectiveContainItem does look for the item based on the "weldingfuel" tag.

@PanmanS
Copy link
Author

PanmanS commented Apr 17, 2021

@Regalis11, yeah, it is right, my bad (incen.tanks actually got this tag and i just didnt saw 'em) I recommend trying EK utilities tools as testing platform or just remove weldingfuel tag from incendium tanks or normal welding tanks.

Whole main problem that weldingfuel tag is tied to item ID and causing problems with modding. For example same Mettalic Foam Sprater from EK mod cannot be used by bots because fuel that this tool using is not containing weldingfuel. If you gonna add this tag to fuel bots gonna be able to use it without problems but now this modded canister is compactible with welding tool and this is a problem.

image

Vanilla edit testing version:

  1. remove "weldingfuel" tag from incendium tanks
  2. replace it with weldingequipment tag
  3. follow normal testing procedure described in issue report

EK Utilities testing version:

  1. spawn Metallic Foam Sprayer
  2. fuel it with foam canister
  3. remove any other welding tools on shuttle
  4. create leak

UPDATE 3: you can use this build to see my crutch fix for this problem
WELDING_ISSUE_FIXED.zip

@Regalis11
Copy link
Collaborator

Ahh I see, thank you for the clarification. So essentially the problem was that the "weldingfuel" tag can't be added without making the custom fuel compatible with the welding tool as well?

Fixed in https://github.com/Regalis11/Barotrauma-development/commit/4bcce420b4ad4309e130391b2f8429f7f44e178d by changing the "weldingfuel" tag to "weldingtoolfuel" in the welding tool. In other words, only things that have the tag "weldingtoolfuel" are compatible with the welding tool, and the bots use the "weldingfuel" tag to find suitable fuel for their current tool. Replacing the tag with "weldingequipment" would've also been an option, but the tag is used to find a suitable tool, so it could lead to bots trying to use the fuel tanks for fixing leaks.

@Regalis11 Regalis11 self-assigned this Apr 17, 2021
@PanmanS
Copy link
Author

PanmanS commented Apr 17, 2021

Thank you very much for fixing this bug! Issue was exactly like you said ( So essentially the problem was that the "weldingfuel" tag can't be added without making the custom fuel compatible with the welding tool as well? )

@PanmanS PanmanS closed this as completed Apr 17, 2021
@Regalis11
Copy link
Collaborator

Thanks for taking the time to close this, but I'll reopen the ticket until we've tested and verified that the fix is working as intended. :)

@Regalis11 Regalis11 reopened this Apr 18, 2021
@itchyOwl
Copy link
Collaborator

So the intention was to not make the custom welding fuel compatible with the vanilla welding tool, but still allow bots to use that custom welding tool and the custom fuel properly?

Didn't test it, but I assume the commit fixes it. I'm sure there would be similar issues with other items too, because I've not thought that someone would want to make an item that would be used like some vanilla item using special expendables with it, but which should not work with the vanilla item. Like diving suits, masks, battery-powered items etc... To allow that, I think we'd have to do the same tag changes for them too.

@Regalis11
Copy link
Collaborator

So the intention was to not make the custom welding fuel compatible with the vanilla welding tool, but still allow bots to use that custom welding tool and the custom fuel properly?

Yep, that was the idea. Took me a while to understand this correctly as well. :D

@Krzeszny
Copy link

I applied the proper tags in my EK Utilities balance patch but it's not fixed in vanilla EK Utilities because.... I can't contact EK in any way, shape, or form.

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 Modding Modding-related feature request or issue, or a bug that only occurs with mods
Projects
None yet
Development

No branches or pull requests

5 participants