Skip to content
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

Move ShipRepair screen to pigui #4791

Merged
merged 1 commit into from
Feb 16, 2020

Conversation

impaktor
Copy link
Member

@impaktor impaktor commented Feb 8, 2020

Intro

OK, so I've done the ship repair shop as well. The original had this silly option, to either repair 1 percent-point, or all the damage. I replaced it with a slider.

I'm posting a screenshot with two different styles of hull integrity progress bars, the default ImGUI (yellow), and the pigui gauge (the "pioneery"), please tell me what you think, @nozmajner.

Further future improvements

  • I'm thinking if it's possible to make certain stations be authorized service shops for ships from certain manufacturers. Would give a discount on repairs. (HA! compare that to real "licensed" repair shops, they charge x2 the price!)

  • The original Frontier you did both hull and engine maintenance in the ship repair shop, but engine "health" is in the BreakdownService module, so not available to the station screens. Either way, all equipment will have their own health/damage system in the future, so the BreakdownService module will be kicked out/moved at some point, but that's for another day.

NewUI: What it used to look like

2020-02-08-201724_1600x900_scrot

PiGUI: What it looks like now

2020-02-08-201927_1600x900_scrot

Frontier: What it looked like in the original to our clone

(screenshot from Commodore Amiga version of Frontier)
2020-02-08-194332_1600x900_scrot

@sturnclaw sturnclaw mentioned this pull request Feb 8, 2020
7 tasks
@bszlrd
Copy link
Contributor

bszlrd commented Feb 8, 2020

I think the pigui one would be better. It might be a bit more cluttered, but it is consiszent with the HUD that way.

@sturnclaw
Copy link
Member

@impaktor a couple of tips for you:

  • Sliders allow you to specify the format string, so you could replace that 12 with a 12% Hull text fairly easily. (AFAIK it uses snprintf() internally, so you can man snprintf to see all the options you have available)
  • When the player doesn't have enough money to pay for the selected level of hull repair, turn (at least) part of the "Repair X hull damage for $Y" red to indicate that it's more expensive than the player can currently afford. Remember ui.sameLine(); it lets you append more text to the current line rather than starting a new one with every ui.text() call.
  • The "Pay" button should be wrapped in a ui.withFont() call that uses a larger font; it's a little small right now.

I'm not a fan of either of those gauges; neither of them fit the look of the screen or indicate useful information like how many tons of hull you have remaining, the type of hull material (which is moot right now, because we don't have e.g. military composite hulls), or anything beyond the current hull percentage.

However, because this screen is on it's way out the door anyways, I don't mind a few rough edges in the styling and presentation, so use whatever gauge is the best in your eyes.

Regarding the discounts, I like the idea of a faction-owned shipyard being able to repair their faction's ships cheaper - mostly because they have the required parts easily to hand and are (probably) getting them at a slight discount from the ship manufacturer. In reality, yeah, that's not a thing; dealers and licensed repair shops tend to be more expensive and less honest than a (good!) third party repair shop, but that's neither here nor there.

@impaktor
Copy link
Member Author

impaktor commented Feb 9, 2020

  • I've added a "%" symbol to the slider, and fixed font of pay button.
  • For your second point:
    • I don't understand what it is you think should be on the same line as what?
    • I'll leave it as it is, since no where else do we show the player that he can't afford it, at least not in ship store or equipment market. (Commodity shows yellow text "insufficient funds").

Note: I'll rebase this to master after #4790 is merged, which adds a l.PAY string, that I can use here. I'll also remove some commented out code.

2020-02-09-094250_1600x900_scrot

@impaktor impaktor force-pushed the shiprepair2pigui branch 4 times, most recently from 704fe01 to 48b5452 Compare February 14, 2020 19:31
@impaktor
Copy link
Member Author

OK, I've fixed this up now, there was a bug, due to "get percent hull" function being floating point and applying many small incremental integer repairs got som very small 0.0000001 round thingy, very vague description, but I added a round() function to:

local hullPercent = round(Game.player:GetHullPercent())

which fixed it.
Q do we have any round function in lua? Couldn't find any in utils.lua

beware:

I have a dummy(Vector2(0, 50)) which I should move to widgetSizes, as I did yesterday with #4790, but I'm not sure I want that dummy there at all, or might want to do something smarter. Basically: how do I place the hull percent bar closer to the footer, like the NewUI currently is? Get the (relative?) distance from the bottom? Knowing the height of the station foot / StationView:shipSummary() stuff?

Pardon a vague post.

@impaktor impaktor marked this pull request as ready for review February 14, 2020 19:35
@vakhoir
Copy link
Contributor

vakhoir commented Feb 15, 2020

I haven't looked at the code yet, but just from the screenshot, wouldn't it look better if the hull integrity gauge and the repair slider were to same size?

@sturnclaw
Copy link
Member

@vakhoir that's because the hull integrity gauge is using the ui.gauge method. Ideally we want to redesign gauge drawing entirely (so it's not completely static and making bad assumptions), but that's a topic for another PR methinks.

@impaktor
Copy link
Member Author

Yeah, I know, it looks a bit wonky. If you have suggestions on how to fix, I'm all ears. I plan to do another PR touching this ship repair screen, within a few weeks (ship manufacture specific repair), so maybe I have stronger pigui-fu then.

I just removed that hard-coded Vector2 in the ui.dummy for vertical space, and moved it into widgetSizes, as I suspect we're not going to drill down on that any more, so unless anyone wants to iterate on this more, this should be good to merge now.

Copy link
Contributor

@vakhoir vakhoir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand it's actually the slider that's counter intuitive to deal with, because it has some automatic width calculation. ui.gauge() has an optional width parameter you can pass. The slider can be dealt with by calling ui.pushItemWidth().

You can try also using ui.getContentRegion for calculating the widths, but for a basic solution try the following:

@impaktor
Copy link
Member Author

@vakhoir thanks! That did the trick! I've squashed and rebased.

2020-02-16-165602_1600x900_scrot

@sturnclaw
Copy link
Member

Looks good to me! Merging this in.

@sturnclaw sturnclaw merged commit 8430aaf into pioneerspacesim:master Feb 16, 2020
@impaktor impaktor deleted the shiprepair2pigui branch February 16, 2020 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants