-
Notifications
You must be signed in to change notification settings - Fork 359
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
Fix table used as int #3604
Fix table used as int #3604
Conversation
Intended behavior was to randomly choose a number between 5 and 8. These are randomly generated weapons, so some of their parameters are randomized. |
Hi, do you mean this is the Intended behavior in FU, but gunfire.lua forget to adapt to this usage? Since the array I can update PR to randomly pick a value in range at runtime here (So magazineSize is random for each shoot??). But I guess, the array |
I think this PR is correct, I just add a guard to parse the int, if other mod copy the array to instance instead of generate an int before copy, this will fix it. |
Currently this PR is incorrect, because it adds incorrect handling of tonumber(status.stat("magazineSize")) or 0 Situation: |
Are you sure you don't have any incompatible mods that overwrite Because I see correct handling of FrackinUniverse/items/buildscripts/buildweapon.lua Lines 272 to 276 in bdada8a
This code already replaces the table with an integer when the weapon is created. |
Thank you for explaining it. I understand, I update the code to handle randomlization at runtime, while it should have done in weapon creation time. The solution at least make the weapon useable. While it may change after restart game
Seems it is impossible to know this in Starbound, I can't log who overwrites it. But from the screenshot, looks like sometimes it has localization and sometimes not, maybe localization performs some bad patch. |
Some poor guys 5 years ago
So maybe it is weapon stats...Anyway I hope we can give this an end. |
Im not interested in nonsense bugs from 5 years ago that exist because people didn't bother to read our mod front page, which clearly stated that WeaponStats was not compatible in the first place. Do you have Weapon Stats installed? If so, that is your issue, not FU. It is not compatible with our mod. No amount of adjusting the lua script will matter since Weapon Stats overwrites it. That, or you have a translation mod installed for FU, which is -also- not compatible. I assume conflicts are the issue here, as the weapon ammo code has worked fine for years without incident. Please confirm your mod selection with a log. I will not be approving this PR until this is done. There is also an error in the lua code you submitted. |
Sorry for wasting your time, it was "Weapon Retrofitting Station - Breaks weapons" in the list. It says it is compatible in its page, but is not. It may overwrite the |
fixes #3603
I think some items may have buggy value in config, while I find the config in this repo is good
FrackinUniverse/items/active/weapons/ranged/pistol/swtjc_ewg_commonrevolver.activeitem
Line 72 in bdada8a
so maybe bug comes from some other FU compat mod, that is outdated. But have guard in the code is always a good option. At least this make gun shootable again.