Skip to content

Commit

Permalink
Merge pull request #17 from XertroV/main
Browse files Browse the repository at this point in the history
add support for AK hints
  • Loading branch information
sylae authored Nov 21, 2023
2 parents 0eb17fa + ca4e6bb commit 309a8b1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
8 changes: 6 additions & 2 deletions DID.as
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace DID {
float camDot = Math::Dot(Camera::GetCurrentLookingDirection(), vis.AsyncState.Dir);

CSP.backwards = camDot < 0;


nvg::StrokeWidth(diegeticStrokeWidth*CSP.diegeticScale);
nvg::LineCap(nvg::LineCapType::Butt);
Expand All @@ -116,7 +116,7 @@ namespace DID {
leftOffset = (CSP.diegeticHorizontalDistance + maxLen*uint(CSP.diegeticLetterSpacing)) * -1;
rightOffset = CSP.diegeticHorizontalDistance;
}

for (uint i = 0; i < 4; i++) {
if (diegeticOutline.w > 0.0) {
nvg::StrokeColor(diegeticOutline);
Expand Down Expand Up @@ -194,6 +194,10 @@ namespace DID {
DID::registerLaneProviderAddon(SplitSpeedsSpeedProvider());
#endif

#if DEPENDENCY_AK_HINTS || DEPENDENCY_AK_HINTS_DEV
DID::registerLaneProviderAddon(AkHintsHandler());
#endif

// fill all our slots with empty info to prevent NPE on first frame running
for (uint i = 0; i < 8; i++) {
@lanes[i] = getInfoText("DID/NullProvider", i);
Expand Down
28 changes: 28 additions & 0 deletions DIDAddonsAkHints.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#if DEPENDENCY_AK_HINTS || DEPENDENCY_AK_HINTS_DEV

namespace DID {
class AkHintsHandler : LaneProvider {
LaneProviderSettings@ getProviderSetup() {
LaneProviderSettings settings;
settings.author = "XertroV";
settings.internalName = "DID/AkHints";
settings.friendlyName = "Current action key";
return settings;
}

LaneConfig@ getLaneConfig(LaneConfig@ &in defaults) {
try {
LaneConfig c = defaults;
auto ak = AkHints::GetAKNumber();
if (ak > 0 && ak <= 5)
c.content = ak == 5 ? "" : tostring(ak);
return c;
} catch {
warn("Exception: " + getExceptionInfo());
}
return defaults;
}
}
}

#endif
2 changes: 1 addition & 1 deletion info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ siteid = 311

[script]
dependencies = ["Camera", "VehicleState"]
optional_dependencies = ["MLHook", "MLFeedRaceData", "SplitSpeeds"]
optional_dependencies = ["MLHook", "MLFeedRaceData", "SplitSpeeds", "ak-hints", "ak-hints-dev"]
exports = [ "DID_Export.as" ]
shared_exports = [ "DID_ExportShared.as" ]
module = "DID"

0 comments on commit 309a8b1

Please sign in to comment.