From 0b327fec2625ce027b53fed104b2cb0ebfa5270a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Thu, 9 Mar 2017 19:43:24 +0100 Subject: [PATCH] Fixed ship listing "nothing" actions as available --- src/core/Ship.spec.ts | 5 +++++ src/core/Ship.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/Ship.spec.ts b/src/core/Ship.spec.ts index 9f2a22c..5f016c7 100644 --- a/src/core/Ship.spec.ts +++ b/src/core/Ship.spec.ts @@ -51,6 +51,11 @@ module TS.SpaceTac.Specs { equipment.action = new MoveAction(equipment); slot.attach(equipment); + slot = ship.addSlot(SlotType.Weapon); + equipment = new Equipment(); + equipment.slot = slot.type; + slot.attach(equipment); + actions = ship.getAvailableActions(); expect(actions.length).toBe(2); expect(actions[0].code).toEqual("move"); diff --git a/src/core/Ship.ts b/src/core/Ship.ts index f7a75ae..9b6cb38 100644 --- a/src/core/Ship.ts +++ b/src/core/Ship.ts @@ -162,7 +162,7 @@ module TS.SpaceTac { if (this.alive) { this.slots.forEach((slot: Slot) => { - if (slot.attached && slot.attached.action) { + if (slot.attached && slot.attached.action && slot.attached.action.code != "nothing") { actions.push(slot.attached.action); } });