1
0
Fork 0

Fixed personality reaction not working

This commit is contained in:
Michaël Lemaire 2019-05-23 18:34:24 +02:00
parent bc32e7d81a
commit 77582d0be7
1 changed files with 17 additions and 7 deletions

View File

@ -21,6 +21,9 @@ module TK.SpaceTac.UI {
private speed = 1
private temp_speed?: number
// Currently playing ship
playing_ship: Ship | null = null
// Debug indicators
private debug = false
private ai_disabled = false
@ -43,11 +46,19 @@ module TK.SpaceTac.UI {
});
// Internal subscribers
this.register((diff) => this.checkReaction(diff));
this.register((diff) => this.checkControl(diff));
this.register((diff) => this.checkProjectileFired(diff));
this.register((diff) => this.checkShipDeath(diff));
this.register((diff) => this.checkBattleEnded(diff));
this.register(diff => {
if (diff instanceof ShipActionUsedDiff) {
this.playing_ship = this.view.battle.getShip(diff.ship_id);
} else if (diff instanceof ShipActionEndedDiff) {
this.playing_ship = null;
}
return {};
});
this.register(diff => this.checkReaction(diff));
this.register(diff => this.checkControl(diff));
this.register(diff => this.checkProjectileFired(diff));
this.register(diff => this.checkShipDeath(diff));
this.register(diff => this.checkBattleEnded(diff));
}
/**
@ -164,8 +175,7 @@ module TK.SpaceTac.UI {
*/
private checkReaction(diff: BaseBattleDiff): LogProcessorDelegate {
if (this.log.isPlaying()) {
let playing_ship = null; // FIXME
let reaction = this.view.session.reactions.check(this.view.player, this.view.battle, playing_ship, diff);
let reaction = this.view.session.reactions.check(this.view.player, this.view.battle, this.playing_ship, diff);
if (reaction) {
return {
foreground: async () => {