-
Notifications
You must be signed in to change notification settings - Fork 0
/
WeaverManager.h
175 lines (147 loc) · 4.29 KB
/
WeaverManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "MechManager.h"
#include "Object.h"
#include "Data/FactoryStructs.h"
#include "Data/PipeStructs.h"
#include "WeaverManager.generated.h"
class AMech_Weaver;
class AAgentsBehaviorManager;
class ADisharmonyGameMode;
USTRUCT()
struct FPumpLayStartingInfo
{
GENERATED_BODY()
FPumpLayStartingInfo(){};
FPumpLayStartingInfo(EPumpType type, FVector endLoc, int32 startSite, bool bOil, bool bWater)
{
PumpType = type;
EndLoc = endLoc;
StartSiteIx = startSite;
bIsOil = bOil;
bIsWater = bWater;
}
UPROPERTY()
TEnumAsByte<EPumpType> PumpType = PT_Garden;
UPROPERTY()
FVector EndLoc = FVector::ZeroVector;
UPROPERTY()
int32 StartSiteIx = -1;
UPROPERTY()
bool bIsOil = false;
UPROPERTY()
bool bIsWater = false;
};
USTRUCT()
struct FWeaverPumpJobs
{
GENERATED_BODY()
UPROPERTY()
TArray<FPumpLayStartingInfo> Jobs;
UPROPERTY()
int32 lastPumpLain = -1;
};
USTRUCT()
struct FUmbLayInfo
{
GENERATED_BODY()
FUmbLayInfo(){};
FUmbLayInfo(FTransform t, int32 id)
{
T = t;
SiteID = id;
}
UPROPERTY()
FTransform T = FTransform();
UPROPERTY()
int32 SiteID = -1;
};
USTRUCT()
struct FWeaverUmbilicalJobs
{
GENERATED_BODY()
UPROPERTY()
TArray<FUmbLayInfo> Jobs;
};
/**
*
*/
UCLASS(Blueprintable, BlueprintType)
class UNSATISFACTORY_API UWeaverManager : public UObject, public IMechManager
{
GENERATED_BODY()
public:
UPROPERTY()
ADisharmonyGameMode* GameMode = nullptr;
UPROPERTY()
AAgentsBehaviorManager* BehaviorManager = nullptr;
private:
UPROPERTY()
TMap<AMech_Weaver*, FPlanAction> LayingRails;
UPROPERTY()
TMap<AMech_Weaver*, FPlanAction> CheckingUmbJob;
UPROPERTY()
TMap<AMech_Weaver*, FPlanAction> SpawningUmbilicals;
UPROPERTY()
TMap<AMech_Weaver*, FPlanAction> FinishingUmiblicals;
UPROPERTY()
TMap<AMech_Weaver*, FPlanAction> SeedingWombs;
UPROPERTY()
TMap<AMech_Weaver*, FPlanAction> BecomingIdle;
UPROPERTY()
TMap<AMech_Weaver*, FPlanAction> LayingPipe;
UPROPERTY()
TMap<AMech_Weaver*, FPlanAction> CheckingNextPipe;
UPROPERTY()
TMap<AMech_Weaver*, FPlanAction> BuildingPump;
UPROPERTY()
TMap<AMech_Weaver*, FPlanAction> CheckPumpJob;
//Weavers
//UPROPERTY()
//TMap<AMech_Weaver*, FRailLayInfo> RailWeaverMap;
UPROPERTY()
TMap<AMech_Weaver*, FPipelineLayPackage> PipeWeaverMap;
UPROPERTY()
TMap<AMech_Weaver*, FSeedInstruction> SeedWeaverMap;
UPROPERTY()
TMap<AMech_Weaver*, FWeaverPumpJobs> WeaverPumpJobs;
UPROPERTY()
TMap<AMech_Weaver*, int32> LastPumpBuilt;
UPROPERTY()
TMap<AMech_Weaver*, FWeaverUmbilicalJobs> WeaverUmbilicalJobs;
UPROPERTY()
TMap<AMech_Weaver*, FUmbLayInfo> WeaverUmbilicalInfo;
//BPs
UPROPERTY(EditAnywhere, Category="Blueprint References")
UClass* RailBP = nullptr;
public:
//Override Functions
virtual void PerformTick(float DeltaTime) override;
virtual void CreateActionObject(FPlanAction action, AActor* agent) override;
virtual TSet<AActor*> ExecuteAllActions() override;
void InitializeWeaver(AMech_Weaver* weav);
private:
//Action Functions
bool LayRail(FPlanAction action, AMech_Weaver* weav);
bool CheckUmbJob(FPlanAction action, AMech_Weaver* weav);
bool SpawnUmbilicals(FPlanAction action, AMech_Weaver* weav);
bool FinishUmbilicals(FPlanAction action, AMech_Weaver* weav);
bool SeedWomb(FPlanAction action, AMech_Weaver* weav);
bool BecomeIdleAttendant(FPlanAction action, AMech_Weaver* weav);
bool LayPipe(FPlanAction action, AMech_Weaver* weav);
bool CheckNextPipe(FPlanAction action, AMech_Weaver* weav);
bool BuildPump(FPlanAction action, AMech_Weaver* weav);
bool CheckPumpJobs(FPlanAction action, AMech_Weaver* weav);
//Related Functions
//bool RegisterFinishedPump(AMech_Weaver* weav);
//void LayRefineryRail(AMech_Weaver* weaver);
//Update Functions
public:
void EnactBuildInstructions(TArray<AMech_Weaver*> weavers, TArray<FVector> destinations, TArray<FString> names, TArray<FPlanStack> startInsts, TArray<int32> siteIx);
void AddSeedInstruction(AMech_Weaver* weav, FVector dest, FString name);
FPlanStack GenerateRefineryPlan(AMech_Weaver* weav, FVector sitePumpTarget, int32 startSite, int32 endSite);
private:
FPlanStack GeneratePumpPlan(AMech_Weaver* weav, EPumpType type, FVector endPoint, int32 startSite, int32 endSite, bool bOil, bool
bWater);
};