Skip to content

Commit

Permalink
feat(enhancement): Autocondition for testing if you can land on a giv…
Browse files Browse the repository at this point in the history
…en planet (#9716)
  • Loading branch information
Amazinite committed Feb 17, 2024
1 parent 341a85a commit 9a85e9b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions source/PlayerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3772,6 +3772,15 @@ void PlayerInfo::RegisterDerivedConditions()
visitedSystemProvider.SetGetFunction(visitedSystemFun);
visitedSystemProvider.SetHasFunction(visitedSystemFun);

auto &&landingAccessProvider = conditions.GetProviderPrefixed("landing access: ");
auto landingAccessFun = [this](const string &name) -> bool
{
const Planet *planet = GameData::Planets().Find(name.substr(strlen("landing access: ")));
return (planet && flagship) ? planet->CanLand(*flagship) : false;
};
landingAccessProvider.SetGetFunction(landingAccessFun);
landingAccessProvider.SetHasFunction(landingAccessFun);

auto &&pluginProvider = conditions.GetProviderPrefixed("installed plugin: ");
auto pluginFun = [](const string &name) -> bool
{
Expand Down

0 comments on commit 9a85e9b

Please sign in to comment.