From 98ac2e7122937b0d0d0671ced3b5efbfb0419db3 Mon Sep 17 00:00:00 2001 From: Thaum Rystra <9525416+ThaumRystra@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:10:32 +0200 Subject: [PATCH] Made ammo consumed available in scope as `~ammo` --- .../api/engine/actions/applyPropertyByType/applyAction.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/imports/api/engine/actions/applyPropertyByType/applyAction.js b/app/imports/api/engine/actions/applyPropertyByType/applyAction.js index 070cef04..433d4ec1 100644 --- a/app/imports/api/engine/actions/applyPropertyByType/applyAction.js +++ b/app/imports/api/engine/actions/applyPropertyByType/applyAction.js @@ -243,6 +243,9 @@ function spendResources(prop, actionContext) { gainLog.push(logName + ': ' + -itemConsumed.quantity.value); } ammoChildren.push(...getItemChildren(item, actionContext, prop)); + // simulate the increment and add the item to the action scope + item.quantity -= itemConsumed.quantity.value; + actionContext.scope['~ammo'] = item; }); } catch (e) { actionContext.addLog({