fix(påfyldning): markør ved købsstation skal høre til samme station (frø/kalk ikke ved Liquid Buy) (v1.62.248)
This commit is contained in:
@@ -1024,6 +1024,7 @@ function ADFieldWork.nearestStationMarker(markers, points, maxDistance)
|
||||
end
|
||||
|
||||
ADFieldWork.STATION_MARKER_M = 30
|
||||
ADFieldWork.STATION_MATCH_M = 80 -- markører så tæt på bygningen tjekkes med markør->station-opslaget
|
||||
ADFieldWork.WIDTH_GUARD_MS = 10000 -- så tit tjekkes at variabel bredde ikke er sprunget tilbage
|
||||
|
||||
-- Stationens læssetriggere i verden (buying-/loading-station) -> {{x, z}}.
|
||||
@@ -1117,6 +1118,27 @@ local function markerAtStation(adEnv, vehicle, station, placeable)
|
||||
local node = placeable ~= nil and placeable.rootNode or nil
|
||||
if node == nil then return nil end
|
||||
local px, _, pz = getWorldTranslation(node)
|
||||
-- først: nærmeste markør som markør->station-opslaget selv kobler til DENNE station (in-game 16/10: frø og kalk fra
|
||||
-- "Market Price Bulk Fill Station" blev hentet ved "Liquid Buy Silo" 39 m væk — planteren stod der uden at fylde)
|
||||
local okMatch, matchId = pcall(function()
|
||||
local farmId = vehicle ~= nil and ADSmartPickup.getFarmId(vehicle) or nil
|
||||
local found, foundDistance = nil, ADFieldWork.STATION_MATCH_M * ADFieldWork.STATION_MATCH_M
|
||||
for _, marker in pairs(adEnv.ADGraphManager:getMapMarkers()) do
|
||||
-- P-/Connect-/Wait-markører er aldrig påfyldning
|
||||
local wayPoint = not isServiceMarker(marker) and adEnv.ADGraphManager:getWayPointById(marker.id) or nil
|
||||
if wayPoint ~= nil then
|
||||
local d = (wayPoint.x - px) ^ 2 + (wayPoint.z - pz) ^ 2
|
||||
if d < foundDistance then
|
||||
local atMarker = ADSmartPickup.getLoadStationAtWayPointId(adEnv, marker.id, farmId)
|
||||
local same = atMarker ~= nil and (atMarker == station
|
||||
or (placeable ~= nil and atMarker.owningPlaceable == placeable))
|
||||
if same then found, foundDistance = marker.id, d end
|
||||
end
|
||||
end
|
||||
end
|
||||
return found
|
||||
end)
|
||||
if okMatch and matchId ~= nil then return matchId end
|
||||
local best, bestDistance = nil, 40 * 40
|
||||
for _, marker in pairs(adEnv.ADGraphManager:getMapMarkers()) do
|
||||
local isWait = ADSupplyPlanner ~= nil and ADSupplyPlanner.isWaitMarker ~= nil and ADSupplyPlanner.isWaitMarker(marker)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.62.247.0</version>
|
||||
<version>1.62.248.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
Reference in New Issue
Block a user