Fix issues
This commit is contained in:
parent
57d7009342
commit
42e4de28b5
15 changed files with 175 additions and 145 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue