Skip to content

Commit 969a202

Browse files
Merge branch 'browncoat-mission' of https://github.com/cortex-command-community/Cortex-Command-Community-Project into browncoat-mission
2 parents d7f63a5 + 7b58dee commit 969a202

File tree

136 files changed

+3100
-2607
lines changed

Some content is hidden

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

136 files changed

+3100
-2607
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ concurrency:
1919
jobs:
2020
meson:
2121
uses: ./.github/workflows/meson.yml
22-
23-
msbuild:
24-
uses: ./.github/workflows/msbuild.yml
2522

26-
format:
27-
uses: ./.github/workflows/clang-format.yml
23+
msbuild:
24+
uses: ./.github/workflows/msbuild.yml

.github/workflows/meson.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
sudo pip install meson
8585
8686
- name: ccache
87-
uses: hendrikmuhs/ccache-action@v1.2.11 # Keep this at 1.2.11 until #181 or #182 is closed
87+
uses: hendrikmuhs/ccache-action@v1
8888
with:
8989
key: ${{ github.job }}-${{ matrix.os }}
9090

@@ -175,6 +175,8 @@ jobs:
175175
env:
176176
OSXCROSS_MACPORTS_MIRROR: "https://packages.macports.org"
177177
run: |
178+
echo "::group::Installing pkg-config"
179+
sudo apt install pkg-config
178180
echo "::group::Installing mac deps"
179181
omp install libsdl2 onetbb lz4 libpng minizip luajit flac
180182
echo "OSXCROSS_PKG_CONFIG_PATH=${{env.OSXCROSS_TARGET}}/macports/pkgs/opt/local/libexec/onetbb/lib/pkgconfig" >> $GITHUB_ENV
@@ -191,7 +193,7 @@ jobs:
191193
github_token: ${{ secrets.GITHUB_TOKEN }}
192194

193195
- name: ccache
194-
uses: hendrikmuhs/ccache-action@v1.2.11 # Keep this at 1.2.11 until #181 or #182 is closed
196+
uses: hendrikmuhs/ccache-action@v1
195197
with:
196198
key: ${{ github.job }}-${{ matrix.os }}
197199

CHANGELOG.md

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
99
<details><summary><b>Added</b></summary>
1010

1111
- Pathfinding and navigation overhaul, including jetpack/jump-aware pathfinding.
12-
Actors will now intelligently choose their path depending on how high they can jump, instead of always taking the shortest path. This will reduce instances of the AI getting stuck while trying to take impossible paths.
12+
Actors will now intelligently choose their path depending on how high they can jump, instead of always taking the shortest flying path. This will reduce instances of the AI getting stuck while trying to take paths that are impossible for them.
13+
Improvements to both `ACrab` and `AHuman` navigation. `ACrab`s are now aware of how to pathfind and navigate using their jetpack, and will use it where applicable. Actors are better at using their jetpack, and will use automovers if their jetpack is not sufficient to reach a destination.
14+
Actors are now more capable and responsive when digging. They will dig to their target if they cannot reach it with their jetpack (for example if there is a long vertical shaft in the route they cannot get up), and they preferentially avoid rocks, metal and other hard substances by digging around them. Actors also dig faster and spend less time idle.
1315
In the `CalculatePath` and `CalculatePathAsync` functions, the parameter `movePathToGround` has been replaced with `jumpHeight`, which is the height in metres the pathfind can jump vertically.
14-
The new function `GetPathFindingFlyingJumpHeight()` can be used to get a jumpHeight that allows flying (i.e infinite jump height).
15-
New `Actor` Lua property `JumpHeight` (R) to estimate the jump height of the actor (in metres), based on the actor's jetpack and weight.
16+
New `Actor` Lua property `JumpHeight` (R) to estimate the jump height of the actor (in metres), based on the actor's jetpack and weight. Actors without a jetpack return 0.
17+
The new function `GetPathFindingFlyingJumpHeight()` can be used to get a jumpHeight that allows flying (i.e infinite jump height). This is also the value that `ACRocket`s and `ACDropships` return for `JumpHeight`.
18+
19+
- Improved locomotion.
20+
Added the ability to run. When running, you cannot sharpaim whatsoever.
21+
Added the ability to manually crouch. When crouching, your sharpaim distance is slightly increased.
22+
Players on PC can enable running by holding the shift key, or crouch by holding control. Players using the arrow keys can use right ctrl/shift. Controllers can run by clicking in the left stick, or crouch by holding the left stick down. Prone on controllers is now performed by clicking in the right stick. SNES/d-pad controllers run using the right bumper.
23+
Prone input now immediately throws you to the ground instead of crouching first.
24+
Added new `MovementState` type `RUN` for scripts.
25+
Added new `Controller` state `WALKCROUCH` for crouching, and `PRONE` for prone. The existing `CROUCH` state has been deprecated, as it referred to PRONE.
26+
Added new `Actor` INI and Lua (R/W) property `CanRun` which denotes whether the Actor can run or not.
27+
Added new `Actor` INI and Lua (R/W) property `CrouchWalkSpeedMultiplier` which is a walking speed multiplier when at max crouch amount.
1628

1729
- New music system, including a dynamic horizontal sequencing system, under the new music manager `MusicMan`.
1830
`PlayDynamicSong(string songName, string songSectionName, bool playImmediately, bool playTransition, bool smoothFade)` to play a new DynamicSong.
@@ -30,16 +42,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3042
Lua property `Paused` (R/W) to pause or unpause all sounds of a SoundContainer. Newly played sounds will not begin playback until unpaused.
3143
Lua function `GetAudibleVolume` to get the real audible volume of a SoundContainer's sounds as a float from 0 to 1. This accounts for literally everything, including game volume.
3244

45+
- New `LimbPath` features.
46+
New `LimbPath` INI and Lua (R/W) property `BaseTravelSpeedMultiplier` which is a multiplier on the TravelSpeed of that LimbPath, on top of any other gameplay multipliers like from crouching.
47+
New `LimbPath` INI and Lua (R/W) property `BaseScaleMultiplier`, which is a vector. This will scale the X/Y axes of the limbpath accordingly, allowing for easily adjusting limbpaths to differently sized actors, on top of any other gameplay multipliers like from running.
48+
New `LimbPath` INI property `SegmentEndedThreshold`, which defines the distance the limb must be from the end of the segment before it's considered complete. This defaults to 2.5.
49+
Exposed `LimbPath` properties `TravelSpeed` and `PushForce` to Lua (R/W).
50+
51+
- New `AEmitter` and `PEmitter` INI and Lua (R/W) property `PlayBurstSound` which denotes whether the BurstSound should play when appropriate. This should not be confused for a trigger - it's just a enable/disable toggle to avoid having to remove and add BurstSound altogether.
52+
3353
- Allow lua scripts to use LuaJIT's BitOp module (see https://bitop.luajit.org/api.html)
34-
54+
3555
</details>
3656

3757
<details><summary><b>Changed</b></summary>
3858

39-
- Conquest activities will once again fall-back to using base dropships and rockets if a random selection of the selected tech's craft can't find one capable of carrying passengers and/or cargo.
40-
41-
- All music-related functionality from AudioMan has been removed due to the addition of the MusicMan. Generic DynamicSongs have been put in to use instead.
42-
Mod activities that used to queue up all the vanilla music should now instead call, for example, `MusicMan:PlayDynamicSong("Generic Battle Music")`
59+
- Improved navigation, making running and fast walkpaths much more consistent.
4360

4461
- Increased fog-of-war resolution in all vanilla activities, and conquest, from 20x20 to 4x4.
4562
The Ronin Scrambler, the basic scanner, and `SceneMan:CastUnseenRay` have been changed to accomodate fog-of-war resolutions as fine as 1x1 and as course as 20x20.
@@ -48,10 +65,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4865
- All vanilla scenario activities have had their settings polished, respecting settings which make sense and disabling settings which don't.
4966
You can now have fog of war in the test scene, and can no longer require path to orbit in Zero-G Diggers-Only One Man Army.
5067

51-
- The Signal Hunt activity no longer has a preview image, as it was not formatted correctly and spoiled the interior structure of the cave.
68+
- Conquest activities will once again fall-back to using base dropships and rockets if a random selection of the selected tech's craft can't find one capable of carrying passengers and/or cargo.
5269

5370
- `MovableMan:OpenAllDoors()`, when passed `NOTEAM`, will now open/close doors specifically for `NOTEAM` (instead of all doors).
5471

72+
- MOs now only play the BurstSound of the first Wound they receive in a frame, which not only solves audio spam during e.g. explosions but also preserves intended audio when firing guns with a high ParticleCount at them.
73+
74+
- Changed how Get and SetLimbPathSpeed/PushForce work for `AHuman` and `ACrab`. The functions are as following:
75+
`GetLimbPathSpeed` has been renamed to `GetLimbPathTravelSpeed`.
76+
`SetLimbPathSpeed` has been renamed to `SetLimbPathTravelSpeed`.
77+
`GetLimbPathTravelSpeed(Actor.MovementState)` returns the FG/left side (for crabs) limb path travel speed for that specific movement state, instead of being hardcoded to walking only.
78+
`SetLimbPathTravelSpeed(Actor.MovementState, float newValue)` sets the travel speed for all layers and sides of any particular movement state's limb paths, instead of being hardcoded to walking only.
79+
`GetLimbPathPushForce(Actor.MovementState)` returns the FG/left side (for crabs) limb path push force for that specific movement state, instead of being hardcoded to walking only.
80+
`SetLimbPathPushForce(Actor.MovementState, float newValue)` sets the push force for all layers and sides of any particular movement state's limb paths, instead of being hardcoded to walking only.
81+
82+
- The `LimbPath` property `NormalTravelSpeed` has been renamed to just `TravelSpeed`.
83+
84+
- Almost all ctrl+* special inputs functionality (i.e restarting activity, world dumps, showing performance stats) are now mapped to right alt, to not interfere with default crouching inputs. The only exception is ctrl+arrow keys for changing console size.
85+
5586
</details>
5687

5788
<details><summary><b>Fixed</b></summary>
@@ -66,6 +97,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6697

6798
- Fixed a bug in Harvester and Massacre where setting deploy units would auto-assign units of the wrong tech.
6899

100+
- Fixed an issue where an `Actor`'s MovementState wasn't correctly accessible from script.
101+
102+
</details>
103+
104+
<details><summary><b>Removed</b></summary>
105+
106+
- All music-related functionality from AudioMan has been removed due to the addition of the MusicMan. Generic DynamicSongs have been put in to use instead.
107+
Mod activities that used to queue up all the vanilla music should now instead call, for example, `MusicMan:PlayDynamicSong("Generic Battle Music")`
108+
109+
- The Signal Hunt activity no longer has a preview image, as it was not formatted correctly and spoiled the interior structure of the cave.
110+
111+
- Removed `AHuman` property `MaxCrouchRotation`. `CrouchRotAngleTarget` is now used instead.
112+
113+
- Deprecated `LimbPath` properties `SlowTravelSpeed`, `NormalTravelSpeed` and `FastTravelSpeed`. For the sake of backwards compatibility they will not crash the game and `NormalTravelSpeed` is a valid synonym for the new `TravelSpeed`.
114+
69115
</details>
70116

71117
## [Release v6.2.2] - 2024/02/24

Data/Base.rte/AI/CrabBehaviors.lua

Lines changed: 2 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function CrabBehaviors.LookForTargets(AI, Owner)
3131
FoundMO = ToACRocket(FoundMO);
3232
elseif FoundMO.ClassName == "ACDropShip" then
3333
FoundMO = ToACDropShip(FoundMO);
34-
elseif FoundMO.ClassName == "ADoor" and FoundMO.Team ~= Activity.NOTEAM and Owner.AIMode ~= Actor.AIMODE_SENTRY and ToADoor(FoundMO).Door and ToADoor(FoundMO).Door:IsAttached() and HumanBehaviors.GetProjectileData(Owner).pen * 0.9 > ToADoor(FoundMO).Door.Material.StructuralIntegrity then
34+
elseif FoundMO.ClassName == "ADoor" and FoundMO.Team ~= Activity.NOTEAM and Owner.AIMode ~= Actor.AIMODE_SENTRY and ToADoor(FoundMO).Door and ToADoor(FoundMO).Door:IsAttached() and SharedBehaviors.GetProjectileData(Owner).pen * 0.9 > ToADoor(FoundMO).Door.Material.StructuralIntegrity then
3535
FoundMO = ToADoor(FoundMO);
3636
elseif FoundMO.ClassName == "Actor" then
3737
FoundMO = ToActor(FoundMO);
@@ -42,7 +42,7 @@ function CrabBehaviors.LookForTargets(AI, Owner)
4242
if FoundMO then
4343
if AI.Target then
4444
-- check if this MO should be targeted instead
45-
if HumanBehaviors.CalculateThreatLevel(FoundMO, Owner) > HumanBehaviors.CalculateThreatLevel(AI.Target, Owner) + 0.2 then
45+
if SharedBehaviors.CalculateThreatLevel(FoundMO, Owner) > SharedBehaviors.CalculateThreatLevel(AI.Target, Owner) + 0.2 then
4646
AI.OldTargetPos = Vector(AI.Target.Pos.X, AI.Target.Pos.Y);
4747
AI.Target = FoundMO;
4848
AI.TargetOffset = SceneMan:ShortestDistance(AI.Target.Pos, HitPoint, false); -- this is the distance vector from the target center to the point we hit with our ray
@@ -257,182 +257,6 @@ function CrabBehaviors.Sentry(AI, Owner, Abort)
257257
return true;
258258
end
259259

260-
-- move to the next waypoint
261-
function CrabBehaviors.GoToWpt(AI, Owner, Abort)
262-
if not Owner.MOMoveTarget then
263-
if SceneMan:ShortestDistance(Owner:GetLastAIWaypoint(), Owner.Pos, false).Largest < Owner.Height * 0.15 then
264-
Owner:ClearAIWaypoints();
265-
Owner:ClearMovePath();
266-
267-
if Owner.AIMode == Actor.AIMODE_GOTO then
268-
AI.SentryFacing = Owner.HFlipped; -- guard this direction
269-
AI.SentryPos = Vector(Owner.Pos.X, Owner.Pos.Y); -- guard this point
270-
Owner.AIMode = Actor.AIMODE_SENTRY;
271-
end
272-
273-
AI:CreateSentryBehavior(Owner);
274-
275-
return true;
276-
end
277-
end
278-
279-
local UpdatePathTimer = Timer();
280-
UpdatePathTimer:SetSimTimeLimitMS(5000);
281-
282-
local StuckTimer = Timer();
283-
StuckTimer:SetSimTimeLimitMS(2000);
284-
285-
local WptList, Waypoint, Dist, CurrDist;
286-
287-
while true do
288-
while AI.Target and Owner.FirearmIsReady do -- don't move around if we have something to shoot at
289-
local _ai, _ownr, _abrt = coroutine.yield(); -- wait until next frame
290-
if _abrt then return true end
291-
end
292-
293-
if Owner.Vel:MagnitudeIsGreaterThan(2) then
294-
StuckTimer:Reset();
295-
end
296-
297-
if Owner.MOMoveTarget then -- make the last waypoint marker stick to the MO we are following
298-
if MovableMan:ValidMO(Owner.MOMoveTarget) then
299-
Owner:RemoveMovePathEnd();
300-
Owner:AddToMovePathEnd(Owner.MOMoveTarget.Pos);
301-
else
302-
Owner.MOMoveTarget = nil;
303-
end
304-
end
305-
306-
if UpdatePathTimer:IsPastSimTimeLimit() then
307-
UpdatePathTimer:Reset();
308-
AI.deviceState = AHuman.STILL;
309-
AI.lateralMoveState = Actor.LAT_STILL;
310-
Waypoint = nil;
311-
WptList = nil;
312-
elseif StuckTimer:IsPastSimTimeLimit() then -- dislodge
313-
StuckTimer:Reset();
314-
if AI.lateralMoveState == Actor.LAT_LEFT then
315-
AI.lateralMoveState = Actor.LAT_RIGHT;
316-
elseif AI.lateralMoveState == Actor.LAT_LEFT then
317-
AI.lateralMoveState = Actor.LAT_LEFT;
318-
else
319-
AI.lateralMoveState = math.random(Actor.LAT_LEFT, Actor.LAT_RIGHT);
320-
end
321-
elseif WptList then -- we have a list of waypoints, folow it
322-
if not WptList[1] and not Waypoint then -- arrived
323-
if Owner.MOMoveTarget then -- following actor
324-
if MovableMan:ValidMO(Owner.MOMoveTarget) then
325-
local Trace = SceneMan:ShortestDistance(Owner.Pos, Owner.MOMoveTarget.Pos, false);
326-
-- stop here if the MOMoveTarget is close and in LOS
327-
if Trace.Largest < Owner.Height * 0.5 + Owner.MOMoveTarget.Radius and SceneMan:CastStrengthRay(Owner.Pos, Trace, 5, Vector(), 4, rte.grassID, true) then
328-
while true do
329-
AI.lateralMoveState = Actor.LAT_STILL;
330-
local _ai, _ownr, _abrt = coroutine.yield(); -- wait until next frame
331-
if _abrt then return true end
332-
333-
if Owner.MOMoveTarget and MovableMan:ValidMO(Owner.MOMoveTarget) then
334-
Trace = SceneMan:ShortestDistance(Owner.Pos, Owner.MOMoveTarget.Pos, false);
335-
if Trace.Largest > Owner.Height * 0.7 + Owner.MOMoveTarget.Radius then
336-
Waypoint = {Pos = Owner.MOMoveTarget.Pos};
337-
break;
338-
end
339-
end
340-
end
341-
else
342-
WptList = nil; -- update the path
343-
break;
344-
end
345-
end
346-
else -- moving towards a scene point
347-
if SceneMan:ShortestDistance(Owner:GetLastAIWaypoint(), Owner.Pos, false).Largest < Owner.Height * 0.4 then
348-
if Owner.AIMode == Actor.AIMODE_GOTO then
349-
AI.SentryFacing = Owner.HFlipped; -- guard this direction
350-
AI.SentryPos = Vector(Owner.Pos.X, Owner.Pos.Y); -- guard this point
351-
AI:CreateSentryBehavior(Owner);
352-
end
353-
354-
Owner:ClearAIWaypoints();
355-
Owner:ClearMovePath();
356-
357-
break;
358-
end
359-
end
360-
else
361-
if not Waypoint then -- get the next waypoint in the list
362-
UpdatePathTimer:Reset();
363-
Waypoint = table.remove(WptList, 1);
364-
if WptList[1] then
365-
Owner:RemoveMovePathBeginning();
366-
elseif not Owner.MOMoveTarget and SceneMan:ShortestDistance(Owner.Pos, Waypoint.Pos, false):MagnitudeIsLessThan(Owner.MoveProximityLimit) then -- the last waypoint
367-
Owner:ClearMovePath();
368-
WptList = nil;
369-
Waypoint = nil;
370-
end
371-
end
372-
373-
if Waypoint then
374-
CurrDist = SceneMan:ShortestDistance(Owner.Pos, Waypoint.Pos, false);
375-
if CurrDist.X < -3 then
376-
AI.lateralMoveState = Actor.LAT_LEFT;
377-
elseif CurrDist.X > 3 then
378-
AI.lateralMoveState = Actor.LAT_RIGHT;
379-
end
380-
381-
if CurrDist:MagnitudeIsLessThan(Owner.MoveProximityLimit) then
382-
Waypoint = nil;
383-
end
384-
end
385-
end
386-
else -- no waypoint list, create one
387-
local TmpList = {};
388-
table.insert(TmpList, {Pos=Owner.Pos});
389-
390-
Owner:UpdateMovePath();
391-
392-
-- wait until movepath is updated
393-
while Owner.IsWaitingOnNewMovePath do
394-
local _ai, _ownr, _abrt = coroutine.yield();
395-
if _abrt then return true end
396-
end
397-
398-
Owner:DrawWaypoints(true);
399-
400-
for WptPos in Owner.MovePath do -- skip any waypoint too close to the previous one
401-
if SceneMan:ShortestDistance(TmpList[#TmpList].Pos, WptPos, false):MagnitudeIsGreaterThan(10) then
402-
table.insert(TmpList, {Pos=WptPos});
403-
end
404-
end
405-
406-
if #TmpList < 3 then
407-
Dist = nil;
408-
if TmpList[2] then
409-
Dist = SceneMan:ShortestDistance(TmpList[2].Pos, Owner.Pos, false);
410-
end
411-
412-
-- already at the target
413-
if not Dist or Dist:MagnitudeIsLessThan(25) then
414-
Owner:ClearMovePath();
415-
break;
416-
end
417-
end
418-
419-
WptList = TmpList;
420-
421-
-- create the move path seen on the screen
422-
Owner:ClearMovePath();
423-
for _, Wpt in pairs(TmpList) do
424-
Owner:AddToMovePathEnd(Wpt.Pos);
425-
end
426-
end
427-
428-
local _ai, _ownr, _abrt = coroutine.yield(); -- wait until next frame
429-
if _abrt then return true end
430-
end
431-
432-
return true;
433-
end
434-
435-
436260
-- open fire on the selected target
437261
function CrabBehaviors.ShootTarget(AI, Owner, Abort)
438262
if not MovableMan:ValidMO(AI.Target) then

0 commit comments

Comments
 (0)