Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
fix: plane scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
leia-uwu committed Sep 13, 2024
1 parent 56fb9bc commit 41f3690
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions server/src/game/objects/gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class Gas {
/**
* Like stage but is incremented after gas goes through Waiting and Moving mode's
*/
circleIdx = 0;
circleIdx = -1;

/**
* Current gas stage damage
Expand Down Expand Up @@ -271,6 +271,8 @@ export class Gas {
this.duration = stage.duration;
this.damage = stage.damage;

const circleIdxOld = this.circleIdx;

if (this.mode === GasMode.Waiting) {
this.posOld = v2.copy(this.posNew);

Expand All @@ -288,14 +290,18 @@ export class Gas {

this.currentPos = this.posOld;
this.currentRad = this.radOld;
this.circleIdx++;
}

if (this.game.map.mapDef.gameConfig.roles) {
this.game.playerBarn.scheduleRoleAssignments();
}
for (const plane of this.game.map.mapDef.gameConfig.planes.timings) {
if (plane.circleIdx === this.circleIdx) {
this.game.planeBarn.schedulePlane(plane.wait, plane.options);
if (this.circleIdx !== circleIdxOld) {
if (this.game.map.mapDef.gameConfig.roles) {
this.game.playerBarn.scheduleRoleAssignments();
}

for (const plane of this.game.map.mapDef.gameConfig.planes.timings) {
if (plane.circleIdx === this.circleIdx) {
this.game.planeBarn.schedulePlane(plane.wait, plane.options);
}
}
}

Expand Down

0 comments on commit 41f3690

Please sign in to comment.