Skip to content

Commit

Permalink
⚡ Add local variabe value to Action Press events
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmoMyzrailGorynych committed Jul 27, 2022
1 parent d214a2a commit 3fdfa59
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/data/i18n/English.json
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,8 @@
"action": "Action"
},
"coreEventsLocals": {
"OnActionDown_value": "Current action's value"
"OnActionDown_value": "Current action's value",
"OnActionPress_value": "Current action's value"
},
"coreEventsDescriptions": {
"OnCreate": "Triggers when your copy is created.",
Expand Down
11 changes: 11 additions & 0 deletions src/node_requires/events/coreEventsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,21 @@ coreEvents.core_OnActionDown.locals = {
description: 'Current action\'s value'
}
};
coreEvents.core_OnActionPress.locals = {
value: {
type: 'number',
description: 'Current action\'s value'
}
};
coreEvents.core_OnActionDown.inlineCodeTemplates.thisOnStep = `
if (ct.actions[/*%%action%%*/].down) {
let value = ct.actions[/*%%action%%*/].value;
\n/*%%USER_CODE%%*/\n
}`;
coreEvents.core_OnActionPress.inlineCodeTemplates.thisOnStep = `
if (ct.actions[/*%%action%%*/].pressed) {
let value = ct.actions[/*%%action%%*/].value;
\n/*%%USER_CODE%%*/\n
}`;

export = coreEvents;

0 comments on commit 3fdfa59

Please sign in to comment.