Skip to content

Commit 5ec419a

Browse files
committed
Merge remote-tracking branch 'origin/coalition-concept-bunker-cannon' into browncoat-lmg
2 parents 3ece755 + 329dbac commit 5ec419a

File tree

68 files changed

+1208
-36
lines changed

Some content is hidden

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

68 files changed

+1208
-36
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/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/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/Coalition.rte/Actors.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ IncludeFile = Coalition.rte/Actors/Mecha/BlastRunner/BlastRunner.ini
2323

2424
// Turrets
2525

26+
IncludeFile = Coalition.rte/Actors/Turrets/BunkerCannon/BunkerCannon.ini
2627
IncludeFile = Coalition.rte/Actors/Turrets/GatlingTurret/GatlingTurret.ini

0 commit comments

Comments
 (0)