Skip to content

ModuleMan Refactoring and Improvements #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 80 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
0f1c74a
Init ModuleMan
MaximDude Jul 13, 2023
78bac76
Preliminary cleanup in PresetMan
MaximDude Jul 13, 2023
fb02e2e
Move disabled mods list form SettingsMan to ModuleMan
MaximDude Jul 13, 2023
43db9cd
VS being stupid about filters for the 9001th time
MaximDude Jul 14, 2023
5f75ded
Move all DataModule handling from PresetMan to ModuleMan and enter hell
MaximDude Jul 14, 2023
401f710
Unclusterfucking (followup to 5f75ded4dcf0a39924c7bdef1e1dbb26433fa48e)
MaximDude Jul 14, 2023
a05875f
Shittily make this compile
MaximDude Jul 14, 2023
4d860b4
Remove a bunch of unnecessary includes
MaximDude Jul 14, 2023
b792f6c
Destroy ModuleMan instead of PresetMan (followup to a05875f9b593de1c1…
MaximDude Jul 14, 2023
65abdbb
Measure module loading time in Main
MaximDude Jul 16, 2023
bc6b276
Expose ModuleMan to Lua
MaximDude Jul 16, 2023
abe564b
Remove ModuleMan::LoadDataModule Lua binding - this is kinda bullshit…
MaximDude Jul 16, 2023
97afdf6
Misc changes in Main arg handling
MaximDude Jul 16, 2023
d026aff
More unclusterfucking (followup to 5f75ded4dcf0a39924c7bdef1e1dbb2643…
MaximDude Jul 16, 2023
01096e2
Forgot to actually register ModuleMan in master state (followup to bc…
MaximDude Jul 16, 2023
00c8b9d
Cleanup, formatting and partial refactor in PresetMan
MaximDude Jul 16, 2023
126d5a2
I accidentally (followup to bc6b276cc788209166e5513278d28a548c97669b)
MaximDude Jul 17, 2023
5773dd5
Simplify PresetMan by group, by type and random Entity list getters -…
MaximDude Jul 17, 2023
895556c
Refactor DataModule type flags - use an enum
MaximDude Jul 18, 2023
f2d7b90
Remove PresetMan TotalGroupRegister - we just get everything we need …
MaximDude Jul 18, 2023
e5c02b8
Don't assign module IDs at DataModule creation - ModuleMan will assig…
MaximDude Jul 18, 2023
8ba00c7
Use DataModuleType instead of separate params in ModuleMan::LoadDataM…
MaximDude Jul 19, 2023
abafd37
Pull loading userdata modules into private method and merge with Data…
MaximDude Jul 19, 2023
4bd9404
Pop the console open if the specified single module to load failed to…
MaximDude Jul 19, 2023
3c375a5
Store loaded modules less stupidly
MaximDude Jul 19, 2023
ca30a46
Don't care about official module count - container is unsorted, just …
MaximDude Jul 19, 2023
8df894c
My diff is a clusterfuck and I have a stack overflow AAAAAAAAAAAAAAAA…
MaximDude Jul 19, 2023
bfa9498
Don't store module ID ContentFile was loaded from - get it from path …
MaximDude Jul 19, 2023
fcccdd6
Call ModuleMan instead of PresetMan where necessary (followup to cort…
MaximDude Jul 19, 2023
64f97ed
Refactor all the ModuleMan things and last bit of unclusterfucking (f…
MaximDude Jul 19, 2023
e15ad77
Add overload for ModuleMan::GetDataModule that gets with name instead…
MaximDude Jul 19, 2023
cd2a70b
PresetMan followup (followup to 64f97edd03a23108a7ad9f5ae9646927d918b…
MaximDude Jul 19, 2023
4f78139
Merge branch 'development' into ModuleMan
MaximDude Jul 19, 2023
57ea9a5
No need to suppress warning 4129 anymore - not using fucky escape seq…
MaximDude Jul 19, 2023
525ff6f
Merge branch 'development' into ModuleMan
MaximDude Jul 23, 2023
ca33886
Don't need ClassName because this doesn't get serialized
MaximDude Jul 23, 2023
aa243de
Use unordered set for disabled module names
MaximDude Jul 23, 2023
e862789
Misc organization
MaximDude Jul 23, 2023
b3da7d8
Handle loading and unloading modules at runtime
MaximDude Jul 27, 2023
0367930
Always repopulate faction comboboxes when Activity config GUI is enab…
MaximDude Jul 27, 2023
b4981bc
Merge branch 'development' into ModuleMan
Causeless Dec 31, 2023
4399314
Fixed crash on load
Causeless Dec 31, 2023
3af3a7f
Merge branch 'development' into ModuleMan-Followup
Causeless Dec 31, 2023
c1cdba2
Merge branch 'development' into ModuleMan
Causeless Jan 1, 2024
fa53af4
Merge remote-tracking branch 'source/ModuleMan' into ModuleMan
traunts Jan 2, 2024
95ade2a
Merge remote-tracking branch 'data/ModuleMan-Followup' into ModuleMan
traunts Jan 2, 2024
c8e435c
Merge branch 'development' into ModuleMan
traunts Jan 2, 2024
bb44c24
Merge branch 'development' into ModuleMan
Causeless Jan 5, 2024
f1f8225
Fixed ModuleMan not being source-directorified
Causeless Jan 5, 2024
ed6dbb3
Merge branch 'development' into ModuleMan
Causeless Jan 6, 2024
d0502b5
Fix meson build
Causeless Jan 6, 2024
d5e1b7b
Merge branch 'development' into ModuleMan
Causeless Jan 12, 2024
d1bb123
Merge branch 'development' into ModuleMan
Causeless Jan 20, 2024
6c5b616
format
HeliumAnt Jan 20, 2024
f99da86
Merge branch 'development' into ModuleMan
HeliumAnt Jan 20, 2024
6607e12
fix eof newlines
HeliumAnt Jan 20, 2024
f701bc2
apply doxygen
HeliumAnt Jan 20, 2024
fc209ee
Merge branch 'development' into ModuleMan
HeliumAnt Jan 20, 2024
41b13ff
Merge branch 'development' into ModuleMan
Causeless Jan 21, 2024
a759999
Merge branch 'development' into ModuleMan
Causeless Jan 21, 2024
3e5b51f
Merge branch 'development' into ModuleMan
Causeless Jan 21, 2024
ee47749
Merge branch 'development' into ModuleMan
Causeless Jan 21, 2024
f874dc9
re-run clang format
Causeless Jan 21, 2024
6f1e499
Merge branch 'development' into ModuleMan
Causeless Jan 21, 2024
0c5eb07
Merge branch 'development' into ModuleMan
Causeless Jan 22, 2024
f8bc79c
Fixed build
Causeless Jan 22, 2024
c13eb3d
Changed ModuleMan.cpp to use "using namespace RTE;" instead of nesting
Causeless Jan 22, 2024
fa0652b
Merge branch 'development' into ModuleMan
Causeless Jan 22, 2024
5deb46c
Merge branch 'development' into ModuleMan
Causeless Jan 22, 2024
61917e9
Reformatted ModuleMan.cpp
Causeless Jan 22, 2024
2d5ed04
Merge branch 'development' into ModuleMan
Causeless Feb 13, 2024
6159a91
Added missing include
Causeless Feb 13, 2024
2355a15
Fixed meson
Causeless Feb 13, 2024
3f2986f
Merge branch 'development' into ModuleMan
Causeless Aug 17, 2024
6921f78
Merge branch 'development' into ModuleMan
Causeless Aug 17, 2024
f46af36
Fixed crash that could occur if disabling a mod mid-session (like you…
Causeless Aug 17, 2024
56d4892
Correctly update module name / description after loading
Causeless Aug 17, 2024
fce0a87
Updated changelog
Causeless Aug 17, 2024
40162d1
Merge branch 'development' into ModuleMan
Causeless Sep 11, 2024
57ecb85
Merge branch 'development' into ModuleMan
Causeless Nov 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- New `GameActivity` INI properties `TeamNTechSwitchEnabled` which determine whether activity team factions are configurable by the user. This is most useful for communicating what the player is not intended to change, or what inputs would be ignored otherwise.

- Allow lua scripts to use LuaJIT's BitOp module (see https://bitop.luajit.org/api.html)

- New `Emission` INI and Lua (R/W) property `ParticleCount` which sets how many particles the Emission spawns per emission. Defaults to 1.

- New `Gib` and `Emission` INI and Lua (R/W) property `InheritsAngularVel`, which determines how much of the parent MO's angular velocity they inherit. Defaults to 1 for gibs, 0 for emissions.

- New `Attachable` INI and Lua (R/W) properties `InheritsVelWhenDetached` and `InheritsAngularVelWhenDetached`, which determine how much of these velocities an attachable inherits from its parent when detached. Defaults to 1.

- New `ModuleMan` to handle module management, and allow global scripts and mod modules can now be dynamically enabled or disabled mid-game.
Moved the `PresetMan` lua parameters/functions `Modules`, `GetDataModule`, `GetModuleID`, `GetModuleIDFromPath`, `GetTotalModuleCount`, `IsModuleOfficial`, `IsModuleUserdata` and `GetFullModulePath` into `ModuleMan`

- Allow lua scripts to use LuaJIT's BitOp module (see https://bitop.luajit.org/api.html)

</details>

<details><summary><b>Changed</b></summary>
Expand Down
16 changes: 8 additions & 8 deletions Data/Base.rte/Activities/BrainVsBrain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function BrainvsBrain:StartActivity(isNewGame)
self.TechName[Activity.TEAM_2] = self:GetTeamTech(Activity.TEAM_2);

if self.CPUTeam ~= Activity.NOTEAM then
self.CPUTechID = PresetMan:GetModuleID(self.TechName[self.CPUTeam]);
self.CPUTechID = ModuleMan:GetModuleID(self.TechName[self.CPUTeam]);
end

MusicMan:PlayDynamicSong("Generic Battle Music");
Expand Down Expand Up @@ -577,7 +577,7 @@ function BrainvsBrain:CreateHeavyDrop(xPosLZ)
Craft.Pos = Vector(xPosLZ, -30); -- Set the spawn point of the craft

for i = 1, Craft.MaxPassengers do
if math.random() < self:GetCrabToHumanSpawnRatio(PresetMan:GetModuleID(self.TechName[self.CPUTeam])) then
if math.random() < self:GetCrabToHumanSpawnRatio(ModuleMan:GetModuleID(self.TechName[self.CPUTeam])) then
Passenger = self:CreateCrab(self.CPUTeam);
elseif RangeRand(0, 105) < self.Difficulty then
Passenger = self:CreateHeavyInfantry(self.CPUTeam);
Expand Down Expand Up @@ -862,7 +862,7 @@ end

function BrainvsBrain:CreateLightInfantry(team, mode)
local Passenger = RandomAHuman("Actors - Light", self.TechName[team]);
if Passenger.ModuleID ~= PresetMan:GetModuleID(self.TechName[team]) then
if Passenger.ModuleID ~= ModuleMan:GetModuleID(self.TechName[team]) then
Passenger = RandomAHuman("Actors", self.TechName[team]);
end

Expand All @@ -887,7 +887,7 @@ end

function BrainvsBrain:CreateDefender(team)
local Passenger = RandomAHuman("Actors - Light", self.TechName[team]);
if Passenger.ModuleID ~= PresetMan:GetModuleID(self.TechName[team]) then
if Passenger.ModuleID ~= ModuleMan:GetModuleID(self.TechName[team]) then
Passenger = RandomAHuman("Actors", self.TechName[team]);
end

Expand All @@ -907,7 +907,7 @@ end

function BrainvsBrain:CreateHeavyInfantry(team, mode)
local Passenger = RandomAHuman("Actors - Heavy", self.TechName[team]);
if Passenger.ModuleID ~= PresetMan:GetModuleID(self.TechName[team]) then
if Passenger.ModuleID ~= ModuleMan:GetModuleID(self.TechName[team]) then
Passenger = RandomAHuman("Actors", self.TechName[team]);
end

Expand Down Expand Up @@ -939,7 +939,7 @@ end

function BrainvsBrain:CreateMediumInfantry(team, mode)
local Passenger = RandomAHuman("Actors - Heavy", self.TechName[team]);
if Passenger.ModuleID ~= PresetMan:GetModuleID(self.TechName[team]) then
if Passenger.ModuleID ~= ModuleMan:GetModuleID(self.TechName[team]) then
Passenger = RandomAHuman("Actors", self.TechName[team]);
end

Expand All @@ -964,7 +964,7 @@ end

function BrainvsBrain:CreateScoutInfantry(team, mode)
local Passenger = RandomAHuman("Actors - Light", self.TechName[team]);
if Passenger.ModuleID ~= PresetMan:GetModuleID(self.TechName[team]) then
if Passenger.ModuleID ~= ModuleMan:GetModuleID(self.TechName[team]) then
Passenger = RandomAHuman("Actors", self.TechName[team]);
end

Expand All @@ -989,7 +989,7 @@ end

function BrainvsBrain:CreateEngineer(team, mode)
local Passenger = RandomAHuman("Actors - Light", self.TechName[team]);
if Passenger.ModuleID ~= PresetMan:GetModuleID(self.TechName[team]) then
if Passenger.ModuleID ~= ModuleMan:GetModuleID(self.TechName[team]) then
Passenger = RandomAHuman("Actors", self.TechName[team]);
end

Expand Down
10 changes: 5 additions & 5 deletions Data/Base.rte/Activities/BunkerBreach.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function BunkerBreach:SetupDefenderBrains()
end

function BunkerBreach:SetupDefenderActors()
local techID = PresetMan:GetModuleID(self:GetTeamTech(self.defenderTeam));
local techID = ModuleMan:GetModuleID(self:GetTeamTech(self.defenderTeam));
local crabToHumanSpawnRatio = self:GetCrabToHumanSpawnRatio(techID);

local loadoutNames = {"Light", "Heavy", "Sniper", "Engineer", "Mecha", "Turret"};
Expand Down Expand Up @@ -654,7 +654,7 @@ function BunkerBreach:CreateInternalReinforcements(loadout, numberOfReinforcemen
loadout = nil;
end
local team = self.CPUTeam;
local techID = PresetMan:GetModuleID(self:GetTeamTech(team));
local techID = ModuleMan:GetModuleID(self:GetTeamTech(team));
local crabToHumanSpawnRatio = self:GetCrabToHumanSpawnRatio(techID);

local internalReinforcementPositionsToEnemyTargets = self:CalculateInternalReinforcementPositionsToEnemyTargets(numberOfReinforcementsToCreate);
Expand All @@ -675,7 +675,7 @@ function BunkerBreach:CreateInternalReinforcements(loadout, numberOfReinforcemen
numberOfInternalReinforcementsToCreateAtPosition = 3;
end
end

for i = 1, numberOfInternalReinforcementsToCreateAtPosition do
local internalReinforcement;
if loadout then
Expand Down Expand Up @@ -716,7 +716,7 @@ function BunkerBreach:CreateDrop(loadout, aiMode, passengerCount, avoidPreviousC
loadout = nil;
end
local team = self.CPUTeam;
local techID = PresetMan:GetModuleID(self:GetTeamTech(team));
local techID = ModuleMan:GetModuleID(self:GetTeamTech(team));
local crabToHumanSpawnRatio = self:GetCrabToHumanSpawnRatio(techID);

local craft = RandomACDropShip("Craft", techID);
Expand Down Expand Up @@ -881,7 +881,7 @@ function BunkerBreach:CreateCrab(techID, createTurret)
end

function BunkerBreach:CreateBrainBot(team, techID)
local techID = PresetMan:GetModuleID(self:GetTeamTech(team));
local techID = ModuleMan:GetModuleID(self:GetTeamTech(team));
local actor;
if techID ~= -1 and team == self.attackerTeam then
actor = PresetMan:GetLoadout("Infantry Brain", techID, false);
Expand Down
2 changes: 1 addition & 1 deletion Data/Base.rte/Activities/Harvester.lua
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function Harvester:UpdateActivity()
for i = 1, actorsInCargo do
-- Get any Actor from the CPU's native tech
local passenger = nil;
if math.random() >= self:GetCrabToHumanSpawnRatio(PresetMan:GetModuleID(self.CPUTechName)) then
if math.random() >= self:GetCrabToHumanSpawnRatio(ModuleMan:GetModuleID(self.CPUTechName)) then
passenger = RandomAHuman("Any", self.CPUTechName);
else
passenger = RandomACrab("Actors - Mecha", self.CPUTechName);
Expand Down
4 changes: 2 additions & 2 deletions Data/Base.rte/Activities/KeepieUppie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function KeepieUppie:ResumeLoadedGame()
end
end
end

if not self.playerRocketSpawned then
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
if self:PlayerActive(player) and self:PlayerHuman(player) then
Expand Down Expand Up @@ -228,7 +228,7 @@ function KeepieUppie:UpdateActivity()
for i = 1, actorsInCargo do
-- Get any Actor from the CPU's native tech
local passenger = nil;
if math.random() >= self:GetCrabToHumanSpawnRatio(PresetMan:GetModuleID(self.CPUTechName)) then
if math.random() >= self:GetCrabToHumanSpawnRatio(ModuleMan:GetModuleID(self.CPUTechName)) then
passenger = RandomAHuman("Any", self.CPUTechName);
else
passenger = RandomACrab("Any", self.CPUTechName);
Expand Down
2 changes: 1 addition & 1 deletion Data/Base.rte/Activities/Massacre.lua
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ function Massacre:UpdateActivity()
for i = 1, actorsInCargo do
-- Get any Actor from the CPU's native tech
local passenger = nil;
if math.random() >= self:GetCrabToHumanSpawnRatio(PresetMan:GetModuleID(self.CPUTechName)) then
if math.random() >= self:GetCrabToHumanSpawnRatio(ModuleMan:GetModuleID(self.CPUTechName)) then
passenger = RandomAHuman("Any", self.CPUTechName);
else
passenger = RandomACrab("Actors - Mecha", self.CPUTechName);
Expand Down
8 changes: 4 additions & 4 deletions Data/Base.rte/Activities/OneManArmy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ function OneManArmy:SetupHumanPlayerBrains(actorGroup, primaryGroup, secondaryGr

--If we can't find an unassigned brain in the scene to give the player, create one
if not foundBrain then
local tech = PresetMan:GetModuleID(self:GetTeamTech(team));
local tech = ModuleMan:GetModuleID(self:GetTeamTech(team));
foundBrain = CreateAHuman(defaultActor);
--If a faction was chosen, pick the first item from faction listing
if tech ~= -1 then
local module = PresetMan:GetDataModule(tech);
local module = ModuleMan:GetDataModule(tech);
local primaryWeapon, secondaryWeapon, throwable, actor;
for entity in module.Presets do
local picked; --Prevent duplicates
Expand Down Expand Up @@ -357,9 +357,9 @@ function OneManArmy:UpdateActivity()
for i = 1, actorsInCargo do
--Get any Actor from the CPU's native tech
local passenger = nil;
if math.random() >= self:GetCrabToHumanSpawnRatio(PresetMan:GetModuleID(self.CPUTechName)) then
if math.random() >= self:GetCrabToHumanSpawnRatio(ModuleMan:GetModuleID(self.CPUTechName)) then
passenger = RandomAHuman("Actors - Light", self.CPUTechName);
if passenger.ModuleID ~= PresetMan:GetModuleID(self.CPUTechName) then
if passenger.ModuleID ~= ModuleMan:GetModuleID(self.CPUTechName) then
passenger = RandomAHuman("Actors", self.CPUTechName);
end
else
Expand Down
6 changes: 3 additions & 3 deletions Data/Base.rte/Activities/OneManArmyDiggers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ function OneManArmy:SetupHumanPlayerBrains(actorGroup, primaryGroup, secondaryGr
local foundBrain = MovableMan:GetUnassignedBrain(team);
-- If we can't find an unassigned brain in the scene to give the player, create one
if not foundBrain then
local tech = PresetMan:GetModuleID(self:GetTeamTech(team));
local tech = ModuleMan:GetModuleID(self:GetTeamTech(team));
foundBrain = CreateAHuman(defaultActor);
-- If a faction was chosen, pick the first item from faction listing
if tech ~= -1 then
local module = PresetMan:GetDataModule(tech);
local module = ModuleMan:GetDataModule(tech);
local primaryWeapon, secondaryWeapon, throwable, actor;
for entity in module.Presets do
local picked; -- Prevent duplicates
Expand Down Expand Up @@ -308,7 +308,7 @@ function OneManArmy:UpdateActivity()
-- Set the ship up with a cargo of a few armed and equipped actors
for i = 1, actorsInCargo do
local passenger = RandomAHuman("Actors - " .. ((self.Difficulty > 75 and math.random() > 0.5) and "Heavy" or "Light"), self.CPUTechName);
if passenger.ModuleID ~= PresetMan:GetModuleID(self.CPUTechName) then
if passenger.ModuleID ~= ModuleMan:GetModuleID(self.CPUTechName) then
passenger = RandomAHuman("Actors", self.CPUTechName);
end

Expand Down
14 changes: 7 additions & 7 deletions Data/Base.rte/Activities/OneManArmyZeroG.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function OneManArmyZeroG:StartActivity(isNewGame)
self.winTimer = Timer();

self.CPUTechName = self:GetTeamTech(self.CPUTeam);

self.isDiggersOnly = self.PresetName:find("Diggers") ~= nil;

if isNewGame then
Expand Down Expand Up @@ -87,7 +87,7 @@ function OneManArmyZeroG:StartNewGame()
self.enemySpawnTimeLimit = 500;

MusicMan:PlayDynamicSong("Generic Battle Music");

local automoverController = CreateActor("Invisible Automover Controller", "Base.rte");
automoverController.Team = -1;
automoverController:SetNumberValue("MovementSpeed", 16);
Expand Down Expand Up @@ -123,11 +123,11 @@ function OneManArmyZeroG:SetupHumanPlayerBrains(actorGroup, primaryGroup, second

--If we can't find an unassigned brain in the scene to give the player, create one
if not foundBrain then
local tech = PresetMan:GetModuleID(self:GetTeamTech(team));
local tech = ModuleMan:GetModuleID(self:GetTeamTech(team));
foundBrain = CreateAHuman(defaultActor);
--If a faction was chosen, pick the first item from faction listing
if tech ~= -1 then
local dataModule = PresetMan:GetDataModule(tech);
local dataModule = ModuleMan:GetDataModule(tech);
local primaryWeapon, secondaryWeapon, tertiaryWeapon, actor;
for entity in dataModule.Presets do
local picked; --Prevent duplicates
Expand Down Expand Up @@ -250,14 +250,14 @@ function OneManArmyZeroG:ResumeLoadedGame()
end
end
end

for particle in MovableMan.AddedParticles do
if particle.PresetName == "Automover Node 1x1" then
particle.Scale = 0;
break;
end
end

for actor in MovableMan.AddedActors do
if actor.Team ~= Activity.TEAM_1 then
actor.AIMode = Actor.AIMODE_BRAINHUNT;
Expand Down Expand Up @@ -342,7 +342,7 @@ function OneManArmyZeroG:UpdateActivity()
if self.CPUTeam ~= Activity.NOTEAM and self.enemySpawnTimer:LeftTillSimMS(self.enemySpawnTimeLimit) <= 0 then
for i = 1, math.random(1, 3) do
local actor = RandomAHuman("Actors - Light", self.CPUTechName);
if actor.ModuleID ~= PresetMan:GetModuleID(self.CPUTechName) then
if actor.ModuleID ~= ModuleMan:GetModuleID(self.CPUTechName) then
actor = RandomAHuman("Actors", self.CPUTechName);
end

Expand Down
16 changes: 8 additions & 8 deletions Data/Base.rte/Activities/Siege.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Siege:StartActivity()
self.CPUTechName = self:GetTeamTech(self.CPUTeam); -- Select a tech for the CPU player
self.PlayerTechName = self:GetTeamTech(self.PlayerTeam);
gPrevAITech = self.CPUTechName -- Store the AI tech in a global so we don't pick the same tech again next round
self.CPUTechID = PresetMan:GetModuleID(self.CPUTechName);
self.CPUTechID = ModuleMan:GetModuleID(self.CPUTechName);

self:SetTeamFunds(math.ceil((3000 + self.Difficulty * 175) * rte.StartingFundsScale), self.CPUTeam);
if self.Difficulty == 100 then
Expand Down Expand Up @@ -496,7 +496,7 @@ function Siege:CreateHeavyDrop(xPosLZ, techName)
Craft.Pos = Vector(xPosLZ, -30); -- Set the spawn point of the craft

for i = 1, Craft.MaxPassengers do
if math.random() < self:GetCrabToHumanSpawnRatio(PresetMan:GetModuleID(techName)) then
if math.random() < self:GetCrabToHumanSpawnRatio(ModuleMan:GetModuleID(techName)) then
Passenger = self:CreateCrab(Actor.AIMODE_GOTO, techName);
elseif RangeRand(0, 105) < self.Difficulty then
Passenger = self:CreateHeavyInfantry(Actor.AIMODE_GOTO,techName);
Expand All @@ -516,7 +516,7 @@ function Siege:CreateHeavyDrop(xPosLZ, techName)
end

-- Subtract the total value of the craft+cargo from the CPU team's funds
self:ChangeTeamFunds(-Craft:GetTotalValue(PresetMan:GetModuleID(techName), 2), self.CPUTeam);
self:ChangeTeamFunds(-Craft:GetTotalValue(ModuleMan:GetModuleID(techName), 2), self.CPUTeam);

-- Spawn the Craft onto the scene
MovableMan:AddActor(Craft);
Expand Down Expand Up @@ -553,7 +553,7 @@ function Siege:CreateSWATDrop(xPosLZ, techName)
end

-- Subtract the total value of the craft+cargo from the CPU team's funds
self:ChangeTeamFunds(-Craft:GetTotalValue(PresetMan:GetModuleID(techName), 2), self.CPUTeam);
self:ChangeTeamFunds(-Craft:GetTotalValue(ModuleMan:GetModuleID(techName), 2), self.CPUTeam);

-- Spawn the Craft onto the scene
MovableMan:AddActor(Craft);
Expand Down Expand Up @@ -590,7 +590,7 @@ function Siege:CreateArtilleryDrop(xPosLZ, techName)
end

-- Subtract the total value of the craft+cargo from the CPU team's funds
self:ChangeTeamFunds(-Craft:GetTotalValue(PresetMan:GetModuleID(techName), 2), self.CPUTeam);
self:ChangeTeamFunds(-Craft:GetTotalValue(ModuleMan:GetModuleID(techName), 2), self.CPUTeam);

-- Spawn the Craft onto the scene
MovableMan:AddActor(Craft);
Expand Down Expand Up @@ -644,7 +644,7 @@ function Siege:CreateMediumDrop(xPosLZ, techName)
end

-- Subtract the total value of the craft+cargo from the CPU team's funds
self:ChangeTeamFunds(-Craft:GetTotalValue(PresetMan:GetModuleID(techName), 2), self.CPUTeam);
self:ChangeTeamFunds(-Craft:GetTotalValue(ModuleMan:GetModuleID(techName), 2), self.CPUTeam);

-- Spawn the Craft onto the scene
MovableMan:AddActor(Craft);
Expand Down Expand Up @@ -696,7 +696,7 @@ function Siege:CreateLightDrop(xPosLZ, techName)
end

-- Subtract the total value of the craft+cargo from the CPU team's funds
self:ChangeTeamFunds(-Craft:GetTotalValue(PresetMan:GetModuleID(techName), 2), self.CPUTeam);
self:ChangeTeamFunds(-Craft:GetTotalValue(ModuleMan:GetModuleID(techName), 2), self.CPUTeam);

-- Spawn the Craft onto the scene
MovableMan:AddActor(Craft);
Expand Down Expand Up @@ -744,7 +744,7 @@ function Siege:CreateEngineerDrop(xPosLZ, techName)
end

-- Subtract the total value of the craft+cargo from the CPU team's funds
self:ChangeTeamFunds(-Craft:GetTotalValue(PresetMan:GetModuleID(techName), 2), self.CPUTeam);
self:ChangeTeamFunds(-Craft:GetTotalValue(ModuleMan:GetModuleID(techName), 2), self.CPUTeam);

-- Spawn the Craft onto the scene
MovableMan:AddActor(Craft);
Expand Down
2 changes: 1 addition & 1 deletion Data/Base.rte/Activities/SkirmishDefense.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function SkirmishDefense:StartActivity(isNewGame)
end
end

self.AI[team].TechID = PresetMan:GetModuleID(self:GetTeamTech(team));
self.AI[team].TechID = ModuleMan:GetModuleID(self:GetTeamTech(team));
end

if isNewGame then
Expand Down
2 changes: 1 addition & 1 deletion Data/Base.rte/Activities/Survival.lua
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function Survival:UpdateActivity()
for i = 1, actorsInCargo do
-- Get any Actor from the CPU's native tech
local passenger = nil;
if math.random() >= self:GetCrabToHumanSpawnRatio(PresetMan:GetModuleID(self.CPUTechName)) then
if math.random() >= self:GetCrabToHumanSpawnRatio(ModuleMan:GetModuleID(self.CPUTechName)) then
passenger = RandomAHuman("Any", self.CPUTechName);
else
passenger = RandomACrab("Actors - Mecha", self.CPUTechName);
Expand Down
Loading
Loading