27 #include "CoreUObject.h"
29 #include "UObject/Class.h"
31 #include "Fingerprint.h"
33 #include "Mechanism.h"
34 #include "SubjectiveActorComponent.h"
35 #include "SubjectiveUserWidget.h"
37 #include "ApparatusFunctionLibrary.generated.h"
44 : public UBlueprintFunctionLibrary
49 UFUNCTION(BlueprintCallable, BlueprintPure,
50 Meta = (DisplayName =
"Make Fingerprint From Details Array", NativeMakeFunc),
51 Category =
"Apparatus|Fingerprint")
53 MakeFingerprint(
const TArray<TSubclassOf<UDetail>>& Details,
54 const EBootFilter BootState);
60 UFUNCTION(BlueprintCallable, BlueprintPure,
61 Meta = (DisplayName =
"Make Filter From Details Arrays", NativeMakeFunc),
62 Category =
"Apparatus|Filter")
64 MakeFilter(
const TArray<TSubclassOf<UDetail>>& Details,
65 const TArray<TSubclassOf<UDetail>>& ExcludedDetails,
66 const EBootFilter Booting);
72 UFUNCTION(BlueprintCallable, BlueprintPure,
73 Meta = (DisplayName =
"Break Filter", NativeBreakFunc),
74 Category =
"Apparatus|Filter")
76 BreakFilter(
const FFilter& Filter,
77 TArray<TSubclassOf<UDetail>>& Details,
78 TArray<TSubclassOf<UDetail>>& ExcludedDetails,
79 EBootFilter& Booting);
81 UFUNCTION(BlueprintCallable, BlueprintPure,
82 Meta = (DisplayName =
"Fingerprint Matches Filter"),
83 Category =
"Apparatus")
84 static FORCEINLINE
bool
88 return Fingerprint.
Matches(Filter);
91 UFUNCTION(BlueprintCallable, BlueprintPure,
92 Meta = (DisplayName =
"Bit Mask OR", CompactNodeTitle =
"|",
93 Keywords =
"logical | or disjunction",
94 CommutativeAssociativeBinaryOperator =
"true"),
95 Category =
"Apparatus")
102 UFUNCTION(BlueprintCallable, BlueprintPure,
103 Meta = (DisplayName =
"Bit Mask AND", CompactNodeTitle =
"&",
104 Keywords =
"logical & and conjunction",
105 CommutativeAssociativeBinaryOperator =
"true"),
106 Category =
"Apparatus")
113 UFUNCTION(BlueprintCallable, BlueprintPure, Category =
"Apparatus")
116 const TSubclassOf<
UDetail> DetailType);
118 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Apparatus")
121 const TSubclassOf<
UDetail> DetailType);
123 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Apparatus")
127 return CastChecked<USubjectiveActorComponent>(Subjective.GetObject());
134 UFUNCTION(BlueprintCallable, BlueprintPure, Category =
"Apparatus",
135 Meta = (DisplayName =
"Get Actor",
136 Keywords =
"subject subjective"))
137 static FORCEINLINE AActor*
141 if (!SubjectComponent)
return nullptr;
142 AActor* Actor = SubjectComponent->GetOwner();
151 UFUNCTION(BlueprintCallable, BlueprintPure, Category =
"Apparatus",
152 Meta = (DisplayName =
"Get Widget",
153 Keywords =
"subject subjective"))
154 static FORCEINLINE UUserWidget*
157 UUserWidget* SubjectWidget = Cast<UUserWidget>(Subjective.GetObject());
158 return SubjectWidget;
166 UFUNCTION(BlueprintCallable, BlueprintPure, Category =
"Apparatus",
167 Meta = (DisplayName =
"Get Fingerprint",
168 Keywords =
"subject subjective"))
170 GetSubjectiveFingerprint(TScriptInterface<
ISubjective> Subjective)
172 return Subjective->GetFingerprint();
183 UFUNCTION(BlueprintCallable, Category =
"Apparatus",
184 Meta = (DeterminesOutputType =
"DetailType",
185 DisplayName =
"Enable Detail",
186 Keywords =
"subject subjective"))
187 static FORCEINLINE class
UDetail*
189 TSubclassOf<
UDetail> DetailType)
191 return Subjective->EnableDetail(DetailType);
199 UFUNCTION(BlueprintCallable, BlueprintPure, Category =
"Apparatus",
200 Meta = (DisplayName =
"Get Preferred Belt",
201 Keywords =
"subject subjective"))
202 static FORCEINLINE class
UBelt*
203 GetSubjectivePreferredBelt(TScriptInterface<
ISubjective> Subjective)
205 return Subjective->GetPreferredBelt();
211 UFUNCTION(BlueprintCallable, BlueprintPure, Category =
"Apparatus",
212 Meta = (DeterminesOutputType =
"DetailType",
213 DisplayName =
"Has Detail",
214 KeyWords =
"subject subjective contains search"))
215 static FORCEINLINE
bool
217 TSubclassOf<
UDetail> DetailType,
218 const
bool bIncludeDisabled = false)
220 return Subjective->HasDetail(DetailType, bIncludeDisabled);
226 UFUNCTION(BlueprintCallable, BlueprintPure, Category =
"Apparatus",
227 Meta = (DeterminesOutputType =
"DetailType",
228 DisplayName =
"Find Detail",
229 KeyWords =
"by type subject subjective search"))
232 TSubclassOf<
UDetail> DetailType,
233 const
bool bIncludeDisabled = false)
235 return Subjective->FindDetail(DetailType, bIncludeDisabled);
241 UFUNCTION(BlueprintCallable, BlueprintPure, Category =
"Apparatus",
242 Meta = (DisplayName =
"Get Details",
243 KeyWords =
"subject subjective"))
244 static
void GetSubjectiveDetails(
246 const
bool bIncludeDisabled,
252 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Apparatus",
253 Meta = (DeterminesOutputType = "DetailType",
254 DisplayName = "Find Details",
255 KeyWords = "subject subjective by type search"))
256 static TArray<
UDetail*> FindSubjectiveDetails(
258 TSubclassOf<
UDetail> DetailType,
259 const
bool bIncludeDisabled = false);
272 UFUNCTION(BlueprintCallable, Category = "Apparatus",
273 Meta = (DeterminesOutputType = "DetailType",
274 DefaultToSelf = "Subjective",
275 DisplayName = "Add Detail",
276 KeyWords = "subject subjective append"))
277 static FORCEINLINE class
UDetail*
279 TSubclassOf<
UDetail> DetailType,
280 const
bool bReuseInactive = false)
282 checkf(Subjective, TEXT(
"The subject must not be a None."));
283 return Subjective->AddDetail(DetailType, bReuseInactive);
296 UFUNCTION(BlueprintCallable, Category =
"Apparatus",
297 Meta = (DisplayName =
"Disable Detail",
298 KeyWords =
"subject subjective delete remove"))
299 static FORCEINLINE
bool
301 TSubclassOf<
UDetail> DetailType,
302 const
bool bDisableMultiple = false)
304 return Subjective->DisableDetail(DetailType, bDisableMultiple);
310 TScriptInterface<ISubjective> Subjective,
const bool bIncludeDisabled,
311 TArray<UDetail*>& OutDetails)
313 Subjective->GetDetails(bIncludeDisabled, OutDetails);
317 TScriptInterface<ISubjective> Subjective, TSubclassOf<UDetail> DetailType,
318 const bool bIncludeDisabled)
320 TArray<UDetail*> DetailsOut;
321 Subjective->FindDetails(DetailType, DetailsOut, bIncludeDisabled);
322 return MoveTemp(DetailsOut);
326 const TArray<TSubclassOf<UDetail>> &Types,
327 const EBootFilter BootFilter)
333 const TArray<TSubclassOf<UDetail>> &Types,
334 const TArray<TSubclassOf<UDetail>> &ExcludedTypes,
335 const EBootFilter BootFilter)
337 return FFilter(Types, ExcludedTypes, BootFilter);
341 FFingerprint &Fingerprint, TSubclassOf<UDetail> DetailType)
343 return Fingerprint += DetailType;
348 FFingerprint& Fingerprint, TSubclassOf<UDetail> DetailType)
350 return Fingerprint -= DetailType;
354 const FFilter& Filter, TArray<TSubclassOf<UDetail>>& Details,
355 TArray<TSubclassOf<UDetail>>& ExcludedDetails, EBootFilter& Booting)
357 Details = Filter.Fingerprint.Details;
358 Booting = Filter.Fingerprint.BootState;
359 ExcludedDetails = Filter.ExcludedDetails;
An interface for all sorts of subjects.
Definition: Subjective.h:42
The main Apparatus function library.
Definition: ApparatusFunctionLibrary.h:45
static FFilter MakeFilter(const TArray< TSubclassOf< UDetail >> &Details, const TArray< TSubclassOf< UDetail >> &ExcludedDetails, const EBootFilter Booting)
Make a filter from the list of details, exclusion details, and a boot filter.
Definition: ApparatusFunctionLibrary.h:332
static FFingerprint MakeFingerprint(const TArray< TSubclassOf< UDetail >> &Details, const EBootFilter BootState)
Definition: ApparatusFunctionLibrary.h:325
static bool FingerprintMatches(const FFingerprint &Fingerprint, const FFilter &Filter)
Definition: ApparatusFunctionLibrary.h:85
static TArray< UDetail * > FindSubjectiveDetails(TScriptInterface< ISubjective > Subjective, TSubclassOf< UDetail > DetailType, const bool bIncludeDisabled=false)
Find the details by their type.
Definition: ApparatusFunctionLibrary.h:316
static void BreakFilter(const FFilter &Filter, TArray< TSubclassOf< UDetail >> &Details, TArray< TSubclassOf< UDetail >> &ExcludedDetails, EBootFilter &Booting)
Break a filter to an array of details, excluded details and a booting filter.
Definition: ApparatusFunctionLibrary.h:353
static void GetSubjectiveDetails(TScriptInterface< ISubjective > Subjective, const bool bIncludeDisabled, TArray< UDetail * > &OutDetails)
Get the current list of details in the subject.
Definition: ApparatusFunctionLibrary.h:309
static FFingerprint & RemoveDetailFromFingerprint(FFingerprint &Fingerprint, const TSubclassOf< UDetail > DetailType)
Definition: ApparatusFunctionLibrary.h:347
static FFingerprint & AddDetailToFingerprint(FFingerprint &Fingerprint, const TSubclassOf< UDetail > DetailType)
Definition: ApparatusFunctionLibrary.h:340
The conveyor belt consisting of subjects.
Definition: Belt.h:60
The base subject detail (component) class.
Definition: Detail.h:35
Definition: SubjectiveActorComponent.h:39
A memory-efficient bit mask.
Definition: BitMask.h:38
The details filter specification.
Definition: Filter.h:44
The details fingerprint.
Definition: Fingerprint.h:117
bool Matches(const struct FFilter &Filter) const
Check if the fingerprint matches a filter.