endless-sky
endless-sky copied to clipboard
New auto-conditions: total ships, outfits, visited locations, and more
Feature: This PR implements new sets of auto-conditions that resolve a number of issues.
Feature Details
This PR is essentially a combination of two of my older PRs, #4561 and #5412, except using the new mechanics from #5244. This effectively resolves #2494, #3735, and #4002. (For #4002 it isn't an exact resolution of the discussion being had, but the flexibility of the new conditions compared to the inflexibility of require
does look to me as though it resolves the underlying issue.)
This PR adds the following new auto-conditions:
-
"total ships"
: Simply adds up all the ships in the player's fleet which aren't destroyed. Unlike"ships: <category>"
, this does not discriminate on whether the ship is present or not. -
"ship model: <model>"
: Returns the number of the given ship model which the player owns and are present with the player, using the same behavior as the existing"ships: <category>"
condition. -
"ships (all): <category>"
: Behaves as"ships: <category"
does, but checks the entire player's fleet instead of only the present and active ships. -
"ship model (all): <model>"
: Same as"ship model: <model>"
, but checks the entire player's fleet instead of only present and active ships. -
"visited planet: <planet>"
: Returns 1 if the given planet has been visited. Returns 0 otherwise. -
"visited system: <system>"
: Returns 1 if the given planet has been visited. Returns 0 otherwise. -
"outfit: <outfit>"
: Returns the number of the given outfit which are present/local with the player. "Present"/"local" is defined as the following:- If the player is in orbit, "present" is any outfit installed on or in the cargo of in-system ships which are also in orbit (i.e. parked ships in-system don't count).
- If the player is landed, "present" is any outfit installed on any landed ships (i.e. disabled ships in-system don't count), in the player's pooled cargo, or in storage on the planet the player is landed on.
-
"outfit (all): <outfit>"
: Returns the number of the given outfit that the player owns. Checks all possible locations for the outfit. -
"outfit (installed): <outfit>"
: Returns the number of the given outfit installed on any of the player's ships which would qualify as present/local. -
"outfit (all installed): <outfit>"
: Returns the number of the given outfit installed on any of the player's ships. This includes the flagship. -
"outfit (flagship installed): <outfit>"
: Returns the number of the given outfit installed on the player's flagship. -
"outfit (cargo): <outfit>"
: Returns the number of the given outfit in the cargo of the player's ships which would qualify as present/local. -
"outfit (all cargo): <outfit>"
: Return the number of the given outfit in cargo on any of the player's ships. This includes the flagship. If landed, the pooled cargo is also checked. -
"outfit (flagship cargo): <outfit>"
: Returns the number of the given outfit in cargo on the player's flagship. If landed, the pooled cargo is also checked. -
"outfit (storage): <outfit>"
: Returns the number of the given outfit that the player has in storage on the currently landed planet. If not landed, returns nothing. -
"outfit (all storage): <outfit>"
: Returns the number of the given outfit that the player has in storage anywhere in the galaxy.
Since we can take the values of conditions and manipulate them as we please, I haven't created an exhaustive list of all possible locations that could be checked for outfits as I did with #4561, as the addition and subtraction of various provided conditions can result in new location checks. For example:
- flagship installed and cargo = effectively the behavior of
require
at current - all installed and/or all cargo - flagship installed and/or cargo = escorts installed and/or cargo
- all outfits - present outfits = all absent outfits
- all storage - present storage = all absent storage
- all present - present storage = present outfits on ships
- And so on...
For content creators, are there any other specific locations that you would want to search that you feel are not covered, either directly by the new auto-conditions or by any combination thereof?
UI Screenshots
N/A
Usage Examples
Use the auto-conditions described above as you would any other.
The following would check if you have a jump drive anywhere with you, be that installed on a present ship, in cargo, or in storage.
to offer
has "outfit: Jump Drive"
The following would check if you have a jump drive anywhere in the galaxy.
to offer
"outfit (all): Jump Drive" > 0
Testing Done
It sure does compile, I'll give it that.
Performance Impact
N/A
I've created two new conditions, "ships (all): <category>"
and "ship model (all): <model>"
for checking every ship in the player's fleet. The conditions without the parentheticals will remain as only checking the present and active ships for compatibility purposes, and the parentheticals being incongruous with the ones used for outfits (i.e. "outfit: <outfit>"
checks everywhere but "ships: <category>"
only checks present and active) is similarly a matter of compatibility, since the ships condition came first.
Related: #6628
The code looks good, and I like the explicit (all)
addition for looking at ships everywhere, while the default for ships is "locally only".
I feel that such an approach also would work well for outfits, along the lines of:
-
outfit: <outfit>
: The amount of some outfit available to the player locally. -
outfit (all): <outfit>
: The amount of some outfit available to the player anywhere. -
outfit (installed): <outfit>
: The amount of some outfit installed in players ships locally. -
outfit (all installed): <outfit>
: The amount of some outfit installed in players ships anywhere. -
outfit (storage): <outfit>
: The amount of some outfit available in storage in the current system (when not landed) or on the current planet (when landed). -
outfit (all storage): <outfit>
: The amount of some outfit available in storage anywhere.
The outfit prefixes are now as follows:
-
"outfit: "
: All local outfits.-
"outfit (installed): "
: All local installed.-
"outfit (flagship installed): "
: All installed on the flagship.
-
-
"outfit (cargo): "
: All local cargo.-
"outfit (flagship cargo): "
: All in cargo on the flagship (or the pooled cargo if landed).
-
-
"outfit (storage): "
: All local storage.
-
-
"outfit (all): "
: All outfits anywhere.-
"outfit (all installed): "
: All installed anywhere. -
"outfit (all cargo): "
: All cargo anywhere. -
"outfit (all storage): "
: All storage anywhere.
-