Skip to content

v1.2.7.0 — AI field work: on-demand equipment, harvest, spectator-cost fixes - #61

Closed
TheCodingDad-TisonK wants to merge 19 commits into
mainfrom
development
Closed

v1.2.7.0 — AI field work: on-demand equipment, harvest, spectator-cost fixes#61
TheCodingDad-TisonK wants to merge 19 commits into
mainfrom
development

Conversation

@TheCodingDad-TisonK

Copy link
Copy Markdown
Member

Release v1.2.7.0 — real base-game AI field work, now with on-demand equipment.

Highlights

  • On-demand equipment: an NPC's tractor/combine + implement is spawned at the field the moment they start working, matched to the field's current need, and despawned when they stop. Removes the stale-equipment mismatch from deciding a role once at init. Growing fields get no equipment; the NPC visits on foot.
  • Harvester headers now attach: the New Holland combo pointed at a header file as its "combine" (two headers paired). Fixed to the real combine (chSeries); the header attaches and harvests.
  • Spectator-farm money spam gone: NPC AI cost zeroed, NPC vehicle fuel kept topped so the base game never auto-bills the spectator farm, and Worker Costs (when installed) also drops spectator-farm charges.
  • Load is cancelled if the NPC leaves work before the implement spawns (no churn).

Verified in-game

  • On-demand spawn on work-start, despawn on leave, and the load-cancel guard all confirmed in log.
  • New Holland combine + varifeed28 header attaches and runs AI field work.

Not yet verified in-game

  • The NPCFavor-side fuel top-up guard (syntax-checked, deployed). Worker Costs already catches the same error as a backstop.

Full details in CHANGELOG.md.

…B entry

The vehicle guard in both hudEditModeActionCallback and the RMB mouse handler
blocked edit mode entirely when the player was in a vehicle — which is most
of gameplay. Removed the guard from both paths.

RMB entry now requires the cursor to be over the HUD (matching SoilFertilizer
pattern), preventing accidental edit mode toggle during normal play.
Added NPCFavorHUD:isPointerOverHUD() using the existing getHUDRect() API.

Fixes #51 (reported via FS25_FarmTablet)
Completes the SoilFertilizer pattern: RMB no longer enters edit mode at all.
The existing HUD_EDIT_MODE key binding is the sole entry point. RMB only
exits edit mode when already active, and never consumes the event otherwise.
…im (#56)

Register NPCFavor as a FieldSentry contract provider so a field under an active
favor is masked from Soil & Fertilizer's simulation (the harvest gets vanilla
yields and the favor stays completable) instead of being wrecked by depletion on
land no one manages. High-relationship neighbours opt the field back into the sim
so the player benefits from managing it. Server/host only, tries the FieldSentry_API
global then the g_currentMission.fieldSentry bridge, and guarded so NPCFavor still
loads without S&F. Bumps version to 1.2.6.0.
…e, edge cases

- docs/ai-system.md: Corrected workSatisfaction description (rises when working)
- NPCAI.lua: Removed duplicate getScheduledActivity, delegate to NPCScheduler
- NPCAI.lua: Added loner personality to personalitySchedule
- NPCAI.lua: Schedule-aware commute boost (not just evening)
- NPCAI.lua: Split _originalSpeed/_modeSpeed for proper mood preservation
- NPCAI.lua: Group speech bubble fallback when no partner found
- NPCAI.lua: Clear gatheringData in updateSleepState
- NPCSystem.lua: Added client-side orphan vehicle detection
- NPCScheduler.lua: Reduced social pairing distance to 50m
- Real base-game AI field work: AIJobFieldWork tillage via temporary field
  ownership (borrow the player farm for the job, restore on finish, and a
  save-hook safeguard so a flip never persists), with chained AIJobGoTo driving
  and a kinematic combo as graceful fallbacks. Capped at 2 concurrent NPC AI jobs.
- Fix the AI job start recipe (createJob + setValues) and gate on getCanStartFieldWork.
- Fix VehicleCharacter loadCharacter arg order (was calling a table); seat via the
  correct 4-arg async signature. Spawn a real tractor+implement combo and attach it.
- Fix 5 no-op vehicle deletions (g_currentMission:removeVehicle does not exist; use
  Vehicle:delete). Add npcDeleteVehicle console command.
- Fix map-hotspot overlay render spam via a single mapHotspotInList flag.
Job-to-field matching v1: read the field's crop + growth state via
FieldState:update() + FruitTypeDesc growth predicates. Only run tillage when the
field is empty / stubble / cultivated. A field with a growing or ripe crop falls
through to GoTo driving (drive/inspect) so an NPC never plows a crop under.
Sowing and harvesting (seeders / self-propelled harvesters + supply) are staged.
Full farming-cycle job-to-field matching. Each farmer NPC gets a job role
(till/sow/harvest, weighted, seed-based) and spawns the matching unit:
- till: tractor + plow/cultivator (existing)
- sow: tractor + seeder, filled with SEEDS after attach
- harvest: self-propelled combine + brand-matched header
An NPC runs the real AI job only when the field's need matches its role
(getFieldJobType: open = tiller/sower, harvest = harvester, protect = growing crop
never touched); a mismatch falls through to GoTo driving. New SEEDER_POOL and
HARVEST_COMBOS pools, validated against the store. All base-game vehicle paths verified.
- Map-marker overlay spam ("Unknown entity id ... renderOverlay"): switch every
  NPC hotspot to ONE shared overlay created once and never freed. Per-NPC overlays
  were being freed (setPlaceable reset / delete) and then rendered every frame.
  removeMapHotspot no longer deletes (would free the shared overlay); it nulls the
  refs and drops the hotspot from the draw list. setPlaceable runs with the icon
  nulled so it can't free the shared overlay.
- Field-aware job roles: assign a harvester ONLY when the assigned field is
  actually ripe; a growing-crop field gets a tiller (won't till - the work gate
  protects the crop - so the NPC just drives). No more combine parked on growing peas.
- Header/cutter attach: add a jointType-only fallback pass so a header that fails
  the strict subType compatibility check still attaches (a headerless combine can
  do nothing). If it still fails for a harvester, remove the useless combine too.
- Zero the AI cost on GoTo driving jobs (they run under the spectator farm), fixing
  the "Can't change money of spectator farm" errors in the log.
- Growing-crop fields now assign an "inspect" role: a bare tractor (no implement)
  that just drives out to look, instead of dragging a plow over a standing crop.
- Harvest: if the spawned combine can already do field work (carries a header from
  its store config), don't spawn/attach a redundant header (which was failing and
  scrapping otherwise-good combines).
…ost guards

- On-demand spawn/despawn: an NPC's tractor/combine + implement is created at
  the field when they start working (matched to the field's CURRENT need) and
  removed when they stop, instead of pre-spawning from a stale field snapshot.
  Growing fields get no equipment; the NPC visits on foot.
- Cancel the vehicle load if the NPC leaves work before the implement spawns,
  so nothing is created just to be deleted.
- Fix harvester headers never attaching: the New Holland combo listed a header
  file (cr980_830, type=cutter) as its "combine", pairing two headers. Use the
  real combine (chSeries); the header now attaches and harvests.
- Stop "Can't change money of spectator farm" spam: keep NPC vehicle fuel
  topped so the base game never auto-bills the spectator farm for a refuel.
@TheCodingDad-TisonK

Copy link
Copy Markdown
Member Author

Superseded: v1.2.7.0 was released from development (targetCommitish=development), matching how v1.2.6.0/v1.2.6.1 were cut. main is stale at v1.2.5.3 and is not part of the current release flow, so this development->main merge is not needed. Reconciling main with development is a separate cleanup task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant