Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update dcs-grpc protos to latest release #58

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
id: cache-generated
with:
path: generated
key: ${{ runner.os }}-proto-${{ hashFiles('src/proto/**') }}
key: ${{ runner.os }}-proto-${{ hashFiles('src/protos/**') }}
restore-keys: |
${{ runner.os }}-proto-
- run: npm install
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
id: cache-generated
with:
path: generated
key: ${{ runner.os }}-proto-${{ hashFiles('src/proto/**') }}
key: ${{ runner.os }}-proto-${{ hashFiles('src/protos/**') }}
restore-keys: |
${{ runner.os }}-proto-
- run: npm install
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
id: cache-generated
with:
path: generated
key: ${{ runner.os }}-proto-${{ hashFiles('src/proto/**') }}
key: ${{ runner.os }}-proto-${{ hashFiles('src/protos/**') }}
restore-keys: |
${{ runner.os }}-proto-
- run: npm install
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
id: cache-generated
with:
path: generated
key: ${{ runner.os }}-proto-${{ hashFiles('src/proto/**') }}
key: ${{ runner.os }}-proto-${{ hashFiles('src/protos/**') }}
restore-keys: |
${{ runner.os }}-proto-
- run: npm install
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
id: cache-generated
with:
path: generated
key: ${{ runner.os }}-proto-${{ hashFiles('src/proto/**') }}
key: ${{ runner.os }}-proto-${{ hashFiles('src/protos/**') }}
restore-keys: |
${{ runner.os }}-proto-
- run: npm install
Expand Down
6 changes: 3 additions & 3 deletions generate-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ async function main() {

const npmBin = resolve('node_modules', '.bin')
const bin = resolve(npmBin, 'proto-loader-gen-types')
const protoDir = resolve('src', 'proto')
const dcsProtoFile = resolve(protoDir, 'dcs', 'dcs.proto')
const protosDir = resolve('src', 'protos')
const dcsProtoFile = resolve(protosDir, 'dcs', 'dcs.proto')

const args = [
'-I',
protoDir,
protosDir,
'-O',
generatedDir,
'--oneofs',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"typecheck": "tsc --noEmit",
"prettier": "npx prettier --check src/",
"full-build": "npm run codegen && npm run build",
"build": "rm -rf build/ && tsc && cp -r src/proto/ build/ && cp -r package*.json build/",
"build": "rm -rf build/ && tsc && cp -r src/protos/ build/ && cp -r package*.json build/",
"codegen": "node generate-types.js && mikro-orm cache:generate"
},
"dependencies": {
Expand Down
32 changes: 17 additions & 15 deletions src/autoRespawn/main.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
import { wrap } from '@mikro-orm/core'
import { equal } from 'assert'

import { coalitionFrom } from '../coalition'
import { CommandType, ToDestroy } from '../commands'
import { randomBetween } from '../common'
import { distanceFrom } from '../convert'
import { MarkPanel, getMarkById, getMarkPanels } from '../custom'
import { Position, Spawner, SpawnerQueuedUnit, SpawnerType, Unit } from '../db'
import { emFork } from '../db/connection'
import {
Events,
EventType,
Events,
MarkChangeEvent,
MissionCommandEvent,
} from '../events'
import { markToAll, outText, removeMapMark } from '../trigger'
import { getMarkById, getMarkPanels, MarkPanel } from '../custom'
import { CommandType, ToDestroy } from '../commands'
import { emFork } from '../db/connection'
import { Position, Spawner, SpawnerQueuedUnit, SpawnerType, Unit } from '../db'
import { distanceFrom, PositionLL, randomBetween } from '../common'
import { createGroundUnitsInCircle, spawnGroundUnit } from '../unit'
import { UnitEvents, UnitEventType, UnitGoneEvent } from '../unitEvents'
import { closestPointOnRoads, findPathOnRoads, RoadType } from '../land'
import { LatLon } from '../geo'
import { driveGroundGroup } from '../group'
import { RoadType, closestPointOnRoads, findPathOnRoads } from '../land'
import {
allSpawners,
createSpawner,
findNearbySpawners,
spawnerDestroyed,
} from '../spawner'
import { coalitionFrom } from '../coalition'
import { wrap } from '@mikro-orm/core'
import { LatLon } from '../geo'
import { markToAll, outText, removeMapMark } from '../trigger'
import { GamePositionLL } from '../types'
import { createGroundUnitsInCircle, spawnGroundUnit } from '../unit'
import { UnitEventType, UnitEvents, UnitGoneEvent } from '../unitEvents'

const UNIT_MAXIMUM_DISPLACEMENT_TO_SPAWNER_METERS = 100000
const SPAWNER_MINIMUM_DISPLACEMENT_METERS = 250
Expand Down Expand Up @@ -130,8 +132,8 @@ function respawnQueue(): () => void {
const { country, position: randomUnitDeathPosition } = randomQueuedUnit

const [firstOnRoadPosition, lastOnRoadPosition]: [
PositionLL,
PositionLL,
GamePositionLL,
GamePositionLL,
] = await Promise.all([
closestPointOnRoads(RoadType.Roads, spawner.position),
closestPointOnRoads(RoadType.Roads, randomUnitDeathPosition),
Expand Down
4 changes: 2 additions & 2 deletions src/base-templates/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PositionLL } from '../common'
import { GamePositionLL } from '../types'
import { StaticObjectTypeName, UnitTypeName } from '../db'

interface TemplateObject<TTypeName> {
Expand All @@ -9,7 +9,7 @@ interface TemplateObject<TTypeName> {
}

export interface Template {
origin: Pick<PositionLL, 'lat' | 'lon'>
origin: Pick<GamePositionLL, 'lat' | 'lon'>
/* slots that players can spawn into */
slots: TemplateObject<UnitTypeName>[]
/* Static objects (tents, barriers, decorative vehicles, etc) */
Expand Down
27 changes: 14 additions & 13 deletions src/base.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import { LatLon } from './geo'
import { baseNames } from './baseNames'
import { distanceFrom, metersToDegree, randomBetween } from './common'
import { countryFrom } from './country'
import { despawnStaticObject, spawnStaticObject } from './staticObject'
import { wrap } from '@mikro-orm/core'
import assert from 'assert'

import { Coalition } from './__generated__/dcs/common/v0/Coalition'
import {
Template,
baseLevel0,
baseLevel1,
baseLevel2,
baseLevel3,
Template,
} from './base-templates'
import assert from 'assert'
import { createUnit, despawnGroundUnit, spawnGroundUnit } from './unit'
import { despawnFarp, spawnFarp } from './farp'
import { emFork } from './db/connection'
import { baseNames } from './baseNames'
import { metersToDegree, randomBetween } from './common'
import { countryFrom, distanceFrom } from './convert'
import {
Base,
BaseType,
Color,
NewBase,
Position,
StaticObject,
TextMarkup,
Color,
} from './db'
import { Coalition } from './__generated__/dcs/common/v0/Coalition'
import { wrap } from '@mikro-orm/core'
import { emFork } from './db/connection'
import { despawnFarp, spawnFarp } from './farp'
import { LatLon } from './geo'
import { spawnMarkup } from './markup'
import { despawnStaticObject, spawnStaticObject } from './staticObject'
import { createUnit, despawnGroundUnit, spawnGroundUnit } from './unit'

/** Min range between COP bases in meters */
const BASE_COP_MIN_RANGE_METERS = 3500
Expand Down Expand Up @@ -534,8 +535,8 @@
}

export async function upgradeBaseTypeTo(
base: Base,

Check warning on line 538 in src/base.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

'base' is defined but never used
nextBaseType: BaseType

Check warning on line 539 in src/base.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

'nextBaseType' is defined but never used
): Promise<void> {
//
}
12 changes: 5 additions & 7 deletions src/bin/dump-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
import { orm } from '../db/connection'

// just hold a reference here (i promise, this fixes a bug)
const db = orm

Check warning on line 5 in src/bin/dump-template.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

'db' is assigned a value but never used

import { Position, StaticObjectTypeName, Unit, UnitTypeName } from '../db'

import assert from 'assert'
import { PositionLL } from '../common'

import { Template } from '../base-templates/types'
import { positionLatLonFrom } from '../coord'
import { Position, StaticObjectTypeName, Unit, UnitTypeName } from '../db'
import { LatLon } from '../geo'
import { Mission } from '../restartMission/types'
import { services } from '../services'
import { Template } from '../base-templates/types'
import { positionLatLonFrom } from '../coord'
import { GamePositionLL } from '../types'

const { custom, hook } = services

Expand Down Expand Up @@ -42,7 +40,7 @@
interface StaticObject {
id: string
typeName: string
position: Pick<PositionLL, 'lat' | 'lon'>
position: Pick<GamePositionLL, 'lat' | 'lon'>
heading: number // in radians
}

Expand Down
Loading
Loading