diff --git a/src/lib-task.js b/src/lib-task.js index cc87ab4..c527b61 100644 --- a/src/lib-task.js +++ b/src/lib-task.js @@ -52,10 +52,10 @@ const lib = setup({ })), 'task-abort': - sendTo(gamesys, (_, {task_id, err}) => ({ + sendTo(gamesys, ({event}, {task_id, err}) => ({ type: 'task.aborted', task_id, - err + err: event.response || err || 'NOT_ENOUGH_RESOURCES' })), 'task-ack': @@ -208,7 +208,6 @@ export default function (definitions) { type: 'task-abort', params: { task_id: id, - err: 'NOT_ENOUGH_RESOURCES' } } } diff --git a/src/messages_en.yaml b/src/messages_en.yaml index 4665261..7826d4f 100644 --- a/src/messages_en.yaml +++ b/src/messages_en.yaml @@ -22,6 +22,9 @@ action_ok: Ok # Errors +NOTHING_TO_SOW: > + You have no grains and no vegetables. + NOT_ENOUGH_RESOURCES: > You do not have all the resources to complete this action. diff --git a/src/task-113.js b/src/task-113.js index 4f6ed87..f055065 100644 --- a/src/task-113.js +++ b/src/task-113.js @@ -14,8 +14,9 @@ export default task({ check: (_, game) => { const {supply: {grain, vegetable}, farmyard} = game; - // TODO: specific error code - if (!grain && !vegetable) return false; + if (!grain && !vegetable) { + return 'NOTHING_TO_SOW'; + } const spaces = Object.values(farmyard);