jptrrs / HumanResources

A technology overhaul for RimWorld
MIT License
17 stars 12 forks source link

Possible issue learning custom weapons #172

Closed ShauaPuta closed 2 years ago

ShauaPuta commented 2 years ago

I reported on the other issue too but decided to test deeper by myself. To sum the issue up, some custom weapons, like forsaken bows (from this mod: https://steamcommunity.com/sharedfiles/filedetails/?id=1728999127) and war bows (from this mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2401466559) cannot be used by colonists in any way, Pawns cannot train with the weapon to learn them, nor they can experiment with them. I assume there are a lot more other weapons that also cannot be used.

The test environment on the first test was some base framework mods, yayo combat 3, and forsaken race mod, because I assumed it was caused by yayo combat 3. I took a hugslog, but the issue was still persisting, even after I removed yayo combat. Check below.

The second test was made without yayo combat 3. Pawns still cannot use weapons on the target. I didn't include the hugslog because it seemed unnecessary.

The third test was just forsakens, its requirement (vanilla expanded framework) and even fewer framework mods. Mo more jecstools, no moHAr framework, no trashpands framework, just the bare bones required for the mods to work. The forsaken bow still cannot be used in any shape or form, not even by members of that race. There's no error in the log to indicate anything, just the default "there's no weapons available to train". Here is a hugs log from the main menu: https://gist.github.com/9b156abcc45ff61f368aff3b774e344c

heres an image of my modlist at the moment I took that hugslog image

jptrrs commented 2 years ago

Hi. Thanks for the info. The mods you were using are already registered on the hugs log, that's one of the reasons I ask people to provide it, so I can determine what mods were running. Anyway, the issue with Forsaken is its weapons are neither classified as ranged or melee, meaning they aren't picked up by neither the target stand or the training dummy. You can see that for yourself on the storage settings for any stockpile: those weapons are under "weapons", but not "ranged weapons". The mod author can easily fix this by changing his weapons' def to use WeaponsRanged instead of Weapons, under <thingCategories>. You should ask him! Or maybe, if you're familiar with editing xml, you can do it yourself. I doubt it would have any other consequences, but I didn't analyze his code, so I can't be sure. Either way, I'll see if I can come up with some sort of exemption so weapons in that situation don't require training. This way HR will be able to cope with such mods. As for the War Bow from Tribal Warrior Set, I found no issues. Here's a pawn experimenting with it: image

ShauaPuta commented 2 years ago

Thank you for noticing me senpai Mind if I give a suggestion? You could have a backup check looking at the weapon's weaponClasses. Those seem to be much more consistent with the weapon than the thing category In vanilla there are: Melee Ranged MeleePiercer MeleeBlunt LongShots ShortShots RangedHeavy RangedLight

there are also two for Neolithic and Ultratech, but they do not differentiate between melee or ranged

jptrrs commented 2 years ago

That would take re-writing the entire vanilla filtering mechanism, which is used by the bills. A lot of trouble to cover the shortcomings of one specific mod. It's much simpler for that author to do things right, like everybody else does.

ShauaPuta commented 2 years ago

ah yeee, I forgot the training buildings had bills on them, my bad I have made a xml patch that checks if a weapon has the weapon classes, and adds the corresponding thing category. Seem to be working fine, but I need to test it a little bit longer before being sure. Would you be interested in having it when I'm done testing?

jptrrs commented 2 years ago

Good job patching it!!! But in the two years HR has been around, this is the first time someone stumbles on that situation. Most modded weapons work right away. And when a patch is needed, the most usual issue is when there are custom 'ThingCategories'. This usually requires the recipes to be patched. Since your patch changes ThingCategories, it would interfere with those mods. That's something I avoid doing.

jptrrs commented 2 years ago

Mod updated on Steam.