1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
2 
3 
4 #include "LuaConstCMD.h"
5 
6 #include "LuaInclude.h"
7 
8 #include "LuaUtils.h"
9 #include "Sim/Units/CommandAI/Command.h"
10 
11 
12 /******************************************************************************/
13 /******************************************************************************/
14 
15 
PushEntries(lua_State * L)16 bool LuaConstCMD::PushEntries(lua_State* L)
17 {
18 	LuaPushNamedNumber(L, "OPT_ALT",      ALT_KEY);
19 	LuaPushNamedNumber(L, "OPT_CTRL",     CONTROL_KEY);
20 	LuaPushNamedNumber(L, "OPT_SHIFT",    SHIFT_KEY);
21 	LuaPushNamedNumber(L, "OPT_RIGHT",    RIGHT_MOUSE_KEY);
22 	LuaPushNamedNumber(L, "OPT_INTERNAL", INTERNAL_ORDER);
23 	LuaPushNamedNumber(L, "OPT_META",     META_KEY);
24 
25 	LuaPushNamedNumber(L, "WAITCODE_TIME",   CMD_WAITCODE_TIMEWAIT);
26 	LuaPushNamedNumber(L, "WAITCODE_DEATH",  CMD_WAITCODE_DEATHWAIT);
27 	LuaPushNamedNumber(L, "WAITCODE_SQUAD",  CMD_WAITCODE_SQUADWAIT);
28 	LuaPushNamedNumber(L, "WAITCODE_GATHER", CMD_WAITCODE_GATHERWAIT);
29 
30 #define PUSH_CMD(cmd) LuaInsertDualMapPair(L, #cmd, CMD_ ## cmd);
31 
32 	PUSH_CMD(STOP);
33 	PUSH_CMD(INSERT);
34 	PUSH_CMD(REMOVE);
35 	PUSH_CMD(WAIT);
36 	PUSH_CMD(TIMEWAIT);
37 	PUSH_CMD(DEATHWAIT);
38 	PUSH_CMD(SQUADWAIT);
39 	PUSH_CMD(GATHERWAIT);
40 	PUSH_CMD(MOVE);
41 	PUSH_CMD(PATROL);
42 	PUSH_CMD(FIGHT);
43 	PUSH_CMD(ATTACK);
44 	PUSH_CMD(AREA_ATTACK);
45 	PUSH_CMD(GUARD);
46 	PUSH_CMD(AISELECT);
47 	PUSH_CMD(GROUPSELECT);
48 	PUSH_CMD(GROUPADD);
49 	PUSH_CMD(GROUPCLEAR);
50 	PUSH_CMD(REPAIR);
51 	PUSH_CMD(FIRE_STATE);
52 	PUSH_CMD(MOVE_STATE);
53 	PUSH_CMD(SETBASE);
54 	PUSH_CMD(INTERNAL);
55 	PUSH_CMD(SELFD);
56 	PUSH_CMD(SET_WANTED_MAX_SPEED);
57 	PUSH_CMD(LOAD_UNITS);
58 	PUSH_CMD(LOAD_ONTO);
59 	PUSH_CMD(UNLOAD_UNITS);
60 	PUSH_CMD(UNLOAD_UNIT);
61 	PUSH_CMD(ONOFF);
62 	PUSH_CMD(RECLAIM);
63 	PUSH_CMD(CLOAK);
64 	PUSH_CMD(STOCKPILE);
65 	PUSH_CMD(MANUALFIRE);
66 	LuaInsertDualMapPair(L, "DGUN", CMD_MANUALFIRE); // backward compability (TODO: find a way to print a warning when used!)
67 	PUSH_CMD(RESTORE);
68 	PUSH_CMD(REPEAT);
69 	PUSH_CMD(TRAJECTORY);
70 	PUSH_CMD(RESURRECT);
71 	PUSH_CMD(CAPTURE);
72 	PUSH_CMD(AUTOREPAIRLEVEL);
73 	LuaInsertDualMapPair(L, "LOOPBACKATTACK", CMD_ATTACK); // backward compability (TODO: find a way to print a warning when used!)
74 	PUSH_CMD(IDLEMODE);
75 
76 	return true;
77 }
78 
79 
80 /******************************************************************************/
81 /******************************************************************************/
82