Filter primeable equipment list in red alert (and other conditions?)

An area for discussing new ideas and additions to Oolite.

Moderators: another_commander, winston

Post Reply
User avatar
Milo
---- E L I T E ----
---- E L I T E ----
Posts: 466
Joined: Mon Sep 17, 2018 5:01 pm

Filter primeable equipment list in red alert (and other conditions?)

Post by Milo »

During combat, I don't want to have to cycle past a tea kettle, an ore processor, my ship's library and a bunch of MFD configuration equipment to get to my broadcast comms or APRIL pylon reloader or retro rockets or what have you. After spending several hours already today trying to trim my primeable equipment, I had the sudden epiphany that I don't mind having all the extra stuff in there most of the time ... but during combat, it all gets in the way.

So, I suggest: add another property in equipment.plist that determines whether primeable equipment should be ignored/skipped over by N/Shift-N during red alert. If you want to make it more flexible, you could add a new callback function that would go in the script attached to the equipment, and let the script evaluate the current conditions to decide if it should be visible during red alert.

For best effect, I think that visibility during red alert should be opt-in, default "not visible". This way all the OXPs that have primeable equipment not intended for combat will be skipped over automatically, without having to be changed. And the smaller set of combat-focused OXPs can be updated.

Alternatively, maybe you could give us a way to configure in-game which of the primeable equipment is visible at red alert without having to modify any of the OXPs (not even the combat ones). But I want this feature sooner than later, so please only go this way if it's easy for you to implement.

N.B. I don't think green vs. yellow matters nearly as much as red vs. not-red for filtering here, which is why I keep mentioning red alert. However, if done via a new conditions-type callback in the attached script, it could have several other possible return values besides just "yes, filter me in red alert" (default if callback is not implemented in the script) or "don't filter me in red alert" ... for example, it could return "filter me in both red and yellow" or "filter me in green and yellow" (i.e., visible in-combat only).

Edited to add: I realized it is possible to implement this concept as an OXP with the tools we have already. The playerChangedPrimedEquipment(equipmentKey) callback handler signals when the primed equipment changes (although we can't tell if it is because the player pressed N or Ctrl-N or because another OXP changed it -- providing that information would be a useful enhancement), we can "skip" primeable equipment by using player.ship.setPrimeableEquipment(key) to jump to different equipment, and we can access the list of all equipment in player.ship.equipment, filter for elements with scriptName.length > 0 to identify primeable equipment, and for each of those elements, the equipmentKey property corresponds to the key that we receive in playerChangedPrimeEquipment or that we pass into setPrimeableEquipment to prime that equipment.

Unfortunately, the order of elements in player.ship.equipment is different from the order that pressing N or Ctrl-N cycles through them (I'm not sure why?), which complicates figuring out where you are in the cycle. The Primeable Equipment MFD OXP solves it with a manual calibration, but it would be better if we could avoid that. In any case, we seem to have the tools necessary. What remains is configuration to decide which primeable equipment to skip under which conditions, which ideally would be dynamic, letting the player set various flags for each of the primeable equipment they have (e.g., skip in green alert, skip in yellow alert, skip in red alert, skip when target selected, skip when no target selected, skip when weapons online, skip when weapons offline).

I think Primeable Equipment MFD and Station Options are good starting points, although Station Options predefines all options in missiontext.plist so making that dynamic will require a bit of adjustment.
Post Reply