Skip to content

Commit

Permalink
Update rules with proper IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelio committed Sep 19, 2024
1 parent ebb3d25 commit dbe7e34
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/rules/lights_under_10k.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class LightsUnder10K implements Rule {
}

return Acars.ViolatedAfterDelay(
this.meta.name,
this.meta.id,
this.meta.delay_time,
(): RuleValue => {
// Ignore landing lights being turned on
Expand Down
2 changes: 1 addition & 1 deletion src/rules/speed_under_10k.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class SpeedUnder10K implements Rule {
}

return Acars.ViolatedAfterDelay(
this.meta.name,
this.meta.id,
this.meta.delay_time,
(): RuleValue => {
// Ignore landing lights being turned on
Expand Down
10 changes: 3 additions & 7 deletions src/rules/strobes_in_flights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@ export default class StrobesInFlight implements Rule {
return [false]
}

return Acars.ViolatedAfterDelay(
this.meta.name,
this.meta.delay_time,
() => {
return !data.strobeLights ? [true] : [false]
},
)
return Acars.ViolatedAfterDelay(this.meta.id, this.meta.delay_time, () => {
return !data.strobeLights ? [true] : [false]
})
}
}
2 changes: 1 addition & 1 deletion src/rules/strobes_on_during_taxi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class LightsOffDuringTaxi implements Rule {
}

return Acars.ViolatedAfterDelay(
this.meta.name,
this.meta.id,
this.meta.delay_time,
(): RuleValue => {
// Ignore landing lights being turned on
Expand Down
6 changes: 4 additions & 2 deletions src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ declare global {
function IsFeatureEnabled(feature: AircraftFeature): boolean {}
/** Get something from storage */
function Get(key: string): string {}
/** Save something to storage */
function Set(key: string, value?: string): void {}
/**
* @param key
* @param value
Expand Down Expand Up @@ -45,12 +47,12 @@ declare global {
* where the rule evaluation takes place. This method is evaluated often (many times a second),
* and if at any point before the timeout is hit, it will stop and reset.
*
* @param name The name to use to track this internally
* @param id The ID of the rule to be tracked. You can add additional info
* @param timeout Amount of time, in milliseconds
* @param callback Needs to return an array matching the RuleValue type
*/
function ViolatedAfterDelay(
name: string,
id: string,
timeout: number,
callback: () => RuleValue,
): RuleValue {}
Expand Down

0 comments on commit dbe7e34

Please sign in to comment.