feat: udvikler-dump af triggerpositioner (v1.62.72)

This commit is contained in:
2026-10-08 00:50:47 +02:00
parent f0204d72a7
commit 6019b4edb9
4 changed files with 75 additions and 1 deletions
+1
View File
@@ -8,6 +8,7 @@ står i [docs/BRUGERMANUAL.md](docs/BRUGERMANUAL.md) (dansk) og [docs/USER_MANUA
## 1.62 — Kæder slås selv til
- **1.62.72** Udvikler: findes `modSettings/FS25_ADSmartPickup/dumpTriggers.txt`, skriver moden ~20 s efter indlæsning alle bygningers læsse-/aflæsningspunkter og triggere i loggen ("ADSmartPickup: TRIGGER …"). Det bruges til at bygge vejnet og markører uden for spillet (demobanen i savegame4).
- **1.62.71** Nyt: vinter. Græsarbejde (slå, vende, rive) startes ikke i FS25-periode 10–12 (december–februar), og marken venter med årsagen *vinter*. Opsamling af skår, der allerede ligger, må gerne køre. Rettet: en opsamler, der står stille med Courseplay aktiv i 3 minutter uden at blive fyldt, stoppes, og marken afsluttes som færdig (en evt. rest køres til lager), med en advarsel i spillet. Før stod F13's læssevogne stille i januar efter genindlæsning, og marken stod som "kører".
- **1.62.70** Rettet: paller sat på lager i et palleskur køres aldrig til en parkerings-, koblings- eller Wait-markør ved skuret. Før ville 'Egg / Wool Collect' sætte på lager ved "Connect P Tippevogn 8".
- **1.62.69** Rettet: ved opvågning bruges flowets egen traktor, medmindre den reelt er lånt ud (markopgave, Courseplay, marksilo, et andet flow). Har den flowets vogn på, byttes der aldrig. Før holdt 'slurry's 6230 TTV ved Cow Wait 2 med gyllevognen, en anden 6230 TTV fik turen, og den ventede for evigt på vognen.
+72
View File
@@ -538,3 +538,75 @@ function ADBuildings.getMarkers(building, role)
end
return building.loadMarkers or (building.loadMarker ~= nil and {building.loadMarker} or {})
end
-- ---- udvikler-diagnose: triggerpositioner (til at bygge vejnet/markører uden for spillet) ----
-- Kører én gang ~20 s efter indlæsning, KUN hvis filen modSettings/FS25_ADSmartPickup/dumpTriggers.txt findes.
-- Logger pr. bygning: navn, art, position, rotation, læssepunkter, aflæsningspunkter og trigger-felter i
-- objektlager/silo (palleskurets indlevering). Linjerne starter med "ADSmartPickup: TRIGGER".
ADBuildings.DUMP_DELAY_MS = 20000
local dumpState = {done = false, elapsed = 0}
local function fmt(x, z) return string.format("%.2f %.2f", x or 0, z or 0) end
local function specTriggerNodes(spec)
local result = {}
for key, value in pairs(spec or {}) do
if type(key) == "string" and key:lower():find("trigger") ~= nil and type(value) == "number"
and (entityExists == nil or entityExists(value)) then
local x, z = getNodePosition(value)
if x ~= nil then table.insert(result, key .. "=" .. fmt(x, z)) end
end
end
table.sort(result)
return result
end
function ADBuildings.dumpTriggers(adEnv, farmId)
local placeables = g_currentMission.placeableSystem.placeables or {}
local storage = g_currentMission.storageSystem
local loadStations = storage ~= nil and storage:getLoadingStations() or {}
local unloadStations = storage ~= nil and storage:getUnloadingStations() or {}
local count = 0
for _, placeable in pairs(placeables) do
local kind = getKind(placeable)
if kind == nil and isSellPlaceable(placeable, unloadStations) then kind = "sell" end
if kind == nil and placeable.spec_objectStorage ~= nil then kind = "objectStorage" end
if kind ~= nil then
count = count + 1
local name = getName(placeable, "?")
local x, _, z = getWorldTranslation(placeable.rootNode)
local _, ry = getWorldRotation(placeable.rootNode)
Logging.info("ADSmartPickup: TRIGGER bygning '%s' art=%s pos=%s rotY=%.1f fil=%s", tostring(name), kind, fmt(x, z),
math.deg(ry or 0), tostring(placeable.configFileName))
local okNodes, loadGroups, unloadNodes = pcall(collectNodes, placeable, loadStations, unloadStations)
if okNodes then
for index, nodes in ipairs(loadGroups or {}) do
for _, node in ipairs(nodes) do
local nx, nz = getNodePosition(node)
if nx ~= nil then Logging.info("ADSmartPickup: TRIGGER '%s' læs%d%s %s", tostring(name), index, nodes.isSpawner and " (spawner)" or "", fmt(nx, nz)) end
end
end
for _, node in ipairs(unloadNodes or {}) do
local nx, nz = getNodePosition(node)
if nx ~= nil then Logging.info("ADSmartPickup: TRIGGER '%s' aflæs %s", tostring(name), fmt(nx, nz)) end
end
end
for _, specName in ipairs({"spec_objectStorage", "spec_silo", "spec_bunkerSilo"}) do
local nodes = specTriggerNodes(placeable[specName])
if #nodes > 0 then Logging.info("ADSmartPickup: TRIGGER '%s' %s: %s", tostring(name), specName, table.concat(nodes, "; ")) end
end
end
end
Logging.info("ADSmartPickup: TRIGGER færdig: %d bygninger", count)
end
function ADBuildings.tickDump(adEnv, dt)
if dumpState.done then return end
dumpState.elapsed = dumpState.elapsed + (dt or 0)
if dumpState.elapsed < ADBuildings.DUMP_DELAY_MS then return end
dumpState.done = true
local path = getUserProfileAppPath ~= nil and (getUserProfileAppPath() .. "modSettings/FS25_ADSmartPickup/dumpTriggers.txt") or nil
if path == nil or fileExists == nil or not fileExists(path) then return end
local ok, err = pcall(ADBuildings.dumpTriggers, adEnv, g_currentMission:getFarmId())
if not ok then Logging.warning("ADSmartPickup: TRIGGER-dump fejlede: %s", tostring(err)) end
end
+1
View File
@@ -1354,6 +1354,7 @@ function ADSmartPickup:update(dt)
local okFlow, errFlow = pcall(ADFlowWagons.tick, getAutoDriveEnv(), dt)
if not okFlow then Logging.warning(ADSmartPickup.LOG_PREFIX .. "flow-vogne fejlede: %s", tostring(errFlow)) end
end
if ADBuildings ~= nil and ADBuildings.tickDump ~= nil then pcall(ADBuildings.tickDump, getAutoDriveEnv(), dt) end
if ADMarkerGuard ~= nil and getAutoDriveEnv() ~= nil then
local okGuard, errGuard = pcall(ADMarkerGuard.tick, ADMarkerGuard.gameEnv(getAutoDriveEnv()))
if not okGuard then Logging.warning(ADSmartPickup.LOG_PREFIX .. "markørvagt fejlede: %s", tostring(errGuard)) end
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="107">
<author>masterdraco</author>
<version>1.62.71.0</version>
<version>1.62.72.0</version>
<title>
<en>AD Smart Pickup</en>
</title>