fix(ejerskab): jord-bundne kortanlæg (boughtWithFarmland / ejer 15) er gårdens når jorden under dem er købt — Dakotas BGA500kw på jordlod 69 (v1.17.7.0)

This commit is contained in:
2026-09-24 04:57:12 +02:00
parent b603bd7765
commit c814557ae1
8 changed files with 84 additions and 13 deletions
+19
View File
@@ -83,5 +83,24 @@ check("P6 højeste procent", best.percent, 92)
check("P6 ved lighed højeste pris", best.price, 3)
check("P6 tom -> nil", ADPrices.bestQuote({}), nil)
-- P-land: kortanlæg der følger jorden (boughtWithFarmland) er gårdens, når jorden under dem er gårdens —
-- selv om placeable-ejeren står som 15 (Dakotas BGA500kw på jordlod 69)
getWorldTranslation = getWorldTranslation or function(node) return node.x, 0, node.z end
g_currentMission = g_currentMission or {}
g_currentMission.getFarmId = function() return 1 end
g_farmlandManager = {
getFarmlandIdAtWorldPosition = function(_, x, z) return x < 0 and 69 or 70 end,
getFarmlandOwner = function(_, id) return id == 69 and 1 or 0 end,
}
local bga = {rootNode = {x = -1600, z = -89}, boughtWithFarmland = true, spec_productionPoint = {}, getOwnerFarmId = function() return 15 end}
local bgaOther = {rootNode = {x = 1600, z = -89}, boughtWithFarmland = true, spec_productionPoint = {}, getOwnerFarmId = function() return 15 end}
local dairy = {rootNode = {x = -3173, z = -4028}, spec_productionPoint = {}, getOwnerFarmId = function() return 0 end}
check("P-land BGA på egen jord = egen", ADPrices.isOwnedBy(bga, 1), true)
check("P-land BGA på fremmed jord = ikke egen", ADPrices.isOwnedBy(bgaOther, 1), false)
check("P-land mejeri (ejer 0, ikke jord-bundet) = ikke egen", ADPrices.isOwnedBy(dairy, 1), false)
check("P-land egen ejer", ADPrices.isOwnedBy({getOwnerFarmId = function() return 1 end}, 1), true)
check("P-land BGA er ikke salgssted", ADPrices.isSellingStation({isa = function() return true end, isSellingPoint = true, owningPlaceable = bga}), false)
g_farmlandManager = nil
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
os.exit(failures == 0 and 0 or 1)