Rigs of Rods 2023.09
Soft-body Physics Simulation
Loading...
Searching...
No Matches
AutopilotAngelscript.cpp
Go to the documentation of this file.
1#include "Application.h"
2#include "ScriptEngine.h"
3#include "AutoPilot.h"
4#include "SimData.h"
5
6#include <angelscript.h>
7
8using namespace AngelScript;
9
10void RoR::RegisterAutopilot(asIScriptEngine* engine)
11{
12 int result = 0;
13
14 Autopilot::RegisterRefCountingObject(engine, "AutopilotClass");
15 AutopilotPtr::RegisterRefCountingObjectPtr(engine, "AutopilotClassPtr", "AutopilotClass");
16
17 // enum APHeadingMode
18 result = engine->RegisterEnum("APHeadingMode"); ROR_ASSERT(result >= 0);
19 result = engine->RegisterEnumValue("APHeadingMode", "HEADING_NONE", Autopilot::HEADING_NONE); ROR_ASSERT(result >= 0);
20 result = engine->RegisterEnumValue("APHeadingMode", "HEADING_FIXED", Autopilot::HEADING_FIXED); ROR_ASSERT(result >= 0);
21 result = engine->RegisterEnumValue("APHeadingMode", "HEADING_NAV", Autopilot::HEADING_NAV); ROR_ASSERT(result >= 0);
22 result = engine->RegisterEnumValue("APHeadingMode", "HEADING_WLV", Autopilot::HEADING_WLV); ROR_ASSERT(result >= 0);
23
24 // enum APAltitudeMode
25 result = engine->RegisterEnum("APAltitudeMode"); ROR_ASSERT(result >= 0);
26 result = engine->RegisterEnumValue("APAltitudeMode", "ALT_NONE", Autopilot::ALT_NONE); ROR_ASSERT(result >= 0);
27 result = engine->RegisterEnumValue("APAltitudeMode", "ALT_FIXED", Autopilot::ALT_FIXED); ROR_ASSERT(result >= 0);
28 result = engine->RegisterEnumValue("APAltitudeMode", "ALT_VS", Autopilot::ALT_VS); ROR_ASSERT(result >= 0);
29
30 // PLEASE maintain same order as in 'gameplay/AutoPilot.h' and 'doc/angelscript/Script2Game/AutopilotClass.h'
31 result = engine->RegisterObjectMethod("AutopilotClass", "void disconnect()", asMETHOD(Autopilot, disconnect), asCALL_THISCALL); ROR_ASSERT(result >= 0);
32 result = engine->RegisterObjectMethod("AutopilotClass", "APHeadingMode toggleHeading(APHeadingMode)", asMETHOD(Autopilot, toggleHeading), asCALL_THISCALL); ROR_ASSERT(result >= 0);
33 result = engine->RegisterObjectMethod("AutopilotClass", "APAltitudeMode toggleAltitude(APAltitudeMode)", asMETHOD(Autopilot, toggleAlt), asCALL_THISCALL); ROR_ASSERT(result >= 0);
34 result = engine->RegisterObjectMethod("AutopilotClass", "bool toggleIAS()", asMETHOD(Autopilot, toggleIAS), asCALL_THISCALL); ROR_ASSERT(result >= 0);
35 result = engine->RegisterObjectMethod("AutopilotClass", "bool toggleGPWS()", asMETHOD(Autopilot, toggleGPWS), asCALL_THISCALL); ROR_ASSERT(result >= 0);
36 result = engine->RegisterObjectMethod("AutopilotClass", "int adjustHeading(int)", asMETHOD(Autopilot, adjHDG), asCALL_THISCALL); ROR_ASSERT(result >= 0);
37 result = engine->RegisterObjectMethod("AutopilotClass", "int adjustAltitude(int)", asMETHOD(Autopilot, adjALT), asCALL_THISCALL); ROR_ASSERT(result >= 0);
38 result = engine->RegisterObjectMethod("AutopilotClass", "int adjustVerticalSpeed(int)", asMETHOD(Autopilot, adjVS), asCALL_THISCALL); ROR_ASSERT(result >= 0);
39 result = engine->RegisterObjectMethod("AutopilotClass", "int adjustIAS(int)", asMETHOD(Autopilot, adjIAS), asCALL_THISCALL); ROR_ASSERT(result >= 0);
40 result = engine->RegisterObjectMethod("AutopilotClass", "float getVerticalApproachDeviation()", asMETHOD(Autopilot, GetVerticalApproachDeviation), asCALL_THISCALL); ROR_ASSERT(result >= 0);
41 result = engine->RegisterObjectMethod("AutopilotClass", "float getHorizontalApproachDeviation()", asMETHOD(Autopilot, GetHorizontalApproachDeviation), asCALL_THISCALL); ROR_ASSERT(result >= 0);
42 result = engine->RegisterObjectMethod("AutopilotClass", "bool isILSAvailable()", asMETHOD(Autopilot, IsIlsAvailable), asCALL_THISCALL); ROR_ASSERT(result >= 0);
43 result = engine->RegisterObjectMethod("AutopilotClass", "APHeadingMode getHeadingMode()", asMETHOD(Autopilot, GetHeadingMode), asCALL_THISCALL); ROR_ASSERT(result >= 0);
44 result = engine->RegisterObjectMethod("AutopilotClass", "int getHeadingValue()", asMETHOD(Autopilot, GetHeadingValue), asCALL_THISCALL); ROR_ASSERT(result >= 0);
45 result = engine->RegisterObjectMethod("AutopilotClass", "APAltitudeMode getAltitudeMode()", asMETHOD(Autopilot, GetAltMode), asCALL_THISCALL); ROR_ASSERT(result >= 0);
46 result = engine->RegisterObjectMethod("AutopilotClass", "int getAltitudeValue()", asMETHOD(Autopilot, GetAltValue), asCALL_THISCALL); ROR_ASSERT(result >= 0);
47 result = engine->RegisterObjectMethod("AutopilotClass", "bool getIASMode()", asMETHOD(Autopilot, GetIasMode), asCALL_THISCALL); ROR_ASSERT(result >= 0);
48 result = engine->RegisterObjectMethod("AutopilotClass", "int getIASValue()", asMETHOD(Autopilot, GetIasValue), asCALL_THISCALL); ROR_ASSERT(result >= 0);
49 result = engine->RegisterObjectMethod("AutopilotClass", "bool getGPWSMode()", asMETHOD(Autopilot, GetGpwsMode), asCALL_THISCALL); ROR_ASSERT(result >= 0);
50 result = engine->RegisterObjectMethod("AutopilotClass", "int getVerticalSpeedValue()", asMETHOD(Autopilot, GetVsValue), asCALL_THISCALL); ROR_ASSERT(result >= 0);
51}
Central state/object manager and communications hub.
#define ROR_ASSERT(_EXPR)
Definition Application.h:40
Core data structures for simulation; Everything affected by by either physics, network or user intera...
void RegisterAutopilot(AngelScript::asIScriptEngine *engine)