Fix the accumulation of zombie traders and some other unnecessary things#5783
Conversation
Recently the 'onShipDocked' event stopped being emitted when a ship is spawned inside a station, but the TradeShips module was not adapted to this.
Without this, the ship will either crash when attempting to land, or receive an autopilot error if it attempts to begin docking from a planet's orbit.
The logic was that after each call, add 'every' to 'at' and get a new call time. Naturally, after some time acceleration, 'at' was very behind the current time, and the callback was called every frame because it was always overdue.
| * | ||
| * Returns: | ||
| * | ||
| * acceleration - number, m/s/s |
There was a problem hiding this comment.
pointless nitpick from me: do we want m/s/s or m/s^2 ?
Or just delete them... the player won't notice, and log a warning |
sturnclaw
left a comment
There was a problem hiding this comment.
occasionally the tradeship runs out of fuel
This sounds like a SAR mission opportunity to me.
@Gliese852 thank you for taking the time to dig into this issue! Very good catch with the life support callback remaining as a zombie, that was definitely my fault when I moved the callback from C++ into Lua. I think the callback requires further thought - it really only needs to run every 5 seconds for the player's ship - all others can have it run once every hour or so. We'd technically lose some "systemic gameplay" from making it player-only, but NPC tradeships probably shouldn't be created with missing life support equipment when carrying perishable cargo.
The GetThrusterAcceleration method is fine as-is, though I'd like to make the Propulsion component directly available via ship:GetComponent("Propulsion") and move most of the "passthrough" thruster-related APIs to that component.
I wish we could start connecting modules like this! I guess within SAR I could check for any ships without fuel? Hmm..... |
|
SAR missions from out-of-fuel ships also will likely giv a different kind of mission, maybe even a more urgent one. |
The pioneer/data/modules/System/OutOfFuel.lua Line 18 in a7f2781 |
|
@nozmajner
In our case, these are almost always ships that have wasted their fuel during maneuvers while waiting for docking, so they are most likely hanging out in a low orbit. |
|
In case the SAR discussion is serious, I think it would be better to just blow up the NPC ship when it runs out of fuel. Connecting SAR to it sounds like a lot of work, and to generate missions for something that's not really supposed to happen seems like difficult to debug (unless it's built into the Tradeship module that some fraction should run out of fuel and call on SAR). |
I also thought the tradeship could be refueled a little. |
🤔 yes, I guess that would be a less violent option 😆 NPC behaviour far from a player doesn't really need a lot of finesse, as long as things keep working they might as well have infinite fuel. Does the player care if an NPC across the star system has fuel issues? WIll they even know? My suggestion would be to just delete them, or refuel them, the player won't notice either way unless it happens right in front of them... so of the two, refuel seems safest unless you want to add a distance test to refuel those closer than 1 AU and delete any further away |
|
Always pick the "Keep It Simple Stupid" option with something like this, then make a note to fix WHY they're running out of fuel later, and even later on add a SAR mission if someone wants to do that. |
This gets my vote. I'll make a note of the idea to maybe hook up SAR to out of fuel ships irrespective of which module they come from. But that's outside of this scope. |
7a123f8 to
233d08d
Compare
Timer.CallEvery terminates if the callback returns true, corrected the returned parameters and forwarded it. Otherwise, they accumulated over time.
233d08d to
312718d
Compare
|
Sorry, I made a small force push, otherwise LifeSupport check would have been disabled when docking, and wouldn't turn on again. |
|
Tested this, apparently, after more than a year, there are approximately the estimated number of tradeships. Although fps does drop over time - this is due to the fact that Mola Ramsayi accumulate over the pads and cannot dock - the model does not have a "landing spike". A very detailed collision test going on there and it consumes a lot of CPU. @nozmajner is already aware and promised to correct the model. And this will be the final nail in the coffin #5735 |


Collected the simplest, but quite effective fixes so that when you stay in one system for a long time, there is no noticeable drop in performance.
Fixes #5735
(taking into account that #5127 and #5785 are merged)
Although at least there remains the problem that occasionally the tradeship runs out of fuel; repairing it probably requires serious intervention in the autopilot, or the creation of evacuation ships, for example.just explode them