feat: trigger-dump med omrids, varer og retning (v1.62.73)

This commit is contained in:
2026-10-08 00:57:48 +02:00
parent 6019b4edb9
commit a4a0bb2529
3 changed files with 79 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.73** Udvikler: trigger-dumpet viser også bygningens omrids og for hver læsse-/aflæsningstrigger dens varer og retning (aiNode).
- **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".
+77
View File
@@ -561,6 +561,76 @@ local function specTriggerNodes(spec)
return result
end
local function addCorner(box, node)
if node == nil or (entityExists ~= nil and not entityExists(node)) then return end
local x, _, z = getWorldTranslation(node)
box.minX, box.maxX = math.min(box.minX, x), math.max(box.maxX, x)
box.minZ, box.maxZ = math.min(box.minZ, z), math.max(box.maxZ, z)
box.n = box.n + 1
end
local function walkAreas(value, box, depth)
if type(value) ~= "table" or depth > 4 then return end
if value.startNode ~= nil and (value.endNode ~= nil or value.widthNode ~= nil) then
addCorner(box, value.startNode); addCorner(box, value.endNode); addCorner(box, value.widthNode); addCorner(box, value.heightNode)
return
end
if value.start ~= nil and value.width ~= nil and type(value.start) == "number" then
addCorner(box, value.start); addCorner(box, value.width); addCorner(box, value.height)
return
end
for _, child in pairs(value) do walkAreas(child, box, depth + 1) end
end
-- Bygningens omrids ud fra placerings-/rydnings-/nivelleringsområder -> {minX, maxX, minZ, maxZ} eller nil.
function ADBuildings.footprint(placeable)
local box = {minX = math.huge, maxX = -math.huge, minZ = math.huge, maxZ = -math.huge, n = 0}
for _, specName in ipairs({"spec_placement", "spec_clearAreas", "spec_leveling", "spec_tipOcclusionUpdateAreas"}) do
walkAreas(placeable[specName], box, 0)
end
return box.n > 0 and box or nil
end
local function fillTypeNames(set)
local names = {}
for fillType, on in pairs(set or {}) do
if on == true and g_fillTypeManager ~= nil then table.insert(names, tostring(g_fillTypeManager:getFillTypeNameByIndex(fillType))) end
end
table.sort(names)
return table.concat(names, ",")
end
local function nodeInfo(node)
local x, z = getNodePosition(node)
if x == nil then return nil end
local _, ry = getWorldRotation(node)
return string.format("%.2f %.2f retning %.0f", x, z, math.deg(ry or 0))
end
function ADBuildings.dumpTriggerFillTypes(name, placeable, loadStations, unloadStations)
for _, station in pairs(loadStations) do
if station.owningPlaceable == placeable then
for index, trigger in pairs(station.loadTriggers or {}) do
local info = nodeInfo(trigger.triggerNode)
if info ~= nil then Logging.info("ADSmartPickup: TRIGGER '%s' læssetrigger %s: %s [%s]", tostring(name), tostring(index), info, fillTypeNames(trigger.fillTypes)) end
local ai = nodeInfo(trigger.aiNode)
if ai ~= nil then Logging.info("ADSmartPickup: TRIGGER '%s' læssetrigger %s aiNode: %s", tostring(name), tostring(index), ai) end
end
end
end
for _, station in pairs(unloadStations) do
if station.owningPlaceable == placeable then
for index, trigger in pairs(station.unloadTriggers or {}) do
local node = trigger.exactFillRootNode or trigger.triggerNode
local info = nodeInfo(node)
if info ~= nil then Logging.info("ADSmartPickup: TRIGGER '%s' aflæsningstrigger %s: %s [%s]", tostring(name), tostring(index), info, fillTypeNames(trigger.fillTypes or station.acceptedFillTypes)) end
local ai = nodeInfo(trigger.aiNode)
if ai ~= nil then Logging.info("ADSmartPickup: TRIGGER '%s' aflæsningstrigger %s aiNode: %s", tostring(name), tostring(index), ai) end
end
end
end
end
function ADBuildings.dumpTriggers(adEnv, farmId)
local placeables = g_currentMission.placeableSystem.placeables or {}
local storage = g_currentMission.storageSystem
@@ -591,6 +661,13 @@ function ADBuildings.dumpTriggers(adEnv, farmId)
if nx ~= nil then Logging.info("ADSmartPickup: TRIGGER '%s' aflæs %s", tostring(name), fmt(nx, nz)) end
end
end
-- omrids: alle områder med start-/slut- eller bredde-/højde-noder (placering, rydning, nivellering)
local okBox, box = pcall(ADBuildings.footprint, placeable)
if okBox and box ~= nil then
Logging.info("ADSmartPickup: TRIGGER '%s' omrids x %.1f..%.1f z %.1f..%.1f", tostring(name), box.minX, box.maxX, box.minZ, box.maxZ)
end
-- hvilke varer hver trigger tager, og nodens retning (hvor køretøjet skal holde)
pcall(ADBuildings.dumpTriggerFillTypes, name, placeable, loadStations, unloadStations)
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
+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.72.0</version>
<version>1.62.73.0</version>
<title>
<en>AD Smart Pickup</en>
</title>