diff --git a/Project/Modules/Game Support/Ark.xojo_code b/Project/Modules/Game Support/Ark.xojo_code index 254ab2552..39ef6177a 100644 --- a/Project/Modules/Game Support/Ark.xojo_code +++ b/Project/Modules/Game Support/Ark.xojo_code @@ -534,6 +534,28 @@ Protected Module Ark End Function #tag EndMethod + #tag Method, Flags = &h0 + Function MatchesTags(Extends Blueprint As Ark.Blueprint, RequiredTags() As String, ExcludedTags() As String) As Boolean + If (RequiredTags Is Nil) = False Then + For Each Tag As String In RequiredTags + If Blueprint.IsTagged(Tag) = False Then + Return False + End If + Next + End If + + If (ExcludedTags Is Nil) = False Then + For Each Tag As String In ExcludedTags + If Blueprint.IsTagged(Tag) = True Then + Return False + End If + Next + End If + + Return True + End Function + #tag EndMethod + #tag Method, Flags = &h1 Protected Function NormalizeBlueprintPath(Path As String, FolderName As String) As String Path = Path.Trim diff --git a/Project/Modules/Game Support/ArkSA.xojo_code b/Project/Modules/Game Support/ArkSA.xojo_code index 45b590071..dc5506949 100644 --- a/Project/Modules/Game Support/ArkSA.xojo_code +++ b/Project/Modules/Game Support/ArkSA.xojo_code @@ -581,6 +581,28 @@ Protected Module ArkSA End Function #tag EndMethod + #tag Method, Flags = &h0 + Function MatchesTags(Extends Blueprint As ArkSA.Blueprint, RequiredTags() As String, ExcludedTags() As String) As Boolean + If (RequiredTags Is Nil) = False Then + For Each Tag As String In RequiredTags + If Blueprint.IsTagged(Tag) = False Then + Return False + End If + Next + End If + + If (ExcludedTags Is Nil) = False Then + For Each Tag As String In ExcludedTags + If Blueprint.IsTagged(Tag) = True Then + Return False + End If + Next + End If + + Return True + End Function + #tag EndMethod + #tag Method, Flags = &h1 Protected Function ModTagFromPath(Path As String) As String If Path.BeginsWith("/Game/Mods/") Then diff --git a/Project/Views/Ark/General Dialogs/ArkBlueprintSelectorDialog.xojo_window b/Project/Views/Ark/General Dialogs/ArkBlueprintSelectorDialog.xojo_window index 1ad02de6e..903de76f6 100644 --- a/Project/Views/Ark/General Dialogs/ArkBlueprintSelectorDialog.xojo_window +++ b/Project/Views/Ark/General Dialogs/ArkBlueprintSelectorDialog.xojo_window @@ -436,12 +436,25 @@ End #tag Method, Flags = &h21 - Private Sub AddBlueprintsToList(Blueprints() As Ark.Blueprint, Blacklist() As String, AddToBlacklist As Boolean) + Private Sub AddBlueprintsToList(Blueprints() As Ark.Blueprint, Blacklist() As String, AddToBlacklist As Boolean, CheckTags As Boolean) + Var RequiredTags(), ExcludedTags() As String + If CheckTags Then + Try + RequiredTags = Self.Picker.RequiredTags() + ExcludedTags = Self.Picker.ExcludedTags() + Catch Err As RuntimeException + End Try + End If + For Each Blueprint As Ark.Blueprint In Blueprints If Blacklist.IndexOf(Blueprint.BlueprintId) > -1 Then Continue End If + If CheckTags = True And Blueprint.MatchesTags(RequiredTags, ExcludedTags) = False Then + Continue + End If + Self.List.AddRow(Blueprint.Label, Blueprint.ContentPackName) Self.List.RowTagAt(Self.List.LastAddedRowIndex) = Blueprint @@ -725,11 +738,11 @@ End Var RecentPaths() As String = Preferences.ArkRecentBlueprints(Self.mCategory, Self.mSubgroup) For Each Path As String In RecentPaths Var BlueprintsAtPath() As Ark.Blueprint = DataSource.GetBlueprintsByPath(Path, Self.mMods) - Self.AddBlueprintsToList(BlueprintsAtPath, Blacklist, True) + Self.AddBlueprintsToList(BlueprintsAtPath, Blacklist, True, True) Next Var Blueprints() As Ark.Blueprint = DataSource.GetBlueprints(Self.mCategory, SearchText, Self.mMods, Tags) - Self.AddBlueprintsToList(Blueprints, Blacklist, False) + Self.AddBlueprintsToList(Blueprints, Blacklist, False, True) Self.List.ScrollPosition = ScrollPosition End Sub #tag EndMethod diff --git a/Project/Views/ArkSA/General Dialogs/ArkSABlueprintSelectorDialog.xojo_window b/Project/Views/ArkSA/General Dialogs/ArkSABlueprintSelectorDialog.xojo_window index 88106f0b9..3b793bf13 100644 --- a/Project/Views/ArkSA/General Dialogs/ArkSABlueprintSelectorDialog.xojo_window +++ b/Project/Views/ArkSA/General Dialogs/ArkSABlueprintSelectorDialog.xojo_window @@ -436,12 +436,25 @@ End #tag Method, Flags = &h21 - Private Sub AddBlueprintsToList(Blueprints() As ArkSA.Blueprint, Blacklist() As String, AddToBlacklist As Boolean) + Private Sub AddBlueprintsToList(Blueprints() As ArkSA.Blueprint, Blacklist() As String, AddToBlacklist As Boolean, CheckTags As Boolean) + Var RequiredTags(), ExcludedTags() As String + If CheckTags Then + Try + RequiredTags = Self.Picker.RequiredTags() + ExcludedTags = Self.Picker.ExcludedTags() + Catch Err As RuntimeException + End Try + End If + For Each Blueprint As ArkSA.Blueprint In Blueprints If Blacklist.IndexOf(Blueprint.BlueprintId) > -1 Then Continue End If + If CheckTags = True And Blueprint.MatchesTags(RequiredTags, ExcludedTags) = False Then + Continue + End If + Self.List.AddRow(Blueprint.Label, Blueprint.ContentPackName) Self.List.RowTagAt(Self.List.LastAddedRowIndex) = Blueprint @@ -725,11 +738,11 @@ End Var RecentPaths() As String = Preferences.ArkSARecentBlueprints(Self.mCategory, Self.mSubgroup) For Each Path As String In RecentPaths Var BlueprintsAtPath() As ArkSA.Blueprint = DataSource.GetBlueprintsByPath(Path, Self.mMods) - Self.AddBlueprintsToList(BlueprintsAtPath, Blacklist, True) + Self.AddBlueprintsToList(BlueprintsAtPath, Blacklist, True, True) Next Var Blueprints() As ArkSA.Blueprint = DataSource.GetBlueprints(Self.mCategory, SearchText, Self.mMods, Tags) - Self.AddBlueprintsToList(Blueprints, Blacklist, False) + Self.AddBlueprintsToList(Blueprints, Blacklist, False, False) Self.List.ScrollPosition = ScrollPosition End Sub #tag EndMethod