Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit b11c31c

Browse files
authored
Merge pull request #19 from cortex-command-community/Post-Refactor-Refactor
Post-Refactor Refactor
2 parents d00d17e + 8da6e20 commit b11c31c

File tree

749 files changed

+4257
-7605
lines changed

Some content is hidden

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

749 files changed

+4257
-7605
lines changed

Base.rte/AI.ini

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ AddActor = AHuman
1212
ScriptPath = Base.rte/AI/PathFinder.lua
1313
SpriteFile = ContentFile
1414
FilePath = Base.rte/Null.bmp
15-
FrameCount = 1
1615
AtomGroup = AtomGroup
17-
CopyOf = Atom Group Null
16+
CopyOf = Null AtomGroup
1817
Health = 100
1918
AimDistance = 0
2019
Perceptiveness = 0
@@ -27,19 +26,17 @@ AddActor = AHuman
2726
GetsHitByMOs = 0
2827
SpriteFile = ContentFile
2928
FilePath = Base.rte/Null.bmp
30-
FrameCount = 1
3129
AtomGroup = AtomGroup
32-
CopyOf = Atom Group Null
30+
CopyOf = Null AtomGroup
3331
FGArm = Arm
3432
PresetName = Null Arm FG
3533
Mass = 0
3634
HitsMOs = 0
3735
GetsHitByMOs = 0
3836
SpriteFile = ContentFile
3937
FilePath = Base.rte/Null.bmp
40-
FrameCount = 1
4138
AtomGroup = AtomGroup
42-
CopyOf = Atom Group Null
39+
CopyOf = Null AtomGroup
4340
Hand = ContentFile
4441
FilePath = Base.rte/Null.bmp
4542
MaxLength = 0
@@ -50,9 +47,8 @@ AddActor = AHuman
5047
GetsHitByMOs = 0
5148
SpriteFile = ContentFile
5249
FilePath = Base.rte/Null.bmp
53-
FrameCount = 1
5450
AtomGroup = AtomGroup
55-
CopyOf = Atom Group Null
51+
CopyOf = Null AtomGroup
5652
Hand = ContentFile
5753
FilePath = Base.rte/Null.bmp
5854
MaxLength = 0
@@ -63,19 +59,17 @@ AddActor = AHuman
6359
GetsHitByMOs = 0
6460
SpriteFile = ContentFile
6561
FilePath = Base.rte/Null.bmp
66-
FrameCount = 1
6762
AtomGroup = AtomGroup
68-
CopyOf = Atom Group Null
63+
CopyOf = Null AtomGroup
6964
BGLeg = Leg
7065
PresetName = Null Leg BG
7166
Mass = 0
7267
HitsMOs = 0
7368
GetsHitByMOs = 0
7469
SpriteFile = ContentFile
7570
FilePath = Base.rte/Null.bmp
76-
FrameCount = 1
7771
AtomGroup = AtomGroup
78-
CopyOf = Atom Group Null
72+
CopyOf = Null AtomGroup
7973
HandGroup = AtomGroup
8074
PresetName = NullGroup
8175
AutoGenerate = 1
@@ -95,15 +89,9 @@ AddDevice = TDExplosive
9589
GetsHitByMOs = 0
9690
SpriteFile = ContentFile
9791
FilePath = Base.rte/Null.bmp
98-
FrameCount = 1
9992
Buyable = 0
10093
AtomGroup = AtomGroup
101-
AutoGenerate = 1
102-
Material = Material
103-
CopyOf = Air
104-
Resolution = 5
105-
Depth = 0
106-
DeepCheck = 0
94+
CopyOf = Null AtomGroup
10795
TriggerDelay = 300
10896
ActivatesWhenReleased = 1
10997

@@ -118,15 +106,9 @@ AddDevice = TDExplosive
118106
GetsHitByMOs = 0
119107
SpriteFile = ContentFile
120108
FilePath = Base.rte/Null.bmp
121-
FrameCount = 1
122109
Buyable = 0
123110
AtomGroup = AtomGroup
124-
AutoGenerate = 1
125-
Material = Material
126-
CopyOf = Air
127-
Resolution = 5
128-
Depth = 0
129-
DeepCheck = 0
111+
CopyOf = Null AtomGroup
130112
TriggerDelay = 450
131113
ActivatesWhenReleased = 1
132114

@@ -141,14 +123,8 @@ AddDevice = TDExplosive
141123
GetsHitByMOs = 0
142124
SpriteFile = ContentFile
143125
FilePath = Base.rte/Null.bmp
144-
FrameCount = 1
145126
Buyable = 0
146127
AtomGroup = AtomGroup
147-
AutoGenerate = 1
148-
Material = Material
149-
CopyOf = Air
150-
Resolution = 5
151-
Depth = 0
152-
DeepCheck = 0
128+
CopyOf = Null AtomGroup
153129
TriggerDelay = 600
154130
ActivatesWhenReleased = 1

Base.rte/AI/HumanBehaviors.lua

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function HumanBehaviors.ProcessAlarmEvent(AI, Owner)
164164
AI.AlarmPos = nil
165165

166166
local loudness, AlarmVec
167-
local canSupress = not AI.flying and Owner.FirearmIsReady and Owner.EquippedItem:HasObjectInGroup("Explosive Weapons")
167+
local canSupress = not AI.flying and Owner.FirearmIsReady and Owner.EquippedItem:HasObjectInGroup("Weapons - Explosive")
168168
for Event in MovableMan.AlarmEvents do
169169
if Event.Team ~= Owner.Team then -- caused by some other team's activities - alarming!
170170
loudness = Owner.AimDistance + FrameMan.PlayerScreenWidth * 0.6 * Owner.Perceptiveness * Event.Range -- adjust the audible range to the screen resolution
@@ -208,7 +208,7 @@ function HumanBehaviors.ProcessAlarmEvent(AI, Owner)
208208
FoundMO = MovableMan:GetMOFromID(FoundMO.RootID)
209209
end
210210

211-
if not FoundMO.EquippedItem or not FoundMO.EquippedItem:HasObjectInGroup("Explosive Weapons") then
211+
if not FoundMO.EquippedItem or not FoundMO.EquippedItem:HasObjectInGroup("Weapons - Explosive") then
212212
FoundMO = nil -- don't shoot at without weapons or actors using tools
213213
end
214214

@@ -275,22 +275,22 @@ end
275275
function HumanBehaviors.EquipPreferredWeapon(AI, Owner)
276276
if AI.PlayerPreferredHD then
277277
Owner:EquipNamedDevice(AI.PlayerPreferredHD, true)
278-
elseif not Owner:EquipDeviceInGroup("Primary Weapons", true) then
279-
Owner:EquipDeviceInGroup("Secondary Weapons", true)
278+
elseif not Owner:EquipDeviceInGroup("Weapons - Primary", true) then
279+
Owner:EquipDeviceInGroup("Weapons - Secondary", true)
280280
end
281281

282282
return false
283283
end
284284

285285
-- deprecated since B30. make sure we equip a primary weapon if we have one. return true if we must run this function again to be sure
286286
function HumanBehaviors.EquipPrimaryWeapon(AI, Owner)
287-
Owner:EquipDeviceInGroup("Primary Weapons", true)
287+
Owner:EquipDeviceInGroup("Weapons - Primary", true)
288288
return false
289289
end
290290

291291
-- deprecated since B30. make sure we equip a secondary weapon if we have one. return true if we must run this function again to be sure
292292
function HumanBehaviors.EquipSecondaryWeapon(AI, Owner)
293-
Owner:EquipDeviceInGroup("Secondary Weapons", true)
293+
Owner:EquipDeviceInGroup("Weapons - Secondary", true)
294294
return false
295295
end
296296

@@ -304,8 +304,8 @@ function HumanBehaviors.Sentry(AI, Owner, Abort)
304304

305305
if AI.PlayerPreferredHD then
306306
Owner:EquipNamedDevice(AI.PlayerPreferredHD, true)
307-
elseif not Owner:EquipDeviceInGroup("Primary Weapons", true) then
308-
Owner:EquipDeviceInGroup("Secondary Weapons", true)
307+
elseif not Owner:EquipDeviceInGroup("Weapons - Primary", true) then
308+
Owner:EquipDeviceInGroup("Weapons - Secondary", true)
309309
end
310310

311311
if AI.OldTargetPos then -- try to reacquire an old target
@@ -476,8 +476,8 @@ function HumanBehaviors.Sentry(AI, Owner, Abort)
476476
-- make sure that we have any preferred weapon equipped
477477
if AI.PlayerPreferredHD then
478478
Owner:EquipNamedDevice(AI.PlayerPreferredHD, true)
479-
elseif not Owner:EquipDeviceInGroup("Primary Weapons", true) then
480-
Owner:EquipDeviceInGroup("Secondary Weapons", true)
479+
elseif not Owner:EquipDeviceInGroup("Weapons - Primary", true) then
480+
Owner:EquipDeviceInGroup("Weapons - Secondary", true)
481481
end
482482

483483
if AI.deviceState == AHuman.AIMING then
@@ -518,8 +518,8 @@ function HumanBehaviors.Patrol(AI, Owner, Abort)
518518
if Owner.ClassName == "AHuman" then
519519
if AI.PlayerPreferredHD then
520520
Owner:EquipNamedDevice(AI.PlayerPreferredHD, true)
521-
elseif not Owner:EquipDeviceInGroup("Primary Weapons", true) then
522-
Owner:EquipDeviceInGroup("Secondary Weapons", true)
521+
elseif not Owner:EquipDeviceInGroup("Weapons - Primary", true) then
522+
Owner:EquipDeviceInGroup("Weapons - Secondary", true)
523523
end
524524
end
525525

@@ -955,7 +955,7 @@ function HumanBehaviors.WeaponSearch(AI, Owner, Abort)
955955
waypoints = SceneMan.Scene:CalculatePath(Owner.Pos, Item.Pos, false, 1)
956956
if waypoints < minDist and waypoints > -1 then
957957
-- estimate the walking distance to the item
958-
if Item:HasObjectInGroup("Primary Weapons") then
958+
if Item:HasObjectInGroup("Weapons - Primary") then
959959
score = waypoints * 0.4 -- prioritize primaries
960960
elseif Item.ClassName == "TDExplosive" then
961961
score = waypoints * 1.4 -- avoid grenades if there are other weapons
@@ -2273,7 +2273,7 @@ function HumanBehaviors.ShootTarget(AI, Owner, Abort)
22732273

22742274
-- Aim longer with low capacity weapons
22752275
if ((Weapon.Magazine.Capacity > -1 and Weapon.Magazine.Capacity < 10) or
2276-
Weapon:HasObjectInGroup("Sniper Weapons")) and
2276+
Weapon:HasObjectInGroup("Weapons - Sniper")) and
22772277
Dist.Largest > 100
22782278
then
22792279
-- reduce ErrorOffset and increase shootDelay when the target is further away
@@ -2309,7 +2309,7 @@ function HumanBehaviors.ShootTarget(AI, Owner, Abort)
23092309
if range < 60 and Owner:HasObjectInGroup("Diggers") then
23102310
AI:CreateHtHBehavior(Owner)
23112311
break
2312-
elseif Owner:EquipLoadedFirearmInGroup("Any", "Explosive Weapons", true) then
2312+
elseif Owner:EquipLoadedFirearmInGroup("Any", "Weapons - Explosive", true) then
23132313
PrjDat = nil
23142314
local _ai, _ownr, _abrt = coroutine.yield() -- wait until next frame
23152315
if _abrt then return true end
@@ -2357,17 +2357,17 @@ function HumanBehaviors.ShootTarget(AI, Owner, Abort)
23572357
end
23582358
else
23592359
-- TODO: switch weapon properly
2360-
if Weapon:HasObjectInGroup("Primary Weapons") then
2361-
if Owner:EquipDeviceInGroup("Secondary Weapons", true) then
2360+
if Weapon:HasObjectInGroup("Weapons - Primary") then
2361+
if Owner:EquipDeviceInGroup("Weapons - Secondary", true) then
23622362
local _ai, _ownr, _abrt = coroutine.yield() -- wait until next frame
23632363
if _abrt then return true end
23642364
PrjDat = nil
23652365
if not Owner.FirearmIsReady then
23662366
break
23672367
end
23682368
end
2369-
elseif Weapon:HasObjectInGroup("Secondary Weapons") then
2370-
if Owner:EquipDeviceInGroup("Primary Weapons", true) then
2369+
elseif Weapon:HasObjectInGroup("Weapons - Secondary") then
2370+
if Owner:EquipDeviceInGroup("Weapons - Primary", true) then
23712371
local _ai, _ownr, _abrt = coroutine.yield() -- wait until next frame
23722372
if _abrt then return true end
23732373
PrjDat = nil
@@ -2483,7 +2483,7 @@ function HumanBehaviors.ShootTarget(AI, Owner, Abort)
24832483
if openFire > 0 and PrjDat.blast > 0 then
24842484
if SceneMan:CastObstacleRay(Weapon.MuzzlePos, Weapon:RotateOffset(Vector(50, 0)), Vector(), Vector(), Owner.ID, Owner.IgnoresWhichTeam, rte.grassID, 2) > -1 then
24852485
-- equip another primary if possible
2486-
if Owner:EquipLoadedFirearmInGroup("Any", "Explosive Weapons", true) then
2486+
if Owner:EquipLoadedFirearmInGroup("Any", "Weapons - Explosive", true) then
24872487
PrjDat = nil
24882488
openFire = 0
24892489
local _ai, _ownr, _abrt = coroutine.yield() -- wait until next frame
@@ -2531,15 +2531,15 @@ function HumanBehaviors.ShootTarget(AI, Owner, Abort)
25312531

25322532
if AI.Target then
25332533
-- equip another primary if possible
2534-
if Owner:EquipLoadedFirearmInGroup("Primary Weapons", "None", true) then
2534+
if Owner:EquipLoadedFirearmInGroup("Weapons - Primary", "None", true) then
25352535
PrjDat = nil
25362536
else
25372537
-- select a secondary instead of reloading if the target is within half a screen
25382538
if Dist.Largest < (FrameMan.PlayerScreenWidth * 0.5 + AI.Target.Radius + Owner.AimDistance) then
25392539
-- select a primary if we have an empty secondary equipped
2540-
if Owner:EquipLoadedFirearmInGroup("Secondary Weapons", "None", true) then
2540+
if Owner:EquipLoadedFirearmInGroup("Weapons - Secondary", "None", true) then
25412541
PrjDat = nil
2542-
elseif Owner:EquipDeviceInGroup("Primary Weapons", true) then
2542+
elseif Owner:EquipDeviceInGroup("Weapons - Primary", true) then
25432543
PrjDat = nil
25442544
end
25452545
end
@@ -2587,7 +2587,7 @@ function HumanBehaviors.ShootTarget(AI, Owner, Abort)
25872587
end
25882588

25892589
-- reload the secondary before switching to the primary weapon
2590-
if Owner:HasObjectInGroup("Primary Weapons") and (Owner.EquippedItem and Owner.EquippedItem:HasObjectInGroup("Secondary Weapons")) then
2590+
if Owner:HasObjectInGroup("Weapons - Primary") and (Owner.EquippedItem and Owner.EquippedItem:HasObjectInGroup("Weapons - Secondary")) then
25912591
while Owner.EquippedItem and ToHeldDevice(Owner.EquippedItem):IsReloading() do
25922592
local _ai, _ownr, _abrt = coroutine.yield() -- wait until next frame
25932593
if _abrt then return true end
@@ -2596,8 +2596,8 @@ function HumanBehaviors.ShootTarget(AI, Owner, Abort)
25962596

25972597
if AI.PlayerPreferredHD then
25982598
Owner:EquipNamedDevice(AI.PlayerPreferredHD, true)
2599-
elseif not Owner:EquipDeviceInGroup("Primary Weapons", true) then
2600-
Owner:EquipDeviceInGroup("Secondary Weapons", true)
2599+
elseif not Owner:EquipDeviceInGroup("Weapons - Primary", true) then
2600+
Owner:EquipDeviceInGroup("Weapons - Secondary", true)
26012601
end
26022602

26032603
if Owner.FirearmIsEmpty then

Base.rte/AI/NativeHumanAI.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ function NativeHumanAI:Update(Owner)
351351
local OwnerWeapon = ToHDFirearm(Owner.EquippedItem)
352352
if OwnerWeapon:IsTool() then
353353
-- try equipping a weapon
354-
if Owner.InventorySize > 0 and not Owner:EquipDeviceInGroup("Primary Weapons", true) then
354+
if Owner.InventorySize > 0 and not Owner:EquipDeviceInGroup("Weapons - Primary", true) then
355355
Owner:EquipFirearm(true)
356356
end
357357
elseif LeaderWeapon:GetAIBlastRadius() >= OwnerWeapon:GetAIBlastRadius() * 0.5 and
@@ -364,7 +364,7 @@ function NativeHumanAI:Update(Owner)
364364
else
365365
if Owner.FirearmIsEmpty then
366366
Owner:ReloadFirearm()
367-
elseif Owner.InventorySize > 0 and not Owner:EquipDeviceInGroup("Primary Weapons", true) then
367+
elseif Owner.InventorySize > 0 and not Owner:EquipDeviceInGroup("Weapons - Primary", true) then
368368
Owner:EquipFirearm(true)
369369
end
370370
end

Base.rte/Activities.ini

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@ AddActivity = GAScripted
3131
DefaultDeployUnits = 0
3232

3333

34+
AddActivity = GAScripted
35+
PresetName = Wave Defense
36+
Description = Build a bunker and defend it against increasingly longer waves of AI-controlled enemies, with time to repair in between! Adjust the Difficulty to change wave difficulty.
37+
SceneName = Ketanot Hills
38+
ScriptFile = Base.rte/Activities/WaveDefense.lua
39+
PlayerCount = 4
40+
TeamOfPlayer1 = 0
41+
TeamOfPlayer2 = 0
42+
TeamOfPlayer3 = 0
43+
TeamOfPlayer4 = 0
44+
TeamCount = 2
45+
CPUTeam = 1
46+
MinTeamsRequired = 2
47+
LuaClassName = WaveDefense
48+
DeployUnitsSwitchEnabled = 1
49+
DefaultDeployUnits = 0
50+
51+
3452
AddActivity = GAScripted
3553
PresetName = One-Man Army
3654
Description = Survive with only one actor and no backups!
@@ -176,24 +194,6 @@ AddActivity = GAScripted
176194
DefaultDeployUnits = 0
177195
178196
179-
AddActivity = GAScripted
180-
PresetName = Wave Defense
181-
Description = Build a bunker and defend it against increasingly longer waves of AI-controlled enemies, with time to repair in between! Adjust the Difficulty to change wave difficulty.
182-
SceneName = Ketanot Hills
183-
ScriptFile = Base.rte/Activities/WaveDefense.lua
184-
PlayerCount = 4
185-
TeamOfPlayer1 = 0
186-
TeamOfPlayer2 = 0
187-
TeamOfPlayer3 = 0
188-
TeamOfPlayer4 = 0
189-
TeamCount = 2
190-
CPUTeam = 1
191-
MinTeamsRequired = 2
192-
LuaClassName = WaveDefense
193-
DeployUnitsSwitchEnabled = 1
194-
DefaultDeployUnits = 0
195-
196-
197197
///////////////////////////////////////////////////////////////////////
198198
// Test Activities
199199
@@ -212,7 +212,7 @@ AddActivity = GAScripted
212212
ScriptFile = Base.rte/Activities/Test.lua
213213
LuaClassName = Test
214214
215-
215+
/*
216216
AddActivity = GAScripted
217217
PresetName = Network Test Activity
218218
Description = Server Test Debug Activity
@@ -230,4 +230,5 @@ AddActivity = GAScripted
230230
DefaultGoldEasy = 5000
231231
DefaultGoldMedium = 4000
232232
DefaultGoldHard = 3000
233-
DefaultGoldNuts = 2000
233+
DefaultGoldNuts = 2000
234+
*/

0 commit comments

Comments
 (0)