Skip to content

Commit

Permalink
Merge pull request #1263 from Freddo3000/statemachine_fsm-editor-cfg
Browse files Browse the repository at this point in the history
FSM Editor Config for CBA Statemachine
  • Loading branch information
commy2 committed Dec 21, 2019
2 parents 80a6155 + defe628 commit 0c27a7d
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions addons/statemachine/CBA_FSMEditor.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/* ----------------------------------------------------------------------------
CBA Statemachine Config for use with the FSM Editor

Description:
This is a config that allows you to create and edit CBA Statemachines using
the Arma Tools FSM editor for increased readability and expandability.

Usage:
1. Select this config using FsmAttributes > Compile Config
2. Change FSM attributes under FsmAttributes > Attributes from Compile Config.
2.1 'list' parameter is parsed as list = QUOTE(x);
2.2 'skipNull' parameter is parsed as skipNull = x;
3. States
3.1 'initCode' is parsed as is, and may contain onState = "",
onStateEntered = "" and/or onStateLeaving = ""
4. Transitions
4.1 'targetState' does not need to be entered, and simply follows the
transition link.
4.2 'condition' is parsed as condition = QUOTE(x)
4.3 'action' is parsed as is, and may contain onTransition = ""
and/or events[] = {}

Dependencies:
In order to properly function, script_macros_common.hpp must be included.

Author:
Freddo & PiZZADOX
---------------------------------------------------------------------------- */

class Attributes {
names[] = {"list", "skipNull"};
};

class Compile {
clearNewLines = 0;
indenting = 0; // no indenting
rewriteFile = 1; // Do not append result to the end of file, but rewrite it.

class Pass_States {
print_sm = "class %(fsmname) {\n";
indent_smOpen = 4;
print_attrList = "list = QUOTE(%(list));\n";
print_attrSkipNull = "skipNull = %(skipNull);\n";

class State_Any {
print_state = "class %(statename) {\n";
indent_stateContents = 8; //Neccessary to preserve formatting
print_stateContents = "%(stateinit)\n";
indent_stateOpen = 8;

class Links {
print_transition = "class %(linkname) {\n";
indent_transitionOpen = 12;
print_target = "targetState = QUOTE(%(to));\n";
print_condition = "condition = QUOTE(%(condition));";
indent_transitionContents = 12; // Neccessary to preserve formatting.
print_transitionContents = "%(action)\n";
indent_transitionClose = 8;
print_transitionClose = "};\n";
};

indent_stateClose = 4;
print_stateClose = "};\n";
};

indent_smClose = 0;
print_smClose = "};\n";
};
};

class Decompile {
process = 0; // 1 for processing Decompile info.
FSMLeft = "/*";
FSMRight = "*/";

class FSMPrefix {
default = "";
};

class FSMPrefix2 {
default = "";
head = "*/";
};

class FSMSufix {
default = "";
compile = "\n";
state = "\n";
head = "\n/*\n";
link = "\n";
};

class FSMSufix2 {
default = "";
compile = "";
state = "\n";
head = "\n";
link = "\n";
};
};

0 comments on commit 0c27a7d

Please sign in to comment.