@@ -21,7 +21,7 @@ function RefineryAssault:SetupBuyDoorAreaTable(self, area)
21
21
22
22
print (" area key: " .. areaKey );
23
23
24
- self .buyDoorTables [areaKey ] = {};
24
+ self .saveTable . buyDoorTables [areaKey ] = {};
25
25
26
26
-- does not work, actors are not added properly yet at this stage
27
27
@@ -30,16 +30,16 @@ function RefineryAssault:SetupBuyDoorAreaTable(self, area)
30
30
-- for mo in MovableMan:GetMOsInBox(box, -1, false) do
31
31
-- print(mo)
32
32
-- if mo.PresetName == "Reinforcement Door" then
33
- -- table.insert(self.buyDoorTables.All, mo)
34
- -- self.buyDoorTables[areaKey][tostring(#self.buyDoorTables.All)] = mo;
33
+ -- table.insert(self.saveTable. buyDoorTables.All, mo)
34
+ -- self.saveTable. buyDoorTables[areaKey][tostring(#self.saveTable .buyDoorTables.All)] = mo;
35
35
-- end
36
36
-- end
37
37
-- end
38
38
39
39
for mo in MovableMan .AddedActors do
40
40
if mo .PresetName == " Reinforcement Door" and area :IsInside (mo .Pos ) then
41
- table.insert (self .buyDoorTables .All , mo )
42
- self .buyDoorTables [areaKey ][tonumber (# self .buyDoorTables .All )] = mo ;
41
+ table.insert (self .saveTable . buyDoorTables .All , mo )
42
+ self .saveTable . buyDoorTables [areaKey ][tonumber (# self . saveTable .buyDoorTables .All )] = mo ;
43
43
end
44
44
end
45
45
@@ -187,6 +187,8 @@ function RefineryAssault:StartActivity(newGame)
187
187
table.insert (self .stageFunctionTable , self .MonitorStage4 );
188
188
189
189
if newGame then
190
+
191
+ self .saveTable = {};
190
192
191
193
-- Always active base task for defenders
192
194
self .tacticsHandler :AddTask (" Brainhunt" , self .aiTeam , Vector (0 , 0 ), " Brainhunt" , 2 );
@@ -201,8 +203,8 @@ function RefineryAssault:StartActivity(newGame)
201
203
-- so each area-specific table will be made up of the actual indexes
202
204
-- in the All table which we can SendCustomOrder with.
203
205
204
- self .buyDoorTables = {};
205
- self .buyDoorTables .All = {};
206
+ self .saveTable . buyDoorTables = {};
207
+ self .saveTable . buyDoorTables .All = {};
206
208
207
209
local area = SceneMan .Scene :GetOptionalArea (" BuyDoorArea_LC1" );
208
210
self :SetupBuyDoorAreaTable (self , area );
@@ -222,13 +224,13 @@ function RefineryAssault:StartActivity(newGame)
222
224
area = SceneMan .Scene :GetOptionalArea (" BuyDoorArea_S3_4" );
223
225
self :SetupBuyDoorAreaTable (self , area );
224
226
225
- self .buyDoorHandler :ReplaceBuyDoorTable (self .buyDoorTables .All );
227
+ self .buyDoorHandler :ReplaceBuyDoorTable (self .saveTable . buyDoorTables .All );
226
228
227
- self .buyDoorTables .teamAreas = {};
228
- self .buyDoorTables .teamAreas [self .humanTeam ] = {};
229
- self .buyDoorTables .teamAreas [self .aiTeam ] = {" LC1" , " LC2" , " S3_1" , " S3_2" , " S3_3" , " S3_4" };
229
+ self .saveTable . buyDoorTables .teamAreas = {};
230
+ self .saveTable . buyDoorTables .teamAreas [self .humanTeam ] = {};
231
+ self .saveTable . buyDoorTables .teamAreas [self .aiTeam ] = {" LC1" , " LC2" , " S3_1" , " S3_2" , " S3_3" , " S3_4" };
230
232
231
- for k , v in pairs (self .buyDoorTables .All ) do
233
+ for k , v in pairs (self .saveTable . buyDoorTables .All ) do
232
234
print (v )
233
235
v .Team = self .aiTeam ;
234
236
end
303
305
304
306
function RefineryAssault :ResumeLoadedGame ()
305
307
306
- print (" loading local refineryassault buy door table..." );
307
- self .buyDoorTables = self .saveLoadHandler :ReadSavedStringAsTable (" buyDoorTables " );
308
- print (" loaded local refineryassault buy door table!" );
308
+ print (" loading local refineryassault save table..." );
309
+ self .saveTable = self .saveLoadHandler :ReadSavedStringAsTable (" saveTable " );
310
+ print (" loaded local refineryassault save table!" );
309
311
310
312
self .Stage = self :LoadNumber (" stage" );
311
313
@@ -322,13 +324,14 @@ function RefineryAssault:ResumeLoadedGame()
322
324
self .buyDoorHandler :OnLoad (self .saveLoadHandler );
323
325
self .deliveryCreationHandler :OnLoad (self .saveLoadHandler );
324
326
325
- self .buyDoorHandler :ReplaceBuyDoorTable (self .buyDoorTables .All );
327
+ self .buyDoorHandler :ReplaceBuyDoorTable (self .saveTable . buyDoorTables .All );
326
328
327
329
end
328
330
329
331
function RefineryAssault :OnSave ()
330
332
331
- self .saveLoadHandler :SaveTableAsString (" buyDoorTables" , self .buyDoorTables );
333
+ self .saveLoadHandler :SaveTableAsString (" saveTable" , self .saveTable );
334
+
332
335
333
336
self :SaveNumber (" stage" , self .Stage );
334
337
@@ -337,7 +340,7 @@ function RefineryAssault:OnSave()
337
340
self :SaveNumber (" stage2HoldingBothConsoles" , self .stage2HoldingBothConsoles and 1 or 0 );
338
341
self :SaveNumber (" stage2HoldTimer" , self .stage2HoldTimer .ElapsedRealTimeMS );
339
342
340
- self :SaveNumber (" stage3ConsolesBroken" , self .stage2ConsolesBroken );
343
+ self :SaveNumber (" stage3ConsolesBroken" , self .stage2ConsolesBroken or 0 );
341
344
342
345
-- Handlers
343
346
self .tacticsHandler :OnSave (self .saveLoadHandler );
0 commit comments