this.playerBoughtNewShip = this.playerReplacedShip = function _sc_playerReplacedShip(ship) {...}
Are those functions, above, running twice when the player buys a new ship? Would it be sufficient to just have the playerReplacedShip (or, am I thinking of adding and buying equipment)?
Note: In a future release of Oolite, playerBoughtNewShip will no longer be fired when the ship is replaced using player.replaceShip(). Instead, the playerReplacedShip event should be used. At the moment, both events (playerBoughtNewShip and playerReplacedShip) will fire
That suggests it is currently possible for both playerBoughtNewShip and playerReplacedShip to fire for the same event ?
This is the second time I've seen you refer to Fully Annotated HUD Configuration (hud.plist) File, so I'm glad you seem to find it useful. But, I'll take this opportunity to confess it's not actually "Fully Annotated", as the parameters that control visibility of the HUD elements are not included.
Also, the description of the align parameter of drawASCTarget is incorrect. For this parameter, 0 = left-aligned (the default) and 1 = right-aligned. The note near the top of the file, in the "SPECIAL PARAMETERS DOCUMENTATION" section, claiming it can also be centre-aligned, is a mistake.
I've looked deeper at the milhud*.plist files and noticed they are very similar .
several dials have different colors , a few are only present in one or two of the files.
It seems condensing them in one file would simplify the configuration and could be done using alert_conditions .
Another difference is the crosshair_color setting .
Is there a way to change a global hud setting through script ?
Is there a way to change a global hud setting through script ?
Not directly. The method employed in existing huds is to have items be dependent on custom hidden equipment items, and then add/remove those equipment items via script as required.
I haven't been able to find a method to change crosshair color through script.
Since I want to stay as close as possible to the original HUD, I am now considering the following approach :
create one foo_in-flight-hud.plist with all settings (global/dials/legends) needed in one of green/yellow/red/critical conditions.
Use a command to create 4 foo_<condition>_hud.plist files that only differ in crooshairs_color.
When foo_in-flight-hud.plist changes, rerun the command.
I would have preferred to this in-oxp but that is just not possible.
if (ship.aftShield > ship.maxAftShield) ship.aftShield = ship.maxAftShield;
Do I need to access N-Shield worldscript to use those variables(if so, how?) or did the oolite ship object gain those properties and is the wiki out-of-date ?
Do I need to access N-Shield worldscript to use those variables(if so, how?) or did the oolite ship object gain those properties and is the wiki out-of-date ?
Only the player ship has shields (forward and aft). You can test this by starting a strict game and checking the properties of the main station.
doesn't return anything.
So N-Shields is adding the property to NPC's and then implementing the code to make them work.
Do you need to access these properties? It depends. NPC's don't have shields per-se - they have a boosted max energy amount to simulate shields. For an NPC implementation of your emergency shields mod, you could just add to the energy property of the ship. That way, you don't need to worry about what N-Shields is doing.
Aegidian distinguished between the player ship's shields and the NPCs' lack of them because the NPCs lacked damageable equipment and he was trying to level the playing field.