1
0
Fork 0

Fixed actionbar interactive status

This commit is contained in:
Michaël Lemaire 2017-11-14 23:45:41 +01:00
parent 9d2f3d6c4d
commit 3310440ff9
3 changed files with 13 additions and 1 deletions

View file

@ -224,7 +224,6 @@ module TK.SpaceTac.UI {
}
this.updatePower();
this.setInteractive(this.ship != null);
}
// Called by an action icon when the action is selected

View file

@ -169,6 +169,10 @@ module TK.SpaceTac.UI {
* If the AI is already playing, do nothing
*/
playAI(): void {
if (this.session.spectator) {
return;
}
if (this.actual_battle.playAI()) {
if (this.interacting) {
this.action_bar.setShip(new Ship());
@ -181,6 +185,10 @@ module TK.SpaceTac.UI {
* Apply an action to the actual battle
*/
applyAction(action: BaseAction, target?: Target): boolean {
if (this.session.spectator) {
return false;
}
let ship = this.actual_battle.playing_ship;
if (ship) {
let ship_action = first(ship.getAvailableActions(), ac => ac.is(action));

View file

@ -44,9 +44,14 @@ module TK.SpaceTac.UI {
start() {
if (!this.view.gameui.headless) {
this.log.play(async diff => {
while (this.view.game.paused) {
await this.view.timer.sleep(500);
}
await this.processBattleDiff(diff);
this.transferControl();
});
this.transferControl();
}
}