Skip to content

Commit 4413e96

Browse files
2 parents 10edc74 + cb8a5c9 commit 4413e96

File tree

58 files changed

+363
-534
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+363
-534
lines changed

Data/Base.rte/AI/CrabAI.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
--[[MULTITHREAD]]--
2-
31
require("AI/NativeCrabAI");
42

53
function Create(self)
64
self.AI = NativeCrabAI:Create(self);
75
end
86

9-
function UpdateAI(self)
7+
function ThreadedUpdateAI(self)
108
self.AI:Update(self);
119
end
1210

Data/Base.rte/AI/DropShipAI.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
--[[MULTITHREAD]]--
2-
31
require("AI/NativeDropShipAI");
42

53
function Create(self)
64
self.AI = NativeDropShipAI:Create(self);
75
end
86

9-
function UpdateAI(self)
7+
function ThreadedUpdateAI(self)
108
self.AI:Update(self);
119
end

Data/Base.rte/AI/HumanAI.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
--[[MULTITHREAD]]--
2-
31
require("AI/NativeHumanAI");
42

53
function Create(self)
64
self.AI = NativeHumanAI:Create(self);
75
end
8-
function UpdateAI(self)
6+
function ThreadedUpdateAI(self)
97
self.AI:Update(self);
108
end
119
function Destroy(self)

Data/Base.rte/AI/RocketAI.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
--[[MULTITHREAD]]--
2-
31
require("AI/PID");
42

53
function Create(self)
@@ -59,7 +57,7 @@ function Create(self)
5957
---------------- AI variables end ----------------
6058
end
6159

62-
function UpdateAI(self)
60+
function ThreadedUpdateAI(self)
6361
self.Ctrl = self:GetController();
6462

6563
if self.PlayerInterferedTimer:IsPastSimTimeLimit() then

Data/Base.rte/AI/TurretAI.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
--[[MULTITHREAD]]--
2-
31
require("AI/NativeTurretAI");
42

53
function Create(self)
64
self.AI = NativeTurretAI:Create(self);
75
end
86

9-
function UpdateAI(self)
7+
function ThreadedUpdateAI(self)
108
self.AI:Update(self);
119
end
1210

Data/Base.rte/Activities/Utility/DeliveryCreationHandler.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function DeliveryCreationHandler:Initialize(activity)
180180
self.teamPresetTables[team]["Actors - Turrets"] = {};
181181

182182
for entity in module.Presets do
183-
if IsMOSRotating(entity) and ToMOSRotating(entity).IsBuyable then
183+
if IsMOSRotating(entity) and ToMOSRotating(entity).IsBuyable and ToMOSRotating(entity).BuyableMode ~= 2 then
184184

185185
local entityInfoTable = {};
186186

Data/Base.rte/Activities/Utility/SaveLoadHandler.lua

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function SaveLoadHandler:SerializeTable(val, name, skipnewlines, depth)
2323
skipnewlines = skipnewlines or false
2424
depth = depth or 0
2525

26-
print("looking at val: ");
27-
print(val)
26+
--print("looking at val: ");
27+
--print(val)
2828
print("with name: ")
2929
print(name)
3030

@@ -57,9 +57,11 @@ function SaveLoadHandler:SerializeTable(val, name, skipnewlines, depth)
5757
tmp = tmp .. (val and "true" or "false")
5858
elseif val.Magnitude then -- ghetto vector check
5959
tmp = tmp .. string.format("%q", "Vector(" .. val.X .. "," .. val.Y .. ")")
60-
elseif val.PresetName and IsMOSRotating(val) then
60+
elseif val.PresetName and IsMOSRotating(val) then -- IsMOSRotating freaks out if we give it something that isn't a preset at all... ghetto here too
6161
val:SetNumberValue("saveLoadHandlerUniqueID", val.UniqueID);
6262
tmp = tmp .. string.format("%q", "SAVELOADHANDLERUNIQUEID_" .. tostring(val.UniqueID))
63+
elseif val.FirstBox then -- ghetto area check
64+
tmp = tmp .. string.format("%q", "SAVELOADHANDLERAREA_" .. tostring(val.Name))
6365
else
6466
tmp = tmp .. '"[inserializeable datatype:' .. type(val) .. ']"'
6567
end
@@ -70,18 +72,6 @@ function SaveLoadHandler:SerializeTable(val, name, skipnewlines, depth)
7072
return tmp
7173
end
7274

73-
function SaveLoadHandler:ParseTableForVectors(tab)
74-
for k, v in pairs(tab) do
75-
if type(v) == "string" and string.find(v, "Vector%(") then
76-
local vector = loadstring("return " .. v)();
77-
tab[k] = vector;
78-
elseif type(v) == "table" then
79-
self:ParseTableForVectors(v);
80-
end
81-
end
82-
83-
end
84-
8575
function SaveLoadHandler:ParseTableForMOs(tab)
8676

8777
for k, v in pairs(tab) do
@@ -169,16 +159,46 @@ function SaveLoadHandler:ParseTableForMOs(tab)
169159
end
170160
end
171161

162+
function SaveLoadHandler:ParseTableForVectors(tab)
163+
for k, v in pairs(tab) do
164+
if type(v) == "string" and string.find(v, "Vector%(") then
165+
local vector = loadstring("return " .. v)();
166+
tab[k] = vector;
167+
elseif type(v) == "table" then
168+
self:ParseTableForVectors(v);
169+
end
170+
end
171+
172+
end
173+
174+
function SaveLoadHandler:ParseTableForAreas(tab)
175+
for k, v in pairs(tab) do
176+
if type(v) == "string" and string.find(v, "SAVELOADHANDLERAREA_") then
177+
local areaName = string.sub(v, 21, -1);
178+
local area = SceneMan.Scene:GetOptionalArea(areaName);
179+
tab[k] = area;
180+
elseif type(v) == "table" then
181+
self:ParseTableForAreas(v);
182+
end
183+
end
184+
185+
end
186+
172187
function SaveLoadHandler:ReadSavedStringAsTable(name)
173188
print(ActivityMan:GetActivity())
174189
print(ActivityMan:GetActivity():LoadString(name))
175190
local savedString = ActivityMan:GetActivity():LoadString(name)
191+
if savedString == "" then
192+
savedString = "{}";
193+
end
194+
176195
local tab = loadstring("return " .. savedString)()
177196
-- Parse for saved MOSRotatings
178197
-- Very mildly inefficient in terms of looping even after resolving a value, but it happens once on startup
179198
print("Parsing table for MOs: " .. name);
180199
self:ParseTableForMOs(tab);
181200
self:ParseTableForVectors(tab);
201+
self:ParseTableForAreas(tab);
182202

183203
return tab;
184204

Data/Base.rte/Activities/Utility/TacticsActorInvalidator.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
function Create(self)
22

3-
if self:StringValueExists("tacticsActorInvalidatorSquadInfo") ~= "" then
3+
if self:StringValueExists("tacticsActorInvalidatorSquadInfo") then
44
--print("tried to create load serialized invalidator")
55
--print(self:LoadString("tacticsActorInvalidatorSquadInfo"))
6-
self.tacticsHandlerSquadInfo = loadstring("return " .. self:GetStringValue("tacticsActorInvalidatorSquadInfo"))()
6+
self.tacticsHandlerSquadInfo = loadstring("return " .. self:GetEncodedStringValue("tacticsActorInvalidatorSquadInfo"))()
77
end
88

99
end
@@ -31,7 +31,7 @@ end
3131
function OnSave(self)
3232

3333
--print("tried to save...?")
34-
self:SetStringValue("tacticsActorInvalidatorSquadInfo", self.saveLoadHandler:SerializeTable(self.tacticsHandlerSquadInfo))
34+
self:SetEncodedStringValue("tacticsActorInvalidatorSquadInfo", self.saveLoadHandler:SerializeTable(self.tacticsHandlerSquadInfo))
3535

3636
end
3737

Data/Base.rte/Activities/Utility/TacticsHandler.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ function TacticsHandler:OnLoad(saveLoadHandler)
7878
end
7979

8080
function TacticsHandler:OnSave(saveLoadHandler)
81-
8281
saveLoadHandler:SaveTableAsString("tacticsHandlerTeamList", self.teamList);
83-
8482
end
8583

8684
function TacticsHandler:InvalidateActor(infoTable)

Data/Base.rte/Devices/Shared/Scripts/BurstFire.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
--[[MULTITHREAD]]--
2-
31
function Create(self)
42
self.shotsPerBurst = self:NumberValueExists("ShotsPerBurst") and self:GetNumberValue("ShotsPerBurst") or 3;
53
self.coolDownDelay = (60000/self.RateOfFire) + 100;

0 commit comments

Comments
 (0)