fix: correct bot routing, node lifetime, reload cleanup and spawn placement

Four defects found reviewing this against AzerothCore efe123fab and
mod-playerbots 8d9f6aa6 (both 2026-08-14).

1. Bot routing did nothing. Engine::ChangeStrategy switches on name[0] and
   only handles '+', '-', '~' and '?'; a bare "new rpg" fell through every
   case. Bots still drifted toward the hotspot, but only because
   rpgInfo.ChangeToGoGrind() works and AiFactory already grants the strategy
   when AiPlayerbot.EnableNewRpgStrategy is on. Now sends "+new rpg", and
   only to BOT_STATE_NON_COMBAT -- the combat engine never carries it.

2. Node lifetime was off by 1000x. The respawnTime argument to
   Map::SummonGameObject lands in GameObject::SetRespawnTime(int32), which is
   seconds. Passing DurationMs made a 20-minute event's nodes live ~13.9 days,
   so they only ever vanished via the explicit despawn at event end.

3. LoadConfig cleared _spawnedNodes and _active without despawning, so a
   `.reload config` mid-event orphaned every node permanently (compounded by
   defect 2). It now tears the running event down first.

4. Spawns reused the anchor's exact Z for every scattered X/Y with no ground
   probe and no LOS check, leaving nodes floating or buried on the hilly zones
   in the default pool. Placement now probes ground height, rejects drift
   beyond 20y, requires LOS from the anchor, and retries up to 8 times.

Verified with a clang -fsyntax-only pass using the live build's own compile
flags plus the mod-playerbots include tree.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019vTNrJGsprcjdjjjDJD5ZM
This commit is contained in:
Claude 2026-09-03 16:49:09 +00:00
parent ebef50d438
commit 6244e2bc65
No known key found for this signature in database
2 changed files with 112 additions and 19 deletions

View file

@ -2,6 +2,33 @@
All notable changes to `mod-gold-rush` will be documented in this file.
## [Unreleased — hallsworth fork]
### Fixed
- Bot routing is no longer a silent no-op. `Engine::ChangeStrategy` dispatches on the
first character of the strategy name and ignores anything without a `+`/`-`/`~`/`?`
prefix, so the bare `"new rpg"` calls did nothing. Now sends `"+new rpg"`, and only
to the non-combat engine, which is the only engine `AiFactory` ever adds it to.
- Temporary node lifetime is no longer 1000x too long. The `respawnTime` argument to
`Map::SummonGameObject` reaches `GameObject::SetRespawnTime(int32)`, which is in
seconds; the module was passing milliseconds, turning a 20-minute event into a
~14-day one. Nodes never expired on their own.
- A config reload during a live event no longer orphans its gameobjects. `LoadConfig`
cleared the tracked node list without despawning, leaving nodes in the world with
nothing left to remove them.
- Nodes are placed on real ground. Spawns previously reused the anchor's exact Z for
every scattered X/Y, so on sloped terrain they floated or sank. Placement now probes
ground height, rejects cliffs and lower floors, requires line of sight to the anchor,
and retries a few times before giving up on a node.
### Changed
- Node scatter uses a square-root radius so points spread evenly across the disc
instead of bunching near the anchor.
- `DespawnHotspotNodes` resolves the map once instead of per node, and warns if the
map cannot be resolved.
- Dropped the redundant `SetRespawnTime` / `SetSpawnedByDefault` calls after
`Map::SummonGameObject`, which already does both.
## [Unreleased]
### Added