-
Notifications
You must be signed in to change notification settings - Fork 0
/
CuttersManagerAgain.h
190 lines (162 loc) · 5.42 KB
/
CuttersManagerAgain.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "MechManager.h"
#include "Object.h"
#include "Mechs/Mech_Cutter.h"
#include "UObject/NoExportTypes.h"
#include "CuttersManagerAgain.generated.h"
class AAgentsBehaviorManager;
class ATransportSplineActor;
class AMech_Cutter_Limb;
USTRUCT()
struct FSplineMechInfo
{
GENERATED_BODY()
UPROPERTY()
USceneComponent* oldArmRef = nullptr;
UPROPERTY()
USceneComponent* CurrentArmReference = nullptr;
UPROPERTY()
USceneComponent* CurrentLAnch = nullptr;
UPROPERTY()
USceneComponent* CurrentRAnch = nullptr;
UPROPERTY()
USceneComponent* LeftSocketRef = nullptr;
UPROPERTY()
USceneComponent* RightSocketRef = nullptr;
UPROPERTY()
AActor* SpireRef = nullptr;
};
USTRUCT()
struct FCutterInfos
{
GENERATED_BODY()
UPROPERTY()
TArray<AMech_Cutter_Limb*> Limbs;
UPROPERTY()
TArray<USceneComponent*> LimbAnchors;
UPROPERTY()
TArray<AMech_Cutter_Limb*> WorkingLimbs;
UPROPERTY()
TArray<AMech_Cutter_Limb*> StretchedLimbs;
UPROPERTY()
int32 PrevX = 0;
UPROPERTY()
int32 PrevY = 0;
UPROPERTY()
float ChipHoldings;
UPROPERTY()
TEnumAsByte<EActionTypes> currentJob;
};
/**
*
*/
UCLASS(Blueprintable, BlueprintType)
class UNSATISFACTORY_API UCuttersManagerAgain : public UObject, public IMechManager
{
GENERATED_BODY()
public:
UPROPERTY()
ADisharmonyGameMode* GameMode = nullptr;
UPROPERTY()
AAgentsBehaviorManager* BehaviorManager = nullptr;
UPROPERTY()
TArray<AMech_Cutter*> JoblessCutters;
private:
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> GetArm;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> ConnectSpline;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> DisconnectSpline;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> GrabLinkIn;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> MobileAfterHooks;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> PioneerWork;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> SiteWork;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> LimbSenders;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> Reorient;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> InitWrap;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> WrapPioneer;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> WrapSite;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> LayLink;
UPROPERTY()
TMap<AMech_Cutter*, FPlanAction> LaySite;
//Cutters
UPROPERTY()
TMap<AMech_Cutter*, FCutterInfos> CutterMap;
UPROPERTY()
TMap<AGenericMech*, FSplineMechInfo> SplineMechMap;
//Work tracking
UPROPERTY()
TArray<AMech_Cutter*> CheckLOSCutters;
UPROPERTY()
TArray<AMech_Cutter*> HookWaiters;
//LOS variables
UPROPERTY()
TMap<AMech_Cutter*, FVector> CutterGoodLocationMap;
UPROPERTY(EditAnywhere, Category="Cutter")
FVector CutObstructionOffset = FVector(0,0,2000);
UPROPERTY(EditAnywhere, Category="Cutter")
float MaxDistFromSpire = 40000;
UPROPERTY(EditAnywhere, Category="Cutter")
float MinDistFromSpire = 10000;
//Chip variables
UPROPERTY(EditAnywhere, Category="Cutter")
float ChipCapacity_KG = 40000;
//BPs
UPROPERTY(EditAnywhere, Category="Blueprint References")
UClass* SpActorBPClass = nullptr;
UPROPERTY(EditAnywhere, Category="Blueprint References")
UClass* CutterLimbBP = nullptr;
public:
//Override Functions
virtual void PerformTick(float DeltaTime) override;
virtual void CreateActionObject(FPlanAction action, AActor* agent) override;
virtual TSet<AActor*> ExecuteAllActions() override;
void InitializeCutter(AMech_Cutter* cut);
void SpawnRegisterCutterLimbs(AMech_Cutter* cut, TArray<USceneComponent*> scenes);
private:
//Action Functions
bool GetFreeArm(FPlanAction action, AMech_Cutter* cut);
bool ConnectSplines(FPlanAction action, AMech_Cutter* cut);
bool DisconnectSplines(FPlanAction action, AMech_Cutter* cut);
bool GrabLinkSpireOutgoing(FPlanAction action, AMech_Cutter* cut);
bool IsMobileAfterHooks(FPlanAction action, AMech_Cutter* cut);
bool GetPioneerWork(FPlanAction action, AMech_Cutter* cut);
bool GetSiteWork(FPlanAction action, AMech_Cutter* cut);
TArray<AActor*> SendOutLimbs(FPlanAction action, AMech_Cutter* cut);
bool ReorientForLimbs(FPlanAction action, AMech_Cutter* cut);
TArray<FPlanAction> RecurseUnwind(AActor* tailSpire);
bool InitiateWrapUp(FPlanAction action, AMech_Cutter* cut);
TArray<AActor*> WrapUpPioneerWork(FPlanAction action, AMech_Cutter* cut);
TArray<AActor*> WrapUpSiteWork(FPlanAction action, AMech_Cutter* cut);
bool LayLinkSpire(FPlanAction action, AMech_Cutter* cut);
bool LaySiteSpire(FPlanAction action, AMech_Cutter* cut);
//Related Functions
void RegisterCurrentArm(AGenericMech* mech, USceneComponent* arm);
bool ConnectSplines(AGenericMech* mech, AActor* spire);
void TransferNewSpireSplines(AGenericMech* mech);
void LoadPioneerWork(AMech_Cutter* cut, FVector& attendLoc);
bool LoadSiteWork(AMech_Cutter* cut, FVector& attendLoc);
void MakeAllLimbsFollow(AMech_Cutter* cut, TArray<AActor*> &leftoverAgents);
//Update Functions
void UpdateCheckSpireLOS(TArray<AMech_Cutter*> cutterRemoves);
void UpdateHookWaiters();
public:
FPlanStack GenerateSiteJob(AMech_Cutter* cut, AActor* spireRef, int32 CenterX, int32 CenterY, FVector siteLoc, EActionTypes
siteType);
bool TryStartPioneerJob(AMech_Cutter* cut, TArray<AActor*> &RelevantSpires, int32 CenterX, int32 CenterY, FVector targetLoc);
bool StopAndCheckDone(AMech_Cutter* parent, AMech_Cutter_Limb* limb, bool bStretched);
void SendChips(AMech_Cutter* cut, float amtReceived, int32 &lastSentSocket);
};