Skip to content

Commit 5344623

Browse files
authored
Merge branch 'development' into moredislodgepixel
2 parents 1f110bc + aeb99f3 commit 5344623

File tree

586 files changed

+86061
-53381
lines changed

Some content is hidden

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

586 files changed

+86061
-53381
lines changed

Data/Base.rte/AI/CrabBehaviors.lua

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ function CrabBehaviors.Sentry(AI, Owner, Abort)
193193
end
194194

195195
local SharpTimer = Timer();
196-
local aimTime = 2000;
196+
local IdleAimTimer = Timer();
197+
local sharpAimTime = AI.idleAimTime;
197198
local angDiff = 1;
198199
AI.deviceState = ACrab.POINTING;
199200

@@ -206,36 +207,40 @@ function CrabBehaviors.Sentry(AI, Owner, Abort)
206207
while true do
207208
aim = Owner:GetAimAngle(false);
208209

209-
if sweepUp then
210-
if aim < maxAng then
211-
if aim < maxAng/5 and aim > minAng/5 and PosRand() > 0.3 then
212-
AI.Ctrl:SetState(Controller.AIM_UP, false);
210+
if IdleAimTimer:IsPastSimMS(AI.idleAimTime) then
211+
if sweepUp then
212+
if aim < maxAng then
213+
if aim < maxAng/5 and aim > minAng/5 and PosRand() > 0.3 then
214+
AI.Ctrl:SetState(Controller.AIM_UP, false);
215+
else
216+
AI.Ctrl:SetState(Controller.AIM_UP, true);
217+
end
213218
else
214-
AI.Ctrl:SetState(Controller.AIM_UP, true);
219+
sweepUp = false;
220+
IdleAimTimer:Reset();
215221
end
216222
else
217-
sweepUp = false;
218-
end
219-
else
220-
if aim > minAng then
221-
if aim < maxAng/5 and aim > minAng/5 and PosRand() > 0.3 then
222-
AI.Ctrl:SetState(Controller.AIM_DOWN, false);
223+
if aim > minAng then
224+
if aim < maxAng/5 and aim > minAng/5 and PosRand() > 0.3 then
225+
AI.Ctrl:SetState(Controller.AIM_DOWN, false);
226+
else
227+
AI.Ctrl:SetState(Controller.AIM_DOWN, true);
228+
end
223229
else
224-
AI.Ctrl:SetState(Controller.AIM_DOWN, true);
230+
sweepUp = true;
231+
IdleAimTimer:Reset();
225232
end
226-
else
227-
sweepUp = true;
228233
end
229234
end
230235

231-
if SharpTimer:IsPastSimMS(aimTime) then
236+
if SharpTimer:IsPastSimMS(AI.idleAimTime) then
232237
SharpTimer:Reset();
233238

234239
if AI.deviceState == ACrab.AIMING then
235-
aimTime = RangeRand(1000, 3000);
240+
sharpAimTime = RangeRand(AI.idleAimTime * 0.5, AI.idleAimTime * 1.5);
236241
AI.deviceState = ACrab.POINTING;
237242
else
238-
aimTime = RangeRand(6000, 12000) * angDiff;
243+
sharpAimTime = RangeRand(AI.idleAimTime * 3, AI.idleAimTime * 6) * angDiff;
239244
AI.deviceState = ACrab.AIMING;
240245
end
241246

Data/Base.rte/AI/HumanBehaviors.lua

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,8 @@ function HumanBehaviors.Sentry(AI, Owner, Abort)
429429
end
430430

431431
local SharpTimer = Timer();
432-
local aimTime = 2000;
432+
local IdleAimTimer = Timer();
433+
local sharpAimTime = AI.idleAimTime;
433434
local angDiff = 1;
434435
AI.deviceState = AHuman.POINTING;
435436

@@ -446,29 +447,33 @@ function HumanBehaviors.Sentry(AI, Owner, Abort)
446447

447448
aim = Owner:GetAimAngle(false);
448449

449-
if sweepUp then
450-
if aim < maxAng then
451-
if aim < maxAng/5 and aim > minAng/5 and PosRand() > 0.3 then
452-
AI.Ctrl:SetState(Controller.AIM_UP, false);
450+
if IdleAimTimer:IsPastSimMS(AI.idleAimTime) then
451+
if sweepUp then
452+
if aim < maxAng then
453+
if aim < maxAng/5 and aim > minAng/5 and PosRand() > 0.3 then
454+
AI.Ctrl:SetState(Controller.AIM_UP, false);
455+
else
456+
AI.Ctrl:SetState(Controller.AIM_UP, true);
457+
end
453458
else
454-
AI.Ctrl:SetState(Controller.AIM_UP, true);
459+
sweepUp = false;
460+
IdleAimTimer:Reset();
455461
end
456462
else
457-
sweepUp = false;
458-
end
459-
else
460-
if aim > minAng then
461-
if aim < maxAng/5 and aim > minAng/5 and PosRand() > 0.3 then
462-
AI.Ctrl:SetState(Controller.AIM_DOWN, false);
463+
if aim > minAng then
464+
if aim < maxAng/5 and aim > minAng/5 and PosRand() > 0.3 then
465+
AI.Ctrl:SetState(Controller.AIM_DOWN, false);
466+
else
467+
AI.Ctrl:SetState(Controller.AIM_DOWN, true);
468+
end
463469
else
464-
AI.Ctrl:SetState(Controller.AIM_DOWN, true);
470+
sweepUp = true;
471+
IdleAimTimer:Reset();
465472
end
466-
else
467-
sweepUp = true;
468473
end
469474
end
470475

471-
if SharpTimer:IsPastSimMS(aimTime) then
476+
if SharpTimer:IsPastSimMS(AI.idleAimTime) then
472477
SharpTimer:Reset();
473478

474479
-- make sure that we have any preferred weapon equipped
@@ -479,10 +484,10 @@ function HumanBehaviors.Sentry(AI, Owner, Abort)
479484
end
480485

481486
if AI.deviceState == AHuman.AIMING then
482-
aimTime = RangeRand(1000, 3000);
487+
sharpAimTime = RangeRand(AI.idleAimTime * 0.5, AI.idleAimTime * 1.5);
483488
AI.deviceState = AHuman.POINTING;
484489
else
485-
aimTime = RangeRand(6000, 12000) * angDiff;
490+
sharpAimTime = RangeRand(AI.idleAimTime * 3, AI.idleAimTime * 6) * angDiff;
486491
AI.deviceState = AHuman.AIMING;
487492
end
488493
if Owner.AIMode ~= Actor.AIMODE_SQUAD then

Data/Base.rte/AI/NativeCrabAI.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ function NativeCrabAI:Create(Owner)
2828
Members.PlayerInterferedTimer = Timer();
2929
Members.PlayerInterferedTimer:SetSimTimeLimitMS(500);
3030
end
31+
32+
-- customizable variables, trend started by pawnis on 01/09/2023 :)
33+
34+
-- humble beginnings
35+
-- pause time between sweeping aim up and down when guarding
36+
Members.idleAimTime = Owner:NumberValueExists("AIIdleAimTime") and Owner:GetNumberValue("AIIdleAimTime") or 500;
3137

3238
-- set shooting skill
3339
Members.aimSpeed, Members.aimSkill = HumanBehaviors.GetTeamShootingSkill(Owner.Team);

Data/Base.rte/AI/NativeDropShipAI.lua

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function NativeDropShipAI:Update(Owner)
8989
elseif Owner.AIMode == Actor.AIMODE_SENTRY then
9090
self.Waypoint = Owner.Pos;
9191
self.DeliveryState = ACraft.STANDBY;
92-
else
92+
else -- Deliver, most likely
9393
local FuturePos = Owner.Pos + Owner.Vel*20;
9494

9595
-- Make sure FuturePos is inside the scene
@@ -107,17 +107,16 @@ function NativeDropShipAI:Update(Owner)
107107
end
108108
end
109109

110-
-- Use GetLastAIWaypoint() as a LZ so the AI can give orders to dropships
111-
local Wpt = Owner:GetLastAIWaypoint();
112-
if (Owner.Pos - Wpt).Largest > 1 then
113-
self.Waypoint = Wpt;
110+
local startingHeight;
111+
if SceneMan.SceneOrbitDirection == 0 then
112+
startingHeight = hoverHeightModifierChanged and Owner.Radius * 1.25 or math.max(Owner.Radius * 1.25, Owner.Pos.Y);
114113
else
115-
local startingHeight = hoverHeightModifierChanged and Owner.Radius * 1.25 or math.max(Owner.Radius * 1.25, Owner.Pos.Y);
116-
local WptL = SceneMan:MovePointToGround(Vector(-Owner.Radius, startingHeight), self.hoverAlt, 12);
117-
local WptC = SceneMan:MovePointToGround(Vector(0, startingHeight), self.hoverAlt, 12);
118-
local WptR = SceneMan:MovePointToGround(Vector(Owner.Radius, startingHeight), self.hoverAlt, 12);
119-
self.Waypoint = Vector(Owner.Pos.X, math.min(WptL.Y, WptC.Y, WptR.Y));
114+
startingHeight = Owner.Pos.Y;
120115
end
116+
local WptL = SceneMan:MovePointToGround(Vector(-Owner.Radius, startingHeight), self.hoverAlt, 12);
117+
local WptC = SceneMan:MovePointToGround(Vector(0, startingHeight), self.hoverAlt, 12);
118+
local WptR = SceneMan:MovePointToGround(Vector(Owner.Radius, startingHeight), self.hoverAlt, 12);
119+
self.Waypoint = Vector(Owner.Pos.X, math.min(WptL.Y, WptC.Y, WptR.Y));
121120

122121
self.DeliveryState = ACraft.FALL;
123122
end

Data/Base.rte/AI/NativeHumanAI.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ function NativeHumanAI:Create(Owner)
3333

3434
Members.TargetLostTimer = Timer();
3535
Members.TargetLostTimer:SetSimTimeLimitMS(1000);
36+
37+
-- customizable variables, trend started by pawnis on 01/09/2023 :)
38+
39+
-- humble beginnings
40+
-- pause time between sweeping aim up and down when guarding
41+
Members.idleAimTime = Owner:NumberValueExists("AIIdleAimTime") and Owner:GetNumberValue("AIIdleAimTime") or 500;
3642

3743
-- set shooting skill
3844
Members.aimSpeed, Members.aimSkill, Members.skill = HumanBehaviors.GetTeamShootingSkill(Owner.Team);

Data/Base.rte/AI/NativeTurretAI.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ function NativeTurretAI:Create(Owner)
2626
Members.PlayerInterferedTimer = Timer();
2727
Members.PlayerInterferedTimer:SetSimTimeLimitMS(500);
2828
end
29+
30+
-- customizable variables, trend started by pawnis on 01/09/2023 :)
31+
32+
-- humble beginnings
33+
-- pause time between sweeping aim up and down when guarding
34+
Members.idleAimTime = Owner:NumberValueExists("AIIdleAimTime") and Owner:GetNumberValue("AIIdleAimTime") or 500;
2935

3036
-- set shooting skill
3137
Members.aimSpeed, Members.aimSkill = HumanBehaviors.GetTeamShootingSkill(Owner.Team);

Data/Base.rte/AI/RocketAI.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,12 @@ function ThreadedUpdateAI(self)
195195
if self.DeliveryState ~= ACraft.UNLOAD then
196196
dist = SceneMan:ShortestDistance(self.Pos+self.Vel, self.LZpos, false);
197197
change = self.YposPID:Update(dist.Y, 0);
198+
--print("NEW")
199+
--print(dist)
200+
--print(change)
198201
if math.abs(self.RotAngle) < 0.9 then
199202
if self.AIMode == Actor.AIMODE_GOTO then
200-
if change < -0.5 then
203+
if change < 0 then
201204
self.burstUp = nil;
202205
self.Ctrl:SetState(Controller.MOVE_UP, true);
203206
end
@@ -206,7 +209,7 @@ function ThreadedUpdateAI(self)
206209
self.burstUp = nil;
207210
self.Ctrl:SetState(Controller.MOVE_UP, true); -- Don't burst when returning to orbit
208211
else
209-
if change < -7 and not self.burstUp then
212+
if change < -3 and not self.burstUp then
210213
self.burstUp = math.max(9 - change, 2); -- Wait n frames until next burst (lower -> better control)
211214
elseif change > 20 then
212215
self.burstUp = nil;

Data/Base.rte/AI/TurretAI.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require("AI/NativeTurretAI");
22

33
function Create(self)
4+
45
self.AI = NativeTurretAI:Create(self);
56
end
67

Data/Base.rte/Activities/BunkerBreach.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function BunkerBreach:SetupDefenderActors()
151151
end
152152

153153
for actor in MovableMan.AddedActors do
154-
if not actor:IsInGroup("Brains") and not actor:IsInGroup("Bunker Systems - Automovers") then
154+
if not actor:IsInGroup("Brains") and not actor:IsInGroup("Bunker Systems") then
155155
if hasSpawnAreas then
156156
actor.ToDelete = true;
157157
elseif actor.Team ~= self.defenderTeam then

Data/Base.rte/Activities/OneManArmy.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,19 @@ function OneManArmy:SetupHumanPlayerBrains(actorGroup, primaryGroup, secondaryGr
113113
local primaryWeapon, secondaryWeapon, throwable, actor;
114114
for entity in module.Presets do
115115
local picked; --Prevent duplicates
116-
if not primaryWeapon and entity.ClassName == "HDFirearm" and ToMOSRotating(entity):HasObjectInGroup(primaryGroup) and ToMOSRotating(entity).IsBuyable then
116+
if not primaryWeapon and entity.ClassName == "HDFirearm" and ToMOSRotating(entity):HasObjectInGroup(primaryGroup) and ToMOSRotating(entity).Buyable then
117117
primaryWeapon = CreateHDFirearm(entity:GetModuleAndPresetName());
118118
picked = true;
119119
end
120-
if not picked and not secondaryWeapon and entity.ClassName == "HDFirearm" and ToMOSRotating(entity):HasObjectInGroup(secondaryGroup) and ToMOSRotating(entity).IsBuyable then
120+
if not picked and not secondaryWeapon and entity.ClassName == "HDFirearm" and ToMOSRotating(entity):HasObjectInGroup(secondaryGroup) and ToMOSRotating(entity).Buyable then
121121
secondaryWeapon = CreateHDFirearm(entity:GetModuleAndPresetName());
122122
picked = true;
123123
end
124-
if not picked and not throwable and entity.ClassName == "TDExplosive" and ToMOSRotating(entity):HasObjectInGroup("Bombs - Grenades") and ToMOSRotating(entity).IsBuyable then
124+
if not picked and not throwable and entity.ClassName == "TDExplosive" and ToMOSRotating(entity):HasObjectInGroup("Bombs - Grenades") and ToMOSRotating(entity).Buyable then
125125
throwable = CreateTDExplosive(entity:GetModuleAndPresetName());
126126
picked = true;
127127
end
128-
if not picked and not actor and entity.ClassName == "AHuman" and ToMOSRotating(entity):HasObjectInGroup(actorGroup) and ToMOSRotating(entity).IsBuyable then
128+
if not picked and not actor and entity.ClassName == "AHuman" and ToMOSRotating(entity):HasObjectInGroup(actorGroup) and ToMOSRotating(entity).Buyable then
129129
actor = CreateAHuman(entity:GetModuleAndPresetName());
130130
end
131131
end

0 commit comments

Comments
 (0)