Fix issues

This commit is contained in:
schmelczerandras 2020-11-05 19:27:27 +01:00
parent 57d7009342
commit 42e4de28b5
15 changed files with 175 additions and 145 deletions

View file

@ -8,6 +8,8 @@ import {
settings,
PlanetBase,
CharacterTeam,
PropertyUpdatesForObject,
UpdateProperty,
} from 'shared';
import { ImmutableBoundingBox } from '../physics/bounding-boxes/immutable-bounding-box';
@ -102,12 +104,16 @@ export class PlanetPhysical
public step(deltaTime: number): void {
this.timeSinceLastPointGeneration += deltaTime;
// In reverse order, so that teams can achieve a 100% control.
this.remoteCall('setOwnership', this.ownership);
this.takeControl(CharacterTeam.neutral, deltaTime);
}
public getPropertyUpdates(): PropertyUpdatesForObject {
return new PropertyUpdatesForObject(this.id, [
new UpdateProperty('ownership', this.ownership, 0),
]);
}
public takeControl(team: CharacterTeam, deltaTime: number) {
if (team === CharacterTeam.decla) {
this.ownership -= (0.5 / settings.takeControlTimeInSeconds) * deltaTime;