Docked HUDs OXP

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2959
Joined: Sat Jun 11, 2011 6:07 am
Location: Nova Hollandia
Contact:

Re: Docked HUDs OXP

Post by Wildeblood »

Check my logic, please, someone/anyone: will this actually select all of these six HUD files:-

docked-market-screens-hud.plist <--- new.
docked-need-fuel-hud.plist
docked-need-missiles-hud.plist
docked-full-missiles-hud.plist <--- the old docked-need-nothing-hud.plist renamed.
docked-extra-missiles-hud.plist <--- new, variant for more than 12 missiles.
docked-clock-only-hud.plist <--- new, big_gui compatible.

- at the intended times?

Code: Select all

    this._selectDockedHUD = function () {
        var self = player.ship;

     // 1. Are we on the market screens?

        if (guiScreen === "GUI_SCREEN_MARKET" || guiScreen === "GUI_SCREEN_MARKETINFO") {
            if (self.equipmentStatus("EQ_AI_TRADING_ASSISTANT") === "EQUIPMENT_OK") {
                return;
            } else {
                self.hud = "docked-market-screens-hud.plist";
                return;
            }

     // 2. Do we need fuel?

        } else if (self.fuel < 7) {
            self.hud = "docked-need-fuel-hud.plist";
            return;

     // 3. Do we need missiles?
     //    OR
     // 4. Are we on the equipment screen?

        } else if (self.missileCapacity > self.missiles.length ||
            guiScreen === "GUI_SCREEN_EQUIP_SHIP") {

            if (self.missileCapacity > 12) {
                self.hud = "docked-extra-missiles-hud.plist";
                return;
            } else if (self.missileCapacity > self.missiles.length) {
                self.hud = "docked-need-missiles-hud.plist";
                return;
            } else if (guiScreen === "GUI_SCREEN_EQUIP_SHIP") {
                self.hud = "docked-full-missiles-hud.plist";
                return;
            }
            return;

     // 5. If we reach here, then allow_big_gui

        } else {
            self.hud = "docked-clock-only-hud.plist";
            return;
        }
    }
I hate the mess on the equipment screen, where things get checked twice.
R.I.P. John Lodge, 1943-2025.
User avatar
Krager
---- E L I T E ----
---- E L I T E ----
Posts: 295
Joined: Wed Dec 11, 2024 9:44 pm
Location: Russian

Re: Docked HUDs OXP

Post by Krager »

Я в коде не разбираюсь, могу только готовый продукт попробовать)
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5674
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Docked HUDs OXP

Post by phkb »

Wildeblood wrote: Sat Mar 21, 2026 8:05 am
Check my logic, please

Code: Select all

        } else if (self.missileCapacity > self.missiles.length || guiScreen === "GUI_SCREEN_EQUIP_SHIP") {

            if (self.missileCapacity > 12) {
                self.hud = "docked-extra-missiles-hud.plist";
                return;
            } else if (self.missileCapacity > self.missiles.length) {
                self.hud = "docked-need-missiles-hud.plist";
                return;
            } else if (guiScreen === "GUI_SCREEN_EQUIP_SHIP") {
                self.hud = "docked-full-missiles-hud.plist";
                return;
            }
            return;
I think the final check of guiScreen is unnecessary, and I think the missile checking could be streamlined, like this:

Code: Select all

        } else if (self.missileCapacity > self.missiles.length || guiScreen === "GUI_SCREEN_EQUIP_SHIP") {

            if (self.missileCapacity > self.missiles.length) {
                if (self.missileCapacity > 12) {
                    self.hud = "docked-extra-missiles-hud.plist";
                } else {
                    self.hud = "docked-need-missiles-hud.plist";
                }
            } else {
                self.hud = "docked-full-missiles-hud.plist";
            }
            return;
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5674
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Docked HUDs OXP

Post by phkb »

And a small suggestion: You don't really need all those "return;" statements. As there's no code after the "if" statements, the code will naturally return without being told specifically. So you could make it just:

Code: Select all

    this._selectDockedHUD = function () {
        var self = player.ship;

     // 1. Are we on the market screens?

        if (guiScreen === "GUI_SCREEN_MARKET" || guiScreen === "GUI_SCREEN_MARKETINFO") {
            if (self.equipmentStatus("EQ_AI_TRADING_ASSISTANT") !== "EQUIPMENT_OK") {
                self.hud = "docked-market-screens-hud.plist";
            }

     // 2. Do we need fuel?

        } else if (self.fuel < 7) {
            self.hud = "docked-need-fuel-hud.plist";

     // 3. Do we need missiles?
     //    OR
     // 4. Are we on the equipment screen?

        } else if (self.missileCapacity > self.missiles.length ||
            guiScreen === "GUI_SCREEN_EQUIP_SHIP") {

            if (self.missileCapacity > self.missiles.length) {
                if (self.missileCapacity > 12) {
                    self.hud = "docked-extra-missiles-hud.plist";
                } else {
                    self.hud = "docked-need-missiles-hud.plist";
                }
            } else {
                self.hud = "docked-full-missiles-hud.plist";
            }

     // 5. If we reach here, then allow_big_gui

        } else {
            self.hud = "docked-clock-only-hud.plist";
        }
    }
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2959
Joined: Sat Jun 11, 2011 6:07 am
Location: Nova Hollandia
Contact:

Krager!!!

Post by Wildeblood »

Does anyone have any opinions regarding a colour scheme? Back when I first created this we had a choice of green, so it was easy to choose (I chose green, by the way). But if there's an argument for another colour, now would be a good time to proffer it.
R.I.P. John Lodge, 1943-2025.
Post Reply