15 #include <luabind/luabind.hpp>
24 #include <boost/signals2.hpp>
31 namespace makVrfEvents
34 class DtInfluenceEvent;
58 #ifdef DtObjectDebugger_Enable
73 virtual void init()
override;
93 virtual void setLuaState(lua_State* L);
94 virtual lua_State* getLuaState();
96 virtual std::string dumpLuaStack()
const;
97 virtual int luaStackSize()
const;
98 virtual void collectGarbage();
128 static void invalidateLuaScriptInterfaceExtension(
131 virtual bool initializeVRFLuaExtensions(lua_State* L);
132 virtual bool importTaskParams(lua_State* L);
135 virtual bool importSetParams(lua_State* L);
138 virtual luabind::object createLuaTableFromRegistry(lua_State* L,
const DtReaderWriterRegistry& rwRegistry,
bool requireMetadata =
true,
bool hasParamMetaData =
true,
139 bool converyKeysToUseUnderscore =
true);
145 static void addKeyToIgnore(
const std::string&);
148 static void removeKeyToIgnore(
const std::string&);
151 void luaEndTask(
bool success);
163 virtual void luaStopScenarioEventWithRewind(
DtScriptVrfObject eventName,
bool rewind);
175 virtual int taskIdNumber();
177 virtual int luaSendEmbeddedEntityTask(std::string eeName, std::string taskName, luabind::object
const& parms);
178 virtual int luaSendEmbeddedEntityTaskActAsSubtask(std::string eeName, std::string taskName,
179 luabind::object
const& parms,
bool actAsSubtask);
181 virtual int luaSendEmbeddedEntitySet(std::string eeName, std::string setName, luabind::object
const& parms);
186 int luaStartSubtask(
const std::string taskName, luabind::object
const& parameters);
188 void luaStopSubtask(
int subtaskId);
190 void luaStopAllSubtasks();
192 bool luaIsSubtaskRunning(
int subtaskId);
194 bool luaIsSubtaskComplete(
int subtaskId);
196 bool luaIsSubtaskCanceled(
int subtaskId);
198 bool luaSubtaskResult(
int subtaskId);
202 void luaCleanupInactiveSubtaskStatus();
207 virtual void luaSendChatMessage(
const std::string& user,
const std::string& channel,
int force,
const std::string& message);
208 virtual void luaSendChatMessageForceString(
const std::string& user,
const std::string& channel,
const std::string& force,
const std::string& message);
211 void luaSendReportWithoutRecipients(const::std::string reportType,
212 luabind::object
const& parameters);
213 void luaSendReport(const::std::string reportType,
214 luabind::object
const& reciptients,
215 luabind::object
const& parameters);
219 luabind::object
const& parameters);
220 int luaSendTaskNotAsSubtask(
DtScriptVrfObject&
object, const::std::string taskName,
221 luabind::object
const& parameters);
222 int luaSendTaskActAsSubtask(
DtScriptVrfObject&
object, const::std::string taskName,
223 luabind::object
const& parameters,
bool actAsSubtask);
225 luabind::object
const& parameters);
226 int luaSendRadioTaskActAsSubtask(
DtScriptVrfObject&
object, const::std::string taskName,
227 luabind::object
const& parameters,
bool actAsSubtask);
228 int luaSendTaskActAsSubtaskWithRadio(
DtScriptVrfObject&
object, const::std::string taskName,
229 luabind::object
const& parameters,
bool actAsSubtask,
bool sendWithRadio);
232 void luaStopAllTasks();
235 void luaSendSetDataToSelf(const::std::string setName,
236 luabind::object
const& parameters);
240 luabind::object
const& parameters);
242 luabind::object
const& parameters);
244 luabind::object
const& parameters,
bool useRadio);
246 bool luaIsTaskAvailable(const::std::string taskName);
247 bool luaIsSetAvailable(const::std::string setName);
250 luabind::object luaGetReactionStatus();
260 luabind::object luaGetOrbatList();
263 std::string luaGetScriptId();
266 std::string luaGetSystemName();
269 luabind::object luaGetObjectsNearWithFilter(
const DtLocation3D& loc,
double distance, luabind::object
const& parameters);
271 luabind::object luaGetScriptAttribute(
const std::string& attributeName,
bool&
error);
274 luabind::object luaGetVrfObjects();
279 const luabind::object& params);
286 DtLuaFeatureSet luaGetFeaturesWithinArea(luabind::object
const& points, luabind::object
const& attributes);
289 DtLuaFeatureSet luaGetFeaturesWithinAreaNoAttributes(luabind::object
const& points);
315 bool isPointInNavigationArea(
const DtLocation3D& point, std::string& navArea)
const;
319 std::shared_ptr<DtLuaAsyncJob> findNavigationAreaTransitionPoint(
const DtLocation3D& insidePoint,
325 std::shared_ptr<DtLuaAsyncJob> findMultipleNavigationAreaTransitionPoints(
326 const luabind::object& pairsOfPoints)
const;
329 std::shared_ptr<DtLuaAsyncJob> generateRandomPoints(
const luabind::object& parameters);
332 std::shared_ptr<DtLuaAsyncJob> findNearbyPointOfInterest(
const int type);
335 std::shared_ptr<DtLuaAsyncJob> findCoverPoint(
337 double threatRadius,
double distanceFromThreat,
double range,
unsigned numberOfPoints);
340 luabind::object findLadders(lua_State* L,
const DtLocation3D& startLocation,
double range);
342 luabind::object findLaddersWithId(lua_State* L,
const DtLocation3D& startLocation,
343 double range,
const unsigned int id);
346 std::shared_ptr<DtLuaAsyncJob> findPathToLocation(
348 bool useAbstractGraphs,
const DtLocation3D& avoidLocation,
double avoidanceRadius);
349 std::shared_ptr<DtLuaAsyncJob> findPathToLocationWithParameters(
const DtLocation3D& startLocation,
350 const DtLocation3D& destinationLocation,
const luabind::object& parameters);
352 std::shared_ptr<DtLuaAsyncJob> findPathToLocationWithParameterObject(
const DtLocation3D& startLocation,
357 std::shared_ptr<DtLuaAsyncJob> placeFormation(
const luabind::object& parameters);
358 std::shared_ptr<DtLuaAsyncJob> placeFormationWithWidth(
const luabind::object& parameters,
366 luabind::object findNavSectors(lua_State* L,
const DtLocation3D& location);
373 std::shared_ptr<DtLuaAsyncJob> luaNavigateThroughFeatures(
const luabind::object& parameters);
377 virtual std::shared_ptr<DtLuaAsyncJob> luaFindHighPoints(
const luabind::object& corners,
unsigned int nPoints);
378 virtual std::shared_ptr<DtLuaAsyncJob> luaFindHighPointsDebug(
const luabind::object& corners,
unsigned int nPoints,
bool bDebug);
395 virtual std::shared_ptr<DtLuaAsyncJob> luaFindSinglePosition(
396 const luabind::object& targetAreaCorners,
398 double targetHeightMeters,
399 double viewHeightMeters,
400 double hideHeightMeters,
401 double forwardBackSearchLimitMeters,
402 double forwardBackSearchIntervalMeters,
403 double maxSlopeDegrees);
418 virtual std::shared_ptr<DtLuaAsyncJob> luaFindSinglePositionDebug(
419 const luabind::object& targetAreaCorners,
421 double targetHeightMeters,
422 double viewHeightMeters,
423 double hideHeightMeters,
424 double forwardBackSearchLimitMeters,
425 double forwardBackSearchIntervalMeters,
426 double maxSlopeDegrees,
443 virtual std::shared_ptr<DtLuaAsyncJob> luaFindVehicleFightingPositions(
444 unsigned int nPositionPairs,
445 const luabind::object& targetAreaCorners,
450 double forwardBackSearchLimit,
451 double sideSideSearchLimit,
452 double maxSlopeDegrees,
453 double positionSpacing);
456 virtual std::shared_ptr<DtLuaAsyncJob> luaFindVehicleFightingPositionsDebug(
457 unsigned int nPositionPairs,
458 const luabind::object& targetAreaCorners,
463 double forwardBackSearchLimit,
464 double sideSideSearchLimit,
465 double maxSlopeDegrees,
466 double positionSpacing,
469 virtual std::shared_ptr<DtLuaAsyncJob> luaFindPositionGroupsInAreaHilltop(
470 unsigned int nPositionPairsPerGroup,
471 const luabind::object& searchAreaVertices,
472 const luabind::object& targetsAreaVertices,
473 double viewHeightMeters,
474 double coverHeightMeters,
475 unsigned int forwardBackRangeMeters,
476 unsigned int sideSideRangeMeters,
477 unsigned int searchIntervalMeters,
478 double maxSlopeDegrees,
479 unsigned int positionsLateralSpacingMeters);
481 virtual std::shared_ptr<DtLuaAsyncJob> luaFindPositionGroupsInAreaHilltopDebug(
482 unsigned int nPositionPairsPerGroup,
483 const luabind::object& searchAreaVertices,
484 const luabind::object& targetsAreaVertices,
485 double viewHeightMeters,
486 double coverHeightMeters,
487 unsigned int forwardBackRangeMeters,
488 unsigned int sideSideRangeMeters,
489 unsigned int searchIntervalMeters,
490 double maxSlopeDegrees,
491 unsigned int positionsLateralSpacingMeters,
494 virtual std::shared_ptr<DtLuaAsyncJob> luaFindPositionGroupsInAreaRidge(
495 unsigned int nPositionPairsPerGroup,
496 const luabind::object& searchAreaVertices,
497 const luabind::object& targetsAreaVertices,
498 unsigned int targetsAreaSampleRate,
499 const luabind::object& tableOfDoubles
502 virtual std::shared_ptr<DtLuaAsyncJob> luaFindPositionGroupsInAreaRidgeDebug(
503 unsigned int nPositionPairsPerGroup,
504 const luabind::object& searchAreaVertices,
505 const luabind::object& targetsAreaVertices,
506 unsigned int targetsAreaSampleRate,
507 const luabind::object& tableOfDoubles
512 std::shared_ptr<DtLuaAsyncJob> getAllEmbarkationSlots(
DtScriptVrfObject&
object);
519 std::shared_ptr<DtLuaAsyncJob> getEmbarkationSlotsFiltered(
DtScriptVrfObject&
object,
523 std::shared_ptr<DtLuaAsyncJob> reserveEmbarkationSlot(
DtScriptVrfObject&
object,
int slotNumber);
526 std::shared_ptr<DtLuaAsyncJob> getEmbarkationEgressPoints(
DtScriptVrfObject&
object);
528 void luaSendMessage(
const DtScriptVrfObject& receiver,
const std::string& message);
529 void luaSendRadioMessage(
const DtScriptVrfObject& receiver,
const std::string& message);
530 void luaSendRadioMessageToUuid(
const std::string& uuid,
const std::string& message);
531 void luaDeleteObject(std::string
const& receiver);
533 void luaSetInterest(
const DtLocation3D& location,
double range);
535 void luaSendObjectMessage(
const DtScriptVrfObject& receiver,
const std::string& messageType,
const luabind::object& messageContents);
536 void luaSendRadioObjectMessage(
const DtScriptVrfObject& receiver,
const std::string& messageType,
const luabind::object& messageContents);
537 void luaRegisterForObjectMessage(
const std::string& messageType);
538 void luaUnregisterForObjectMessage(
const std::string& messageType);
546 const std::string& influenceName, luabind::object
const& influenceParams);
551 static void influenceEventCallback(std::shared_ptr<const makVrfEvents::DtInfluenceEvent> event,
void* usr);
552 virtual void queueInfluence(std::shared_ptr<const makVrfEvents::DtInfluenceEvent> e);
553 virtual void processInfluence(std::shared_ptr<const makVrfEvents::DtInfluenceEvent> e);
559 luabind::object luaGetCloudLayerDescriptionsAt(lua_State *L,
const DtLocation3D& location);
567 virtual double luaGetExpectedIllumination(
DtScriptVrfObject&
object,
double dateAndTimeOfDay);
568 virtual double luaGetSnowAccumulationByLocation(
const DtLocation3D&
object);
569 virtual double luaGetSnowRoadAccumulationByLocation(
const DtLocation3D&
object);
570 virtual double luaGetRainAccumulationByLocation(
const DtLocation3D&
object);
572 virtual double luaGetAirTemperatureByLocation(
const DtLocation3D&
object);
573 virtual double luaGetAirPressureByLocation(
const DtLocation3D&
object);
574 virtual unsigned int luaGetPrecipitationByLocation(
const DtLocation3D& location,
double*);
575 virtual double luaGetPrecipitationIntensityByLocation(
const DtLocation3D&
object);
576 virtual unsigned int luaGetPrecipitationTypeByLocation(
const DtLocation3D&
object);
577 virtual double luaGetVisibilityDistanceByLocation(
const DtLocation3D&
object);
578 virtual int luaGetVisibilityObscurantByLocation(
const DtLocation3D&
object);
579 virtual double luaGetWindDirectionByLocation(
const DtLocation3D&
object);
580 virtual double luaGetWindSpeedByLocation(
const DtLocation3D&
object);
581 virtual double luaGetUnderwaterVisibilityByLocation(
const DtLocation3D&
object);
582 virtual unsigned int luaGetSwellStateByLocation(
const DtLocation3D&
object);
583 virtual double luaGetSwellStateDirectionByLocation(
const DtLocation3D&
object);
584 virtual unsigned int luaGetSeaStateByLocation(
const DtLocation3D&
object);
585 virtual double luaGetSeaStateDirectionByLocation(
const DtLocation3D&
object);
586 virtual double luaGetSurgeDepthByLocation(
const DtLocation3D&
object);
587 virtual double luaGetIlluminationByLocation(
const DtLocation3D&
object);
588 virtual double luaGetExpectedIlluminationByLocation(
const DtLocation3D&
object,
double dateAndTimeOfDay);
593 virtual double luaRunUntilTime();
594 virtual void luaSetRunUntilTime(
double);
595 virtual void luaStopSimulationUntilTimer();
600 virtual void luaSetCheckpointMode(
bool);
601 virtual void initializeCheckpointStateTable(lua_State* L);
612 luabind::object
const& options,
int displayFlags);
614 luabind::object
const& options,
int displayFlags);
616 luabind::object
const& options,
int displayFlags);
617 virtual int luaAskUserQuestionSS(
const std::string& title,
const std::string& message,
618 luabind::object
const& options,
int displayFlags);
623 virtual int luaStatusOfUserQuestion(
int questionId);
626 virtual void luaCancelUserQuestion(
int questionId);
634 void luaCreateEntityParallel(luabind::object
const& parameters);
664 std::vector<DtLocation3D> luaMakeOffsetPoints(
665 luabind::object
const& fromPoints,
667 std::vector<DtLocation3D> luaMakeOffsetPointsWithRadius(luabind::object
const& fromPoints,
671 void luaCreateSelectionGroup(
const std::string& name, luabind::object
const& parameters);
676 void luaFinishTest(
const int status,
const std::string message);
679 bool luaUpdateTaskVisualization(
const std::string& visualizationName,
680 const std::string& visualizationType, luabind::object
const& parameters);
683 void luaDeleteTaskVisualization(
const std::string& visualizationName);
686 void luaRequire(lua_State* L,
const std::string&
filename);
690 unsigned luaBitwiseOr(
unsigned val1,
unsigned val2);
691 unsigned luaBitwiseAnd(
unsigned val1,
unsigned val2);
692 unsigned luaBitwiseXor(
unsigned val1,
unsigned val2);
693 unsigned luaBitwiseNot(
unsigned val);
694 unsigned luaBitwiseLeftShift(
unsigned val,
unsigned shift);
695 unsigned luaBitwiseRightShift(
unsigned val,
unsigned shift);
703 virtual bool luaIsDatabaseLoggingEnabled();
706 virtual void luaLogEventToDatabase(
unsigned eventType, luabind::object
const& parameters);
716 , myFunctionName(functionName)
727 return myFunctionName;
740 DtInfo <<
"DtLuaScriptFunctionReference::operator< attempt to compare with wrong type.\n";
752 const std::string& functionName);
756 const std::string& functionName);
769 virtual luabind::object luaGetParamPropertyFromType(
770 const std::string typeString, std::string
const& paramName);
772 virtual luabind::object luaGetApplicationSetting(
773 const std::string settingName);
776 virtual void putObjectsFromTableIntoGlobalTable(lua_State* state, luabind::object& table);
777 virtual void putObjectsFromGlobalTableIntoTable(lua_State* state, luabind::object& table);
780 virtual luabind::object luaGetSubordinateFunctionNames();
783 virtual luabind::object luaGetParameterSubordinateFunctionsFromType(
784 const std::string typeString);
786 virtual void connectForCallbacks();
789 std::shared_ptr<DtLuaAsyncJob> luaGetWeaponSystemsInfo(
DtScriptVrfObject&
object);
791 void clearExtensionBackingPointer(
void* usr);
797 virtual bool callLuaNoArgFunction(
const std::string& functionName,
bool* functionExists =
nullptr);
799 virtual void updateFuncCallCount();
810 LuaExtension() : creator(nullptr), onlyForEntity(nullptr), usr(nullptr) {};
833 bool myNeedsInvokeShutdown =
true;
834 bool myTaskFailedDuringInit =
false;
848 namespace luaScriptInterface
882 const std::string& formationName, luabind::object
const& options,
888 const std::string& formationName,
944 luabind::object
const& typeFilters,
bool observedOnly);
949 luabind::object
const& typeFilters,
bool observedOnly,
956 luabind::object
const& typeFilters,
bool observedOnly,
965 luabind::object
const& typeFilters,
966 luabind::object
const& flags);
970 luabind::object
const& options);
982 const std::string& propertyName, luabind::object
const& prop);
989 const std::string& propertyName, luabind::object
const& prop,
bool addIfNotFound);
1000 luabind::object
const& keyValues, luabind::object
const& itemValue);
1010 int index, luabind::object
const& itemValue);
1021 luabind::object
const& keyValue, luabind::object
const& itemValue);
1026 const std::string& context,
const std::string& propertyName, luabind::object
const& prop);
1032 const std::string& context,
const std::string& propertyName, luabind::object
const& prop,
bool addIfNotFound);
1041 const std::string& context,
const std::string& propertyName,
1042 luabind::object
const& keyValues, luabind::object
const& itemValue);
1050 const std::string& context,
const std::string& propertyName,
1051 int index, luabind::object
const& itemValue);
1060 const std::string& context,
const std::string& propertyName,
1061 luabind::object
const& keyValue, luabind::object
const& itemValue);
1084 luabind::object
const& keyValues,
int& index);
1087 luabind::object
const& keyValues,
int& index);
1114 luabind::object
const& keyValue);
1117 luabind::object
const& keyValue);
1124 const std::string& context,
const std::string& propertyName);
1135 const std::string& context,
const std::string& propertyName,
1136 luabind::object
const& keyValues,
int& index);
1146 const std::string& context,
const std::string& propertyName,
int index);
1156 const std::string& context,
const std::string& propertyName, luabind::object
const& keyValue);
1177 luabind::object
const& keyValues,
int& index);
1180 luabind::object
const& keyValues,
int& index);
1205 luabind::object
const& keyValue);
1208 luabind::object
const& keyValue);
1212 const luabind::object & value,
virtual void invokePostSetDataCallback(DtScriptFunctionReferencePtr functionReference, DtSetDataRequestMessage *setDatRequest)=0
Implement to invoke the function referenced by functionReference. setDatRequest contains the informat...
virtual void processEntityDestroyed()
Can be overridden to perform some processing when the entity is destroyed.
Definition: scriptInterface.h:211
General settings that apply to all modes.
Definition: iffMode5Settings.h:12
std::vector< DtVrfObjectMessage * > myTextReportCallbacks
Definition: luaScriptInterfaceImpl.h:830
virtual bool operator<(const DtScriptFunctionReference &other) const override
Required for std::set.
Definition: luaScriptInterfaceImpl.h:730
virtual void addPostSetDataCallback(const DtSetMessageType &setDataType, DtScriptFunctionReferencePtr functionReference)
Adds a callback to be invoked after the specified type of set data request is executed.
virtual bool invokeInit()=0
luabind::object luaGetParameterPropertyListItemByIndex(lua_State *L, const DtScriptVrfObject &entity, const std::string &propertyName, int index)
Returns an object containing the value of the of an item in the given parameter property. The property must be a list. Returns the item at the given index, using the Lua convention that the first item is at index 1. The result may be a table containing a number of fields that make up the item, or a single value, depending on the data type of the list items. If the property or list item could not be found, the returned table will be empty.
bool luaSetInternalStateProperty(lua_State *L, DtScriptOwnshipObject &entity, const std::string &context, const std::string &propertyName, luabind::object const &prop)
Sets the specified internal state property with the given value. If the property does not exist or th...
std::list< DtScriptVrfObject > luaGetContactsWithFilterAliveOnly(lua_State *L, const DtScriptOwnshipObject &entity, luabind::object const &typeFilters, bool observedOnly, bool aliveOnly)
Same as luaGetContactsWithFiler but adds a boolean flag to indicate that only non-destroyed entities ...
This class is a wrapper for a DtCompSystem for use by scripts. It derives from DtAsciiSerializable so...
Definition: scriptWeaponInfo.h:24
luabind::object luaGetParamProperty(lua_State *L, const DtScriptVrfObject &entity, std::string const ¶mName)
Returns an object containing the value of the requested parameter property. May be a table containing...
const char ContactObservedOnly[]
Definition: luaScriptInterfaceImpl.h:48
virtual bool taskFailedDuringInit() const override
Returns true if the script deliberately ended its own task with a failure status while init was runni...
Definition: luaScriptInterfaceImpl.h:78
void getMode1Data(lua_State *L, luabind::object &result, const DtIffMode1Settings *settings)
luabind::object luaGetSubordinateFunctions(lua_State *L, const DtScriptVrfObject &entity)
Return a table of {{"subordinate" = DtScriptVrfObject, "function" = string}}.
std::vector< DtScriptVrfObject > luaGetAllHostileContacts(lua_State *L, const DtScriptOwnshipObject &entity, luabind::object const &options)
static GlobalInterfaceExtensions theLuaInterfaceExtensions
Definition: luaScriptInterfaceImpl.h:821
std::vector< LuaExtension > GlobalInterfaceExtensions
Definition: luaScriptInterfaceImpl.h:819
lua_State * myLState
Definition: luaScriptInterfaceImpl.h:801
virtual bool invokeResume()=0
Definition: iffBasicModeSettings.h:84
luabind::object luaGetStateOwnshipPropertyListItemByIndex(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &propertyName, int index)
virtual bool loadState(const DtReaderWriter *savedState)=0
Called when the scenario is loaded. The load state pointer may not be valid, which does not indicate ...
bool luaSetSubordinateFunctions(lua_State *L, const DtScriptVrfObject &entity, luabind::object const &subsAndFunctions)
Given a table of {{"subordinate" = DtScriptVrfObject, "function" = string}} Set the state propert...
luabind::object luaGetStateOwnshipPropertyMapItem(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &propertyName, luabind::object const &keyValue)
unsigned myFuncCallCount
Definition: luaScriptInterfaceImpl.h:802
static ReaderWriterToLuaTableMap & theReaderWriterToLuaTableMap
Never-destroyed (leaky) singleton: avoids a cross-TU static-destruction-order double-free at exit...
Definition: luaScriptInterfaceImpl.h:827
luabind::object luaGetSubordinateFormation(lua_State *L, const DtScriptOwnshipObject &entity, DtScriptVrfObject &leadSubordinate)
Gets a table indexed by simObject (subordinates) of position offset relative to the formation leader...
virtual void invokeCheckInit()=0
Definition: luaNavJob.h:320
luabind::object luaGetParameterPropertyListItem(lua_State *L, const DtScriptVrfObject &entity, const std::string &propertyName, luabind::object const &keyValues, int &index)
Returns an object containing the value of the of an item in the given parameter property. The property must be a list. The item returned will have values matching the specified key values in the key fields. The result may be a table containing a number of fields that make up the item, or a single value, depending on the data type of the list items. If the property or list item could not be found, the returned table will be empty. Sets index to be the index of the item, using the Lua convention that the first item is at index 1.
Definition: readerWriter.h:85
void getMode2Data(lua_State *L, luabind::object &result, const DtIffMode2Settings *settings)
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:31
Default on in debug, off in release.
Definition: objectCounter.h:27
virtual void processEvents()=0
Process any enqueued events like text or influence.
luabind::object(* ReaderWriterToLuaTableFcn)(lua_State *LS, const DtReaderWriter *rwString, const DtSimulationServices *mgr, const DtString ¶meterType)
When adding decoder functions to turn reader/writer into lua tables, the format must be of the follow...
Definition: luaScriptInterfaceImpl.h:45
bool luaSetStatePropertyListItemByIndex(lua_State *L, DtScriptOwnshipObject &entity, const std::string &propertyName, int index, luabind::object const &itemValue)
Finds the item in the list at the specified index and updates it to the new value. If the list is not long enough, new entries are added. Any items added in this way will be given the same value as the new entry. If the property does not exist or the format of the data is incorrect, returns false. Will try to find the state property in both internal and external properties.
virtual void removePostSetDataCallback(const DtSetMessageType &setDataType, DtScriptFunctionReferencePtr functionReference)
Remove a callback invoked after the specified type of set data request is executed.
Definition: readerWriterRegistry.h:39
virtual DtReaderWriter * saveState()=0
Called when the scenario is saved. The stateState pointer may not be valid, in which case something w...
luabind::object luaGetStatePropertyListItemByIndex(lua_State *L, const DtScriptVrfObject &entity, const std::string &propertyName, int index)
Returns an object containing the value of the of an item in the given state property. The state property must be a list. Returns the item at the given index, using the Lua convention that the first item is at index 1. The result may be a table containing a number of fields that make up the item, or a single value, depending on the data type of the list items. Will try to find the state property in both internal and external properties. If the property or list item could not be found, the returned table will be empty.
luabind::object luaGetInternalStatePropertyMapItem(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &context, const std::string &propertyName, luabind::object const &keyValue)
Returns an object containing the value of the of an item in the given internal state property...
General settings that apply to all modes.
Definition: iffTCASDataSettings.h:12
bool luaSetInternalStatePropertyMapItem(lua_State *L, DtScriptOwnshipObject &entity, const std::string &context, const std::string &propertyName, luabind::object const &keyValue, luabind::object const &itemValue)
Sets a single item in na internal map state property to the given value. First looks in the map to se...
LocalInterfaceExtensions myInterfaceExtensions
Definition: luaScriptInterfaceImpl.h:806
virtual bool loadScript(bool reload=false)=0
This will be called by the parent to let the interface know when to load the script.
bool myLuaScriptWarningShown
Definition: luaScriptInterfaceImpl.h:803
Definition: iffBasicModeSettings.h:100
void getMode3CData(lua_State *L, luabind::object &result, const DtIffMode3CSettings *settings)
luabind::object luaGetParameterSubordinateFunctions(lua_State *L, const DtScriptVrfObject &entity)
Gets a table of entity type and subordinate function handle pairs {{ENTITY_TYPE_STRING, FUNCTION_HANDLE_STRING}}.
luabind::object luaGetWeaponInfo(lua_State *L, const DtScriptOwnshipObject &thisEntity, const std::string &weaponId)
std::list< DtScriptVrfObject > luaGetContactsWithFilter(lua_State *L, const DtScriptOwnshipObject &entity, luabind::object const &typeFilters, bool observedOnly)
This function supports the script API. It gets the list of contacts matching the given filter and ret...
bool luaSetOrAddInternalStateProperty(lua_State *L, DtScriptOwnshipObject &entity, const std::string &context, const std::string &propertyName, luabind::object const &prop, bool addIfNotFound)
Sets the specified internal state property with the given value. If not found and addIfNotFound is tr...
std::string functionName() const
Definition: luaScriptInterfaceImpl.h:725
DtLuaScriptFunctionReference(const std::string &functionName)
Definition: luaScriptInterfaceImpl.h:714
luabind::object luaGetStatePropertyMapItem(lua_State *L, const DtScriptVrfObject &entity, const std::string &propertyName, luabind::object const &keyValue)
Returns an object containing the value of the of an item in the given state property. The state property must be a map. The item returned will have values matching the specified key value. The result may be a table containing a number of fields that make up the item, or a single value, depending on the data type of the list items. Will try to find the state property in both internal and external properties. If the property or map item could not be found, the returned table will be empty.
std::shared_ptr< DtScriptFunctionReference > DtScriptFunctionReferencePtr
Shared ptr to DtScriptFunctionReference.
Definition: scriptInterface.h:54
VectorOffset3D is a direction vector that is relative to some direction specified by a Vector3D...
Definition: scriptGeometry.h:428
Handles translation of messages from C++ structures into Lua tables and the reverse translation as we...
Definition: luaMessageInterface.h:23
void getMode5Data(lua_State *L, luabind::object &result, const DtIffMode5Settings *settings)
luabind::object luaGetOwnshipParamProperty(lua_State *L, const DtScriptOwnshipObject &entity, std::string const ¶mName)
std::string luaGetSubordinateFunction(lua_State *L, const DtScriptVrfObject &entity, const DtScriptVrfObject &subEntity)
Return a string representing subordinate function for indicated subordinate.
LuaExtension(const LuaExtension &orig)
Definition: luaScriptInterfaceImpl.h:811
bool luaSetStatePropertyMapItem(lua_State *L, DtScriptOwnshipObject &entity, const std::string &propertyName, luabind::object const &keyValue, luabind::object const &itemValue)
Sets a single item in a map state property to the given value. First looks in the map to see if any e...
void getModeSData(lua_State *L, luabind::object &result, const DtIffModeSSettings *settings)
luabind::object luaGetIffSystem(lua_State *L, const DtScriptVrfObject &entity)
Returns a table of Iff Settings Data for the specified entity.
virtual DtString type() const =0
Script engine type.
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points. Coordinates are in local database coordinates The coordinat...
Represents a feature geometry.
Definition: luaFeatureGeometry.h:25
luabind::object luaGetStateOwnshipPropertyListItem(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &propertyName, luabind::object const &keyValues, int &index)
static const std::map< DtString, rwToLuaBindObjectFcn > & rwToLuaBindObjectMap()
const DtLocalObject * onlyForEntity
Definition: luaScriptInterfaceImpl.h:815
Definition: luaScriptInterfaceImpl.h:56
luabind::object luaGetOwnshipParameterPropertyListItem(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &propertyName, luabind::object const &keyValues, int &index)
bool luaGetIffModeIsOn(lua_State *L, const DtScriptVrfObject &entity, const DtModeType mode)
Returns a bool representing if the specified IFF mode is on or off.
bool luaSetInternalStatePropertyListItemByIndex(lua_State *L, DtScriptOwnshipObject &entity, const std::string &context, const std::string &propertyName, int index, luabind::object const &itemValue)
Finds the item in the internal state property list at the specified index and updates it to the new v...
bool luaSetStateProperty(lua_State *L, DtScriptOwnshipObject &entity, const std::string &propertyName, luabind::object const &prop)
Sets the specified state property with the given value. If the property does not exist or the format ...
luabind::object luaGetSystemAttribute(const DtScriptComponentSystem &system, const std::string &attributeName, bool *error, lua_State *L)
virtual ~DtLuaScriptFunctionReference() override
Definition: luaScriptInterfaceImpl.h:721
luabind::object luaGetInternalStateProperty(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &context, const std::string &propertyName)
Returns an object containing the value of the requested internal state property. May be a table conta...
luabind::object(* rwToLuaBindObjectFcn)(const DtReaderWriter *rw, lua_State *L)
Definition: luaScriptInterfaceImpl.h:850
virtual void invokeDisable()=0
Only called for reactive tasks which can be enabled but not active. When the task is completely disab...
virtual void invokeTick()=0
This will be called by the parent to invoke the script tick.
luabind::object luaGetInternalStatePropertyListItemByIndex(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &context, const std::string &propertyName, int index)
Returns an object containing the value of the of an item in the given internal state property...
std::list< DtVectorOffset3D > luaGetFormationPositions(lua_State *L, const DtScriptVrfObject &unit, const std::string &formationName, int *leaderIndex)
Calls luaGetOptionFormationPositions with empty options.
#define DT_DLL_vrfLua
This file is used to determine how to build.
Definition: vrfLuaDefines.h:25
bool luaSetStatePropertyListItem(lua_State *L, DtScriptOwnshipObject &entity, const std::string &propertyName, luabind::object const &keyValues, luabind::object const &itemValue)
Sets a single item in a list state property to the given value. First looks in the list to see if any...
const char ContactAliveOnly[]
Definition: luaScriptInterfaceImpl.h:49
luabind::object luaGetStatePropertyListItem(lua_State *L, const DtScriptVrfObject &entity, const std::string &propertyName, luabind::object const &keyValues, int &index)
Returns an object containing the value of the of an item in the given state property. The state property must be a list. The item returned will have values matching the specified key values in the key fields. The result may be a table containing a number of fields that make up the item, or a single value, depending on the data type of the list items. Will try to find the state property in both internal and external properties. If the property or list item could not be found, the returned table will be empty. Sets index to be the index of the item, using the Lua convention that the first item is at index 1.
This stream is used by the scripting classes to be able to send out translatable messages from script...
Definition: translatableStream.h:22
luabind::object luaGetContactInfo(lua_State *L, const DtScriptOwnshipObject &thisEntity, const DtScriptVrfObject &otherEntity)
Gets the perceived contact info that this entity has for another entity.
The base class for all messages to/from a specific DtVrfObject. Various subclasses of this class will...
Definition: vrfObjectMessage.h:30
Override of DtScriptInterface::DtScriptFunctionReference that holds a function reference by function ...
Definition: luaScriptInterfaceImpl.h:711
std::vector< DtLuaScriptInterfaceExtension * > LocalInterfaceExtensions
Definition: luaScriptInterfaceImpl.h:805
Abstract object used to hold a reference to a function defined in the script language, to be used later to invoke that function. Used for registering callbacks to be invoked after specified types of set data requests are executed. For this functionality to be used in a derived script interface implementation, a derived class must be implemented to represent a reference to a function in the script language.
Definition: scriptInterface.h:43
Definition: iffMode3CSettings.h:10
luabind::object luaGetEntityParam(lua_State *L, const DtScriptVrfObject &entity, std::string const ¶mName)
luabind::object luaGetStateProperty(lua_State *L, const DtScriptVrfObject &entity, const std::string &propertyName)
Returns an object containing the value of the requested state property. May be a table containing a n...
virtual void processClearForReuse()
This function should be overridden by the inheritor to clear out any task specific variables...
Definition: asyncJobServer.h:39
bool luaSetSubordinateFunction(lua_State *L, const DtScriptVrfObject &entity, const DtScriptVrfObject &subEntity, const std::string &subFunction)
Given a table of {{"subordinate" = DtScriptVrfObject, "function" = string}} Set the state propert...
General settings that apply to all modes.
Definition: iffModeSSettings.h:13
std::vector< std::shared_ptr< const makVrfEvents::DtInfluenceEvent > > myInfluenceEvents
Definition: luaScriptInterfaceImpl.h:831
bool luaSetInternalStatePropertyListItem(lua_State *L, DtScriptOwnshipObject &entity, const std::string &context, const std::string &propertyName, luabind::object const &keyValues, luabind::object const &itemValue)
Sets a single item in an internal list state property to the given value. First looks in the list to ...
Contains the DtTranslatableStream class declaration.
const char ContactCurrentlyDetectedOnly[]
Definition: luaScriptInterfaceImpl.h:51
DtLuaScriptInterfaceExtension *(* CreatorFcn)(void *usr)
Prototype for DtLuaScriptInterfaceExtension creator function.
Definition: luaScriptInterfaceExtension.h:37
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:97
luabind::object luaGetOwnshipParameterPropertyMapItem(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &propertyName, luabind::object const &keyValue)
DtScriptInterface & operator=(const DtScriptInterface &other)
virtual bool invokeCheck()=0
The DtLuaFeatureSet class is a wrapper around a DtFeatureSet that will provide feature information fo...
Definition: luaFeatureSet.h:27
luabind::object luaGetAisData(lua_State *L, const DtScriptVrfObject &entity)
Returns a table of AIS data for the specified entity.
LuaExtension()
Definition: luaScriptInterfaceImpl.h:810
std::map< DtString, ReaderWriterToLuaTableFcn > ReaderWriterToLuaTableMap
Definition: luaScriptInterfaceImpl.h:825
DtLuaScriptInterfaceExtension.
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
const char int mode
Definition: ioapi.h:38
luabind::object myCheckpointStateTable
Definition: luaScriptInterfaceImpl.h:823
bool luaSetSystemAttribute(DtScriptComponentSystem &system, const std::string &attributeName, const luabind::object &value, lua_State *L)
Contains Extended DI-Guy Object net types.
luabind::object luaGetTargetPriorityList(lua_State *L, const DtScriptOwnshipObject &thisEntity)
Gets the target priority list that this entity has.
luabind::object luaGetInternalStatePropertyListItem(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &context, const std::string &propertyName, luabind::object const &keyValues, int &index)
Returns an object containing the value of the of an item in the given internal state property...
void getMode3AData(lua_State *L, luabind::object &result, const DtIffMode3ASettings *settings)
void * usr
Definition: luaScriptInterfaceImpl.h:816
const char ContactHostileOnly[]
Definition: luaScriptInterfaceImpl.h:50
Definition: luaScriptInterfaceImpl.h:808
The "this" version is the own-ship object. It is separated to allow special functions for the ownshi...
Definition: scriptVrfObject.h:418
DtLuaMessageInterface * myMessageInterface
Definition: luaScriptInterfaceImpl.h:828
std::list< DtVectorOffset3D > luaGetOptionFormationPositions(lua_State *L, const DtScriptVrfObject &unit, const std::string &formationName, luabind::object const &options, int *leaderIndex)
Gets a list of offset vectors defining the positions in the formation. Returns the index of the leade...
luabind::object luaGetWeaponInfoList(lua_State *L, const DtScriptOwnshipObject &thisEntity)
Lua "getWeaponInfo()" Returns a list of the weapon info for weapons on this entity.
This class is a wrapper for a DtCompSystem for use by scripts. It derives from DtAsciiSerializable so...
Definition: scriptComponentSystem.h:18
This class is a two-way interface between the script language and its parent controller. There are functions that either the parent controller will call on the script interface (such as tick() ) and there will be functions the script interface will call on the parent controller to inform the parent of status updates and for data access.
Definition: scriptInterface.h:32
std::string myFunctionName
Definition: luaScriptInterfaceImpl.h:746
luabind::object luaGetOwnshipParameterPropertyListItemByIndex(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &propertyName, int index)
virtual void invokeSuspend()=0
voidpf uLong offset
Definition: ioapi.h:42
A DtSetDataRequestMessage is a DtRadioMsg with a pointer to a setDataRequest. The type of the DtSetDa...
Definition: setDataRequestMessage.h:28
void getTCASData(lua_State *L, luabind::object &result, const DtIffTCASDataSettings *settings)
luabind::object luaGetStateOwnshipProperty(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &propertyName)
bool luaSetOrAddStateProperty(lua_State *L, DtScriptOwnshipObject &entity, const std::string &propertyName, luabind::object const &prop, bool addIfNotFound)
Sets the specified state property with the given value. If not found and addIfNotFound is true...
std::list< DtScriptVrfObject > luaGetContacts(lua_State *L, const DtScriptOwnshipObject &entity, luabind::object const &typeFilters, luabind::object const &flags)
Lua "getContacts()" Return a list of contacts matching the given table of entity type filters...
luabind::object luaGetParameterPropertyMapItem(lua_State *L, const DtScriptVrfObject &entity, const std::string &propertyName, luabind::object const &keyValue)
Returns an object containing the value of the of an item in the given parameter property. The property must be a map. The item returned will have values matching the specified key value. The result may be a table containing a number of fields that make up the item, or a single value, depending on the data type of the list items. If the property or map item could not be found, the returned table will be empty.
std::list< DtScriptVrfObject > luaGetHostileContactsWithFilterAliveOnly(lua_State *L, const DtScriptOwnshipObject &entity, luabind::object const &typeFilters, bool observedOnly, bool aliveOnly)
This function is the same as luaGetContactsWithFilterAliveOnly, but it returns only hostile contacts...
Definition: iffBasicModeSettings.h:66
virtual void invokeShutdown()=0
virtual void invokeUpdateDisplayGraph()=0
Called when graphs are enabled to get an immediate graph output.
A locally simulated VRF object.
Definition: localObject.h:98
Definition: scriptVrfObject.h:30
luabind::object luaGetIffModeData(lua_State *L, const DtScriptVrfObject &entity, const DtModeType mode)
Returns a table with the Iff Mode specific data of the specified entity using the given IFF mode...
A location3D is a point in space, i.e. a geocentric coordinate.
Definition: scriptGeometry.h:22