sirskunkalot / PlanBuild

Valheim mod enabling you to plan buildings, copy structures and terraform
Do What The F*ck You Want To Public License
11 stars 14 forks source link

Public API for updating PlanHammer piece table to help Mod Compatiability #81

Closed searica closed 8 months ago

searica commented 11 months ago

As discussed in the past, PlanBuild currently can't detect when other mods like MoreVanillaBuildPrefabs add/remove pieces in-game. Rather than requiring PlanBuild to constantly rescan pieces the idea of simply exposing the ScanPieceTables methods through a public API was proposed to mods like MoreVanillaBuildPrefabs could update PlanBuild as needed and the onus of compatibility could be placed on mods that add/remove pieces while in-game.

This PR adds a public API method to the main plugin that simply calls PlanDB.Instance.ScanPieceTables and I also rewrote the method ScanPieceTables to separate the process of creating PlanPieces and the process of managing the PlanHammer piece table. This way PlanPieces are only ever created once and pre-existing PlanPieces are left alone when rescanning piece tables but the PlanHammer piece table can still be updated.

sirskunkalot commented 8 months ago

Hey searica,

I finally made it :) Sorry it took me so long.

Thank you for the PR, will make a new official version today.