-
-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TradeShips hyperjump code change #5647
TradeShips hyperjump code change #5647
Conversation
There's still a possibility for this(ex. for Andersen City in Ahonen's Claim in sector Lalande 21185): But in my opinion it doesn't look this bad as showed here:
For example, for moon this will be true at ~6000m, which is still illegal for making the jump. I addressed this in the PR. |
|
Forgot to mention that I also had rare case with old code, where when I was jumping to Bernard's Star from Sol and back and going to the Moon after that, I would see hyperspace cloud below planet's terrain. I have a save to demonstrate what I'm talking about: Haven't seen this with my change, but who knows. I hope this will fix this. |
Ideally, of course, it would be worth solving this problem inside the autopilot, but if such a workaround will reduce the number of victims, I’m for it.
I think this is quite correct behavior.
I'm inclined to think that this is not big of a deal.
It’s strange, it works the same for me, besides, both commands ultimately come down to calling
There are some problems with these functions, as seen in the second video, Probably, you shouldn’t try to |
Didn't do anything really. The death rate for
My bad. I'll try to show and explain what happenes. Giving ship command to fly to body, when ship is more to the center of orbital starport, the more chance it will deviate from the course and fly into the wall instead, especially if it rotates backwards beforehand. AIFlyTo_Near_The_Center.mp4If ship is in the center of orbital station, he will usually fly upwards and also try to go through wall, no matter if it's moving or not. AIFlyTo_Center.mp4This happenes with all commands that tell ship to fly to something ( I spotted another issue:
There's chance of game failing with this: After diging around more, this happenes at this line in
This behaviour is also reproducable in the original Ship's behaviour on Orbital stations.zip Updated saves for current master:
Yes. It is enough to order the ship to undock after making the player a trader. No point in exposing PutShipAtPointOfStation_Ground.mp4For orbital station: PutShipAtPointOfStation_Orbital.mp4 |
For the assertion issue: About Then clicked on said ship and entered this: The next I see that this ship is moved inside my ship. Then I wanted to see what will happen if I move my ship to distant station. I set Gates Spaceport as my navTarget and entered this: My ship just collided with said station on high speed.. I tried to test this on ground station, my ship moved close to it, but it also had high speed that I could never stop with my current fuel reserves that got substracted. |
d3a2db9
to
e993a72
Compare
37584c8
to
5ffb844
Compare
@Max5377 have you read the description of PutShipOnRoute? I would like to point out that if the distance to the target is short enough, a
Yes, because, as I already wrote, the first thing a ship does is try to get out of the "object’s radius" along the normal, that is, along the ray connecting the center of the station and the center of the ship. So, if the ship is lucky and it is exactly on the axis of the station, it will fly through the gate, if it is shifted off the axis, it will crash somewhere. |
@Gliese852 Sorry, math is just not my best subject, really. But, I kinda understand what you mean now. Thanks for clarification. |
@Max5377 Looks like it's still a draft? I see blots in the code (occasionally spaces/tabs at the end of the line), commented out pieces. |
5ffb844
to
0fa0da1
Compare
@Gliese852 I deleted parts of commented old code that doesn't needed anymore. |
@Max5377 Whatever editor you're using, I'm sure it should be trivial to have it nuke trailing white spaces on save. Also to respect tabs/spaces. We have an editorconfig-file |
0fa0da1
to
8f08a06
Compare
@Gliese852 Also pushed fix for |
8f08a06
to
ca59506
Compare
ca59506
to
72f832e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll generally leave the approval and merge duties to @Gliese852 as this is code he's most familiar with. I apologize for the long delay in contributing my review of this code - I've only noticed one issue that I'd appreciate being addressed before merge, but I otherwise would like to merge this in the next few weeks if there are no outstanding objections.
Thank you for addressing these bugs!
@Max5377 I think it’s worth doing a rebase again, in the current state I always have a crash at the beginning of the hyperjump. |
7e023ca
to
2432388
Compare
@Gliese852 Did rebase to current master. Shouldn't crash now. |
2432388
to
7121aea
Compare
TradeShips now will check for distance(altitude) between orbital station(station's parent body) before making the jump. This should address accumulating hyperclouds around stations and rare illegal jumps. The algorithm will be: For orbital stations: 1. Undock; 2. Fly to limits of current orbital station (AIFlyTo); 3. OnAICompleted event fires, tell ship to fly to current system's star; 4. Assign task to check distance between current orbital station and ship, if distance is large enough, make the jump. For ground stations; 1. Undock; 2. Tell ship to fly to current system's star; 3. Assign task to check altitude between current orbital station's parent and ship, if altitude is high enough, make the jump. Additionally: 1. Fixed lua error when hyperjumping with TradeShips debug tab opened; 2. Added function "PutShipIntoOrbit" in "LuaSpace.cpp" to put ship into orbit of the target body; 3. Added two new methods "setPlayerAsTraderDocked" and "setPlayerAsTraderInbound" in "Flow.lua". Co-Authored-By: Gliese852 <[email protected]>
7121aea
to
31aaa64
Compare
This PR is an attempt to fix cluttering hyperclouds around stations and rare illegal jumps almost at the planet's surface. Now
TradeShips
behaviour when undocking looks like this.For orbital stations:
OnAICompleted
event fires, tell ship to fly to current system's star;For ground stations;
The distance and altitude will be selected from a random interval of 20,000 - 240,000 meters.
Demonstration:
Hyperjump_Ground.mp4
Hyperjump_Orbital.mp4
Update: rebase.
Update2:
addEquip
is removed fromsetPlayerAsTraderDocked
andsetPlayerAsTraderInbound
.Added check if player is currently docked (
setPlayerAsTraderDocked
) or there's nearest station (setPlayerAsTraderInbound
).If not, player will not become trader.
Update3: rebase.