Skip to content

Commit

Permalink
Suppressed a repetitious Body scanned event which could occur after…
Browse files Browse the repository at this point in the history
… mapping.

Resolves #2633
  • Loading branch information
Tkael committed Jul 29, 2024
1 parent fabd465 commit ecfdcc9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ Full details of the variables available for each noted event, and VoiceAttack in
## 4.1.0-b1
* Core
* Added `sourcesystem`, `sourcebody`, `collected`, and `delivered`, properties to the `mission` object.
* Commodities now have a `corrosive` boolean property.
* Removed `haulageData` map from the `cargo` object, add `missionCargo` dictionary object in its place.
* Suppressed a repetitious `Body scanned` event which could occur after mapping. (#2633)
* The `need` property of `cargo` is now calculated after resolvers have handled events (to minimize cross linking between the Cargo and Mission Monitors).
* Commodities now have a `corrosive` boolean property
* Crime Monitor
* An interstellar bounty applies when fines or bounties for factions aligned with a superpower exceed 10,000 credits.
* Speech Responder
Expand Down
7 changes: 7 additions & 0 deletions EDDI/EDDI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3029,6 +3029,13 @@ private bool eventBodyScanned(BodyScannedEvent theEvent)
// We just scanned a body. We can only proceed if we know our current star system
if (CurrentStarSystem == null) { return false; }

// Suppress repetitious `Body scanned` events generated within 10 seconds after mapping.
var systemBody = CurrentStarSystem.bodies.FirstOrDefault( s => s.bodyname == theEvent.bodyname );
if ( systemBody?.scannedDateTime != null && systemBody.mappedDateTime < ( theEvent.timestamp + TimeSpan.FromSeconds( 10 ) ) )
{
return false;
}

CurrentStarSystem.AddOrUpdateBody(theEvent.body);

Logging.Debug("Saving data for scanned body " + theEvent.bodyname);
Expand Down

0 comments on commit ecfdcc9

Please sign in to comment.