Bumber64 Posted April 25, 2022 Share Posted April 25, 2022 Somebody made a feature request for one of my mods that would require me to check the moisture value of a farm tile. Unfortunately, only "IsSoilMoistAtPoint" is accessible, which only tells if it's greater than 0. The workaround for me would be to replace the entire "scripts/components/farming_manager.lua" with one that adds such a function, which isn't great for forward compatibility. Instead, I'd like a public "GetSoilMoistureAtPoint" function to be implemented by Klei. (Or a "GetTileMoisture" that could be used in conjunction with "Map:GetTileCoordsAtPoint".) Link to comment https://forums.kleientertainment.com/forums/topic/139632-modding-add-getsoilmoistureatpoint-function-to-farming_manager-component/ Share on other sites More sharing options...
Friendly Grass Posted April 25, 2022 Share Posted April 25, 2022 It looks like you just need access to this table stored in the local variable "tile_data" to get all the information you need. You can get this by searching through the upvalues in one of the various functions referencing the variable with the debug.getupvalue library function. This is commonly known as upvalue hacking. There isn't a performance cost because you only need to find the reference once. Link to comment https://forums.kleientertainment.com/forums/topic/139632-modding-add-getsoilmoistureatpoint-function-to-farming_manager-component/#findComment-1563230 Share on other sites More sharing options...
Bumber64 Posted April 27, 2022 Author Share Posted April 27, 2022 I'll give it try. Edit: Got it working. Would be better to do without hacking, though. Link to comment https://forums.kleientertainment.com/forums/topic/139632-modding-add-getsoilmoistureatpoint-function-to-farming_manager-component/#findComment-1563748 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.