searica / MoreVanillaBuildPrefabs

GNU General Public License v3.0
3 stars 2 forks source link

Compatibility with AzuCraftyBoxes (and other mods checking for `Treasure*` prefabs) #9

Closed nbusseneau closed 2 months ago

nbusseneau commented 3 months ago

Hey,

So I've just discovered MVBP-enabled chests like for example TreasureChest_dvergrtown or TreasureChest_fCrypt do not work with AzuCraftyBoxes because it actively guards against prefab names starting with Treasure (e.g. here) in order to safeguard from pulling from POI chests.

I've discussed a bit with Azumatt on this and they were making a sound case that a good way to fix this would be to have MVBP clone the prefabs and strip the Treasure prefix, because the Treasure prefix is actually used by many mods (not only AzuCraftyBoxes) as a simple way to detect POI chests (not foolproof, but it catches a great majority).

What do you think about this?

searica commented 3 months ago

Hey, thanks for opening this to let me know and for already chatting with Azu about it. Unfortunately, given the nature of how MVBP works I really can't change prefab names since the main point of MVBP is the prefabs are the Vanilla prefabs, so that they show up for people without the mod and remain even after uninstalling MVBP. That won't be the case the moment I modify the prefab name since the game won't know what prefab to place when loading the save file without MVBP. So any altering of prefab names in a non-option as far as MVBP is concerned.

If I was trying to solve this on Azu's side then I would check if the container was created by a player or not, since POI chests have no creator and the people who use MVBP to make their own POI typically use InfinityHammer to set the creator of pieces they place to not exist (so it's the same as when the world generates the piece). I think that is similar to the filtering method used by Quick Stack - Store - Sort - Trash - Restock since it can deposit stuff to any player built chest.

If there is a reason that doesn't work as a filtering method, then I could try to work something out with Azu where I can add some kind of identifier to the ZDO data that indicates it is a chest from MVBP. I don't love that solution since it requires hardcoded compatibility and extra checks though.

nbusseneau commented 3 months ago

I really can't change prefab names since the main point of MVBP is the prefabs are the Vanilla prefabs, so that they show up for people without the mod and remain even after uninstalling MVBP.

Ah yes, I didn't think about that.

If I was trying to solve this on Azu's side then I would check if the container was created by a player or not, since POI chests have no creator

Indeed, the mod actually already does that (cf. here), except it does the additional check against Treasure* prefabs.

If there is a reason that doesn't work as a filtering method, then I could try to work something out with Azu where I can add some kind of identifier to the ZDO data that indicates it is a chest from MVBP. I don't love that solution since it requires hardcoded compatibility and extra checks though.

FWIW, the thread where I started the discussion was here: https://discord.com/channels/869937649929056276/1268726068823461959/1268726068823461959

I closed it but you can still post, just unsure if Azumatt will see messages (unless you ping or something).

nbusseneau commented 2 months ago

Hey, Azumatt mentioned in the Discord thread they are actually going to remove the Treasure* prefab filter from AzuCraftyBoxes, so the incompatibility will go away as soon as that's released and we can close the issue then. Just a heads up since you had also mentioned wanting to do something with adding a ZDO data field, not sure if you want to recycle this issue / open a new one for that.

nbusseneau commented 2 months ago

This change was released in AzuCraftyBoxes 1.5.3 (cf. https://github.com/AzumattDev/AzuCraftyBoxes/commit/c28b4270957527033ba9659c8489d89f50bf4f2b), so I'm closing the issue.