-
Notifications
You must be signed in to change notification settings - Fork 1
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
feature/ATC-181 #236
feature/ATC-181 #236
Conversation
…an AircraftInstance * Removes commands section in AircraftInstanceModel * Adds AircraftCommander instance to App that gets passed into * InputController * Removes no-undef rule from .eslintrc
…s todos and fixmes to AircraftCommander
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.
Interesting. You're sure you like this abstraction? Everything makes sense, it just seems strange to me. If you like it this way, it definitely works for me... just curious. 😄
@erikquinn as I'm sure you've gathered already, I'm a big fan of small classes with a single concern. The current I have many thoughts on this abstraction that we can talk about at a later date. TL;DR this is a step in the direction of centralizing command of an aircraft, reducing the scope of the note: this won't be merging for a while, I just wanted to get it in front of your eyes sooner rather than later because of the scope of the change here. |
@n8rzz Right, and I'm all for all of that. Why not plug it in soon? At least it would chop the aircraft monstrosity into slightly more bite-size pieces, and a later and better reorganization could always be done. This works though, I'd be fine with the change-- any reason you actively want to hold off on it? |
@erikquinn I'd like to hold off because I had planned on @Dabea doing some method clean up and simplifications. Buuuut, I think that would probably be better accomplished under a new issue. At the very least I'll hold off merging until we're done with #243 so as to avoid any conflicts. |
* @method aircraftTurnPhysics | ||
* This turns the aircraft if it is not on the ground and has not arived at its destenation | ||
*/ | ||
aircraftTurnPhysics() { |
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.
if we are updating aircraft properties, be sure to stay consistent with your naming. This method should likely be called updateAircraftTurnPhysics
/** | ||
* @for AircraftInstanceModel | ||
* @method aircraftTurnPhysics | ||
* This turns the aircraft if it is not on the ground and has not arived at its destenation |
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.
be sure descriptions are at the top of your doc blocks
|
||
if (abs(offset) < turn_amount) { | ||
this.heading = this.target.heading; | ||
} else if ((offset < 0 && this.target.turn === null) || this.target.turn === 'left') { |
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.
is null
a valid value for this.target.turn
? It could be, there are null
s all over the place when there really shouldn't be (but that is a different issue).
In javascript, null
is actually an object. when doing comparisons like this.target.turn === null
you are actually checking to see if that property equals the null
object. That may be different that what you are expecting. If this.target.turn
is initialized as ''
that comparison won't work as expected here because an empty string is not equal to null
.
This is likely correct, but I wanted to call that out just in case.
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 will have to look further in to it. That was the original logic, I will need to trace it back a little to see if it needs a null or ' '.
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'm fairly certain it is set to either 'left'
, 'right'
or null
whenever a turn is assigned. So the comparison should be okay, provided that the logic used within the fms during runHeading
hasn't been changed in this regard. If in doubt, maybe a lodash _isNil()
would do the trick?
…amd decreaseAircraftAltitude
I fixed the merge conflicts and tested and everything looks good, and should not break anything once it is merged with develop. |
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.
Lots of little changes for you with docblocks.
One thing you'll notice, I'm a big fan of early returns. Try hard to avoid else if
or else
statements whenever possible. Often times there is a way to structure the logic so you don't ever need either of the else
s. It also makes the code easier to read and way easier to test.
I like the length of your comments, not too long and right to the point. I think, though, that in some cases you are missing the meat of the methods you are trying to describe. This is something I struggle with constantly, what makes a good comment?
I setup a review app, though I haven't tested this yet. I will try to do that tonight. If I run into any issues, I'll add those here.
Other than the changes I called out, this is coming along nicely. You've made some good abstractions and some nice simplifications. I like where this is heading!
const runway = window.airportController.airport_get().getRunway(this.rwy_arr); | ||
if (this.fms.currentWaypoint.navmode !== WAYPOINT_NAV_MODE.RWY) { | ||
this.fms.setCurrent({ runway: null }); | ||
return false; |
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.
be sure to include an empty line above a return statement
@@ -2254,6 +1196,51 @@ export default class Aircraft { | |||
} | |||
} | |||
|
|||
/** | |||
* This will display a waring and record an illegal approach event | |||
* @for AircraftInstanceModel |
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.
be sure to include an empty line between comments and docblock parameters
|
||
/** | ||
* This will display update the fix for the aircraft | ||
* @for AircraftInstanceModel |
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.
missing empty line
} | ||
|
||
/** | ||
* This will display update the fix for the aircraft |
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.
the wording here is confusing, what is this doing exactly?
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.
Yeah I really had a had time with giving this one a correct name and as well for the comment especially because it is for the FIX command where you change the target heading,
As writing this comment to you I think I found the answer to the strugle
*/ | ||
updateFixTarget() { | ||
const fix = this.fms.currentWaypoint.location; | ||
if (!fix) { |
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.
be sure to include an empty line above if
blocks
let difference = null; | ||
|
||
if (this.target.speed < this.speed - 0.01) { | ||
difference = -this.model.rate.decelerate * window.gameController.game_delta() / 2; | ||
|
||
if (this.isOnGround()) { | ||
// What is 3.5 is this restiance/breaking power? | ||
difference *= 3.5; |
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.
@erikquinn what is 3.5
here?
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.
Haven't the foggiest. I'll see if I can figure it out...
|
||
/** | ||
* This calculates the ground speed | ||
* @for AircraftInstanceModel |
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.
missing empty line
const isInsideAirspace = this.isInsideAirspace(window.airportController.airport_get()); | ||
/** | ||
* This calculates the simplify ground speed | ||
* @for AircraftInstanceModel |
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.
missing empty line
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.
added line
|
||
const isInsideAirspace = this.isInsideAirspace(window.airportController.airport_get()); | ||
/** | ||
* This calculates the simplify ground speed |
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.
this comment is confusing. what exactly are we doing with this method?
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 changed it to
"This uses the current speed information to update the ground speed and position"
That is more clear, Any recommendations for improvement?
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 like that, that is a little more descriptive
|
||
|
||
|
||
|
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.
please remove these empty lines
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.
removed
aircraft.taxi_start = this._gameController.game_time(); | ||
const runway = this._airportController.airport_get().getRunway(aircraft.rwy_dep); | ||
|
||
runway.addQueue(this); |
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.
@Dabea This one is my fault :-(
This line prevents the aircraft info box from appearing when an aircraft has finished taxiing and is first in line to takeoff.
Having abstracted these commands away from the AircraftInstanceModel
, why is this line now incorrect? What should be done to fix it?
…TC-181 Conflicts: - src/assets/scripts/client/aircraft/AircraftInstanceModel.js
completes #181
Creates AircraftCommander class to run commands on an AircraftInstance
resolves both #254 and zlsa#777