Skip to content

Commit

Permalink
fixed woodchips estimation (almost) #2
Browse files Browse the repository at this point in the history
we aren't really able to estimate with a good precision the woodchip since it's stongly related to an issue of the engine 'splitShape' function
this function splits a log in two pieces and it's used to progressively crush logs in the wood chippers
apparently this function have an issue that cause the resulting two logs to have, toghether, more volume of the 'parent' log
this means that the final woodchip amount is strongly dependant on how many times the log is splitted, and that's not predictable at all
  • Loading branch information
TyKonKet committed Mar 12, 2021
1 parent 1c15984 commit c970b08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/huds/trunkHud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function TrunkHud:setData(data)
self.row1.text:setText(data.localizedName)
self.row2.text:setText(string.format("%.1fm %.1fm %.1fm", data.x, data.y, data.z))
self.row3.text:setText(g_i18n:formatMoney(data.price))
self.row4.text:setText(string.format("%.0f l", data.woodChips))
self.row4.text:setText(string.format("~%.0f l", data.woodChips))
self.row5.text:setText(string.format("%.1f kg", data.mass))
if self.firewoodEnabled then
local text = self.notDefinedText
Expand Down
2 changes: 1 addition & 1 deletion src/playerExtension.lua
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function PlayerExtension.getTreeInfo(objectId)
info.volume = getVolume(objectId) * 1000
info.pricePerLiter = splitType.pricePerLiter
info.woodChipsPerLiter = splitType.pricePerLiter
info.woodChips = info.volume * info.woodChipsPerLiter
info.woodChips = info.volume * info.woodChipsPerLiter * 3.9 -- constant value that gives us an excellent approximation of the real value
info.price, info.qualityScale, info.defoliageScale, info.lengthScale = GameplayUtility.getTrunkValue(objectId, splitType)
if g_firewood ~= nil then
info.firewood = g_firewood.FirewoodTool.getChoppingVolume(info.volume) or -1
Expand Down

0 comments on commit c970b08

Please sign in to comment.