1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
2 
3 #ifndef LUASCRIPTNAMES_H
4 #define LUASCRIPTNAMES_H
5 
6 
7 #include <map>
8 #include <string>
9 #include <vector>
10 
11 
12 // These are indices into an array of 'refs' (lua_ref / lua_unref)
13 // maintained by each CLuaUnitScript.
14 
15 enum {
16 	LUAFN_Destroy,              // ( ) -> nil
17 	LUAFN_StartMoving,          // ( reversing ) -> nil
18 	LUAFN_StopMoving,           // ( ) -> nil
19 	LUAFN_Activate,             // ( ) -> nil
20 	LUAFN_Killed,               // ( recentDamage, maxHealth ) -> number delayedWreckLevel | nil
21 	LUAFN_Deactivate,           // ( ) -> nil
22 	LUAFN_WindChanged,          // ( heading, strength ) -> nil
23 	LUAFN_ExtractionRateChanged,// ( newRate ) -> nil
24 	LUAFN_RockUnit,             // ( rockDir_x, rockDir_z ) -> nil
25 	LUAFN_MoveRate,             // ( curMoveRate ) -> nil
26 	LUAFN_SetSFXOccupy,         // ( curTerrainType ) -> nil
27 	LUAFN_HitByWeapon,          // ( hitDir_x, hitDir_z, weaponDefID, damage ) -> number newDamage | nil
28 	LUAFN_QueryLandingPads,     // ( ) -> table piecenums
29 	LUAFN_Falling,              // ( ) -> nil
30 	LUAFN_Landed,               // ( ) -> nil
31 	LUAFN_BeginTransport,       // ( passengerID ) -> nil
32 	LUAFN_QueryTransport,       // ( passengerID ) -> number piece
33 	LUAFN_TransportPickup,      // ( passengerID ) -> nil
34 	LUAFN_StartUnload,          // ( ) -> nil
35 	LUAFN_EndTransport,         // ( ) -> nil
36 	LUAFN_TransportDrop,        // ( passengerID, x, y, z ) -> nil
37 	LUAFN_StartBuilding,        // BUILDER: ( h-heading, p-pitch ) -> nil ; FACTORY: ( ) -> nil
38 	LUAFN_StopBuilding,         // ( ) -> nil
39 	LUAFN_QueryNanoPiece,       // ( ) -> number piece
40 	LUAFN_QueryBuildInfo,       // ( ) -> number piece
41 	LUAFN_MoveFinished,         // ( piece, axis ) -> nil
42 	LUAFN_TurnFinished,         // ( piece, axis ) -> nil
43 
44 	// Weapon functions
45 	LUAFN_QueryWeapon,   // ( ) -> number piece
46 	LUAFN_AimWeapon,     // ( heading - owner->heading,  pitch ) -> nil
47 	LUAFN_AimShield,     // ( ) -> nil
48 	LUAFN_AimFromWeapon, // ( ) -> number piece
49 	LUAFN_FireWeapon,    // ( ) -> nil
50 	LUAFN_EndBurst,      // ( ) -> nil
51 	LUAFN_Shot,          // ( ) -> nil
52 	LUAFN_BlockShot,     // ( targetUnitID, haveUserTarget ) -> boolean
53 	LUAFN_TargetWeight,  // ( targetUnitID ) -> number targetWeight
54 
55 	LUAFN_Last,
56 };
57 
58 
59 class CLuaUnitScriptNames
60 {
61 public:
62 	static const std::vector<std::string>& GetScriptNames(); // LUAFN_* -> string
63 	static const std::map<std::string, int>& GetScriptMap(); // string -> LUAFN_*
64 
65 	static int GetScriptNumber(const std::string& fname);
66 	static const std::string& GetScriptName(int num);
67 };
68 
69 #endif
70