Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSM Editor Config for CBA Statemachine #1263

Merged
merged 4 commits into from
Dec 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";
};
};