-
-
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
Formatting fixes and mean density in the System Editor #6058
base: master
Are you sure you want to change the base?
Conversation
Fixed up gravitational acceleration. I'm not quite sure what changes would be needed in Format for a more permanent solution. |
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 think these are good, I don't see any issues with the code 👍
Right, I agree. Still, parts of this should probably be fixed in Format but I haven't wrapped my head around it yet. It's not a new issue though and can be fixed up later. |
I squashed it down to two commits. |
Tons per cubic meter is (AFAIK) directly equivalent to grams per cubic centimeter; i.e. the number is the same regardless of the suffix (cm3 -> m3 is a 10^6 increase, as is grams -> tons). While the SI unit is technically more correct to use, I have no preference either way. |
I also have no preference. Right now it's t/m³ in the System Overview and g/cm³ in the System Editor. Maybe should settle for one of them? My guess is that t/m³ feels a bit more intuitive when you're dealing with something larger like a planet. At least it does to me. |
{ name = lc.ESCAPE_VELOCITY, icon = icons.body_radius, | ||
value = (not starport) and ui.Format.Speed(body.escapeVelocity , true) or nil }, | ||
{ name = lc.MEAN_DENSITY, icon = icons.body_radius, | ||
value = (not starport) and ui.Format.Mass(body.meanDensity).."/m3" or nil }, | ||
value = (not starport) and ui.Format.Mass(body.meanDensity).."/m³" or nil }, |
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.
@sturnclaw I looked into changing the mean density to g/cm in this PR but I think this would need some work. Right now we're (I really as I'm the one responsible for the original addition) just using Format.Mass which is in tons and stick a /m³ to the end. To change this to g/cm we would need something like a new Format.Density to call. Also, instead of using Format.Mass, one could just use body.meanDensity and fix the format manually. Maybe I missed a way but I think adding a new Format.Density is the best way to do it.
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.
Adding Format.Density would be fine, as would changing the line to be ui.Format.Number(body.meanDensity, 3) .. lc.UNIT_DENSITY
with UNIT_DENSITY
being defined as the appropriate g/cm^3
. Regardless of the tack taken, the unit suffix should ideally be a localized string for consistency (as unlikely as it is for SI units to be written differently in other languages...)
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.
OK. The SI unit for density (Wikipedia) is kg/m3 and that's what you get from calcMeanDensity. You need to divide with 1000 (like I did in the editor) so you get ui.Format.Number(body.meanDensity / 1000.0, 3)
I'll poke around some more with it.
Some fixes in physical descriptions.
range.
Before

Fixed

Some question marks.