diff --git a/FS25_ADSmartPickup/adPrices.lua b/FS25_ADSmartPickup/adPrices.lua
index ce34aad..371b4f1 100644
--- a/FS25_ADSmartPickup/adPrices.lua
+++ b/FS25_ADSmartPickup/adPrices.lua
@@ -75,13 +75,30 @@ function ADPrices.isSellingStation(station)
if station.isSellingPoint ~= true or station.hideFromPricesMenu then
return false
end
+ -- Afleveringer til GÅRDENS EGNE fabrikker/stalde er ikke salg. En fremmed produktion (fx kortets
+ -- mejeri, ejer 0) køber varen og er et rigtigt salgssted. Ukendt ejer = regnes som egen.
local placeable = station.owningPlaceable
if placeable ~= nil and (placeable.spec_productionPoint ~= nil or placeable.getHusbandryFillLevel ~= nil) then
- return false
+ return not ADPrices.isOwnedByPlayer(placeable)
end
return true
end
+function ADPrices.isOwnedByPlayer(placeable)
+ local owner = nil
+ if placeable.getOwnerFarmId ~= nil then
+ local ok, value = pcall(placeable.getOwnerFarmId, placeable)
+ if ok then owner = value end
+ elseif placeable.ownerFarmId ~= nil then
+ owner = placeable.ownerFarmId
+ end
+ if owner == nil then
+ return true
+ end
+ local farmId = g_currentMission ~= nil and g_currentMission.getFarmId ~= nil and g_currentMission:getFarmId() or 1
+ return owner == farmId
+end
+
local function getCurrentPeriod()
local environment = g_currentMission ~= nil and g_currentMission.environment or nil
return environment ~= nil and environment.currentPeriod or nil
diff --git a/FS25_ADSmartPickup/l10n/l10n_da.xml b/FS25_ADSmartPickup/l10n/l10n_da.xml
index 5c712f5..2b37676 100644
--- a/FS25_ADSmartPickup/l10n/l10n_da.xml
+++ b/FS25_ADSmartPickup/l10n/l10n_da.xml
@@ -115,7 +115,7 @@
-
+
diff --git a/FS25_ADSmartPickup/l10n/l10n_en.xml b/FS25_ADSmartPickup/l10n/l10n_en.xml
index 024e363..2327125 100644
--- a/FS25_ADSmartPickup/l10n/l10n_en.xml
+++ b/FS25_ADSmartPickup/l10n/l10n_en.xml
@@ -115,7 +115,7 @@
-
+
diff --git a/FS25_ADSmartPickup/modDesc.xml b/FS25_ADSmartPickup/modDesc.xml
index 1b0c818..51f1315 100644
--- a/FS25_ADSmartPickup/modDesc.xml
+++ b/FS25_ADSmartPickup/modDesc.xml
@@ -1,7 +1,7 @@
masterdraco
- 1.17.0.0
+ 1.17.1.0
AD Smart Pickup
diff --git a/docs/BRUGERMANUAL.md b/docs/BRUGERMANUAL.md
index dc06acd..5172251 100644
--- a/docs/BRUGERMANUAL.md
+++ b/docs/BRUGERMANUAL.md
@@ -1,6 +1,6 @@
# AD Smart Pickup — brugermanual
-Version 1.17.0 · Farming Simulator 25 · tillæg til AutoDrive
+Version 1.17.1 · Farming Simulator 25 · tillæg til AutoDrive
*English version: [USER_MANUAL.md](USER_MANUAL.md)*
@@ -128,7 +128,7 @@ Tryk **ESC** og vælg fanen **Smart Pickup**. Fanen har fem underfaner:
Øverst står én linje pr. flow. Det valgte flow er markeret med `>`.
```
-> Mælkesalg: Mælk · Cow Barn 1 + Cow Barn 2 → Salg · pris ≥ 90 %, lager > 80 % · Virtus · Kører (1/1)
+> Mælkesalg: Mælk · Cow Barn 1 + Cow Barn 2 → Salg · pris >= 90 %, lager > 80 % · Virtus · Kører (1/1)
Foder stald: efter behov · alle siloer → Cow Barn 1 · behov · JCB 1 + JCB 2 · Stoppet (2 traktorer)
```
@@ -305,7 +305,9 @@ Før hver pålæsning, og hvert femte sekund mens traktoren holder, vurderer mod
### Prisen
-Pris-% er varens nuværende pris i forhold til årets højeste. Moden bruger den samme sæsonkurve som
+Salgssteder er kortets rigtige salgssteder og fabrikker, som gården ikke ejer, fx kortets mejeri.
+Afleveringer til gårdens egne fabrikker og stalde tæller ikke som salg. Pris-% er varens nuværende
+pris i forhold til årets højeste. Moden bruger den samme sæsonkurve som
spillets prisgraf. Varer med flad kurve regnes altid som 100 %. Salgsstedet med den bedste pris vinder,
så længe vejnettet når derhen.
diff --git a/docs/USER_MANUAL.md b/docs/USER_MANUAL.md
index 897dab9..5b545c4 100644
--- a/docs/USER_MANUAL.md
+++ b/docs/USER_MANUAL.md
@@ -1,6 +1,6 @@
# AD Smart Pickup — user manual
-Version 1.17.0 · Farming Simulator 25 · add-on for AutoDrive
+Version 1.17.1 · Farming Simulator 25 · add-on for AutoDrive
*Dansk version: [BRUGERMANUAL.md](BRUGERMANUAL.md)*
@@ -130,7 +130,7 @@ Press **ESC** and open the **Smart Pickup** tab. It has five sub-tabs:
At the top there is one line per flow. The selected flow is marked with `>`.
```
-> Milk sale: Milk · Cow Barn 1 + Cow Barn 2 → Sell · price ≥ 90 %, storage > 80 % · Virtus · Running (1/1)
+> Milk sale: Milk · Cow Barn 1 + Cow Barn 2 → Sell · price >= 90 %, storage > 80 % · Virtus · Running (1/1)
Barn feed: by need · all silos → Cow Barn 1 · need · JCB 1 + JCB 2 · Stopped (2 tractors)
```
@@ -308,7 +308,9 @@ Before each loading, and every five seconds while the tractor waits, the mod che
### The price
-The price share is the good's current price compared with the yearly high. The mod uses the same
+Selling points are the map's real selling points and factories the farm does not own, such as the
+map's dairy. Deliveries to the farm's own factories and barns do not count as sales. The price share
+is the good's current price compared with the yearly high. The mod uses the same
seasonal curve as the game's price graph. Goods with a flat curve always count as 100 %. The selling
point with the best price wins, as long as the road network reaches it.
diff --git a/tests/test_adPrices.lua b/tests/test_adPrices.lua
index 3968781..1c39a58 100644
--- a/tests/test_adPrices.lua
+++ b/tests/test_adPrices.lua
@@ -50,6 +50,10 @@ check("P4 fabrik-station = ikke salgssted", ADPrices.isSellingStation({isa = fun
-- in-game (23/9): TMR-fabrikkens indlevering er en SellingStation med isSellingPoint=true -> blev regnet som marked
check("P4 fabrikkens egen station = ikke salgssted", ADPrices.isSellingStation({isa = function() return true end, isSellingPoint = true, owningPlaceable = {spec_productionPoint = {}}}), false)
check("P4 staldens egen station = ikke salgssted", ADPrices.isSellingStation({isa = function() return true end, isSellingPoint = true, owningPlaceable = {getHusbandryFillLevel = function() end}}), false)
+-- P4b: fremmed produktion (kortets mejeri, ejer 0) køber varen = salgssted; gårdens egen fabrik er ikke
+check("P4b fremmed mejeri = salgssted", ADPrices.isSellingStation({isa = function() return true end, isSellingPoint = true, owningPlaceable = {spec_productionPoint = {}, getOwnerFarmId = function() return 0 end}}), true)
+check("P4b egen fabrik (ejer 1) = ikke salgssted", ADPrices.isSellingStation({isa = function() return true end, isSellingPoint = true, owningPlaceable = {spec_productionPoint = {}, getOwnerFarmId = function() return 1 end}}), false)
+check("P4b fremmed stald-felt ownerFarmId", ADPrices.isSellingStation({isa = function() return true end, isSellingPoint = true, owningPlaceable = {getHusbandryFillLevel = function() end, ownerFarmId = 0}}), true)
check("P4 rigtigt salgssted med placeable", ADPrices.isSellingStation({isa = function() return true end, isSellingPoint = true, owningPlaceable = {}}), true)
-- P5: uden stationens grundpris: kun kurven tæller (faktor nu ÷ faktor max)