Jump to content

Wolfgang doesn't check for inventoryitem [Crash/support]


-Variant
  • Fixed

At around line 180, Wolfgang does this check.

Quote

if target ~= nil and data.weapon == nil or data.weapon.components.inventoryitem:IsHeldBy(inst) then

The line should be something like this instead.

Quote

if target ~= nil and data.weapon == nil or (data.weapon.components.inventoryitem and data.weapon.components.inventoryitem:IsHeldBy(inst)) then

As this plays nicer with modded items and projectiles that aren't inventory items, since Wolfgang currently assumes they are regardless.


Steps to Reproduce

Attempt to enter combat with a weapon that uses a ranged projectile that's not considered an inventoryitem.




User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.
3 minutes ago, JesseB_Klei said:

The logic is different for the desired outcome but this is the right area.

Changed Status to Fixed

Appreciate it!
Would you be able to elaborate a bit a bit, I had a code versed friend provide the fix and I'm wanting to pick up what might've been off.

Share this comment


Link to comment
Share on other sites

8 minutes ago, -Variant said:

Appreciate it!
Would you be able to elaborate a bit a bit, I had a code versed friend provide the fix and I'm wanting to pick up what might've been off.

Quote

if target ~= nil and data.weapon == nil or data.weapon.components.inventoryitem:IsHeldBy(inst) then

This is the original code part in the game and it by itself was missing parenthesis around the second part because the code inside this block uses target so target can not be nil no matter what and fixing it turns it into this.

Quote

if target ~= nil and (data.weapon == nil or data.weapon.components.inventoryitem:IsHeldBy(inst)) then

This makes the assumption that the component exists which is where mods would start breaking things but if it does not exist it should follow through like how data.weapon nil check is done.

Quote

if target ~= nil and (data.weapon == nil or data.weapon.components.inventoryitem == nil or data.weapon.components.inventoryitem:IsHeldBy(inst)) then

Making this the result of how the logic is being laid out.

  • Thanks 1
  • Big Ups 2

Share this comment


Link to comment
Share on other sites

9 minutes ago, JesseB_Klei said:

Making this the result of how the logic is being laid out.

Aye aye, I'll share this and get to looking it over myself, many thanks!

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...