VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
luaScriptInterfaceImpl.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 #pragma once
6 
7 #include <vrfLua/vrfLuaDefines.h>
8 #include <vrfLua/luaFeatureSet.h>
9 #include <vrfLua/luaPathJob.h>
10 
13 #include "vrfutil/scriptGeometry.h"
15 #include <luabind/luabind.hpp>
18 #include <vrfutil/objectCounter.h>
19 
20 #include <lua.hpp>
21 #include <lauxlib.h>
22 #include <lualib.h>
23 
24 #include <boost/signals2.hpp>
25 
26 namespace makVrfEvents
27 {
28  class DtEvent;
29  class DtInfluenceEvent;
30 }
31 
33 class DtScriptWeaponInfo;
34 
39 typedef luabind::object (*ReaderWriterToLuaTableFcn)(lua_State* LS, const DtReaderWriter* rwString,
40  const DtSimulationServices* mgr, const DtString& parameterType);
41 
42 const char ContactObservedOnly[] = "observedOnly";
43 const char ContactAliveOnly[] = "aliveOnly";
44 const char ContactHostileOnly[] = "hostileOnly";
45 const char ContactCurrentlyDetectedOnly[] = "currentlyDetectedOnly";
46 
51  : public DtScriptInterface
52 #ifdef DtObjectDebugger_Enable
53  , public DtObjectDebugger<DtLuaScriptInterfaceImpl>
54 #endif
55 {
56 protected:
58 
61 
62 public:
63  virtual ~DtLuaScriptInterfaceImpl();
64 
65  static DtScriptInterface* creator(DtSimulationServices*);
66 
67  virtual void init() override;
68 
69  virtual DtString type() const override;
70 
71  virtual bool invokeInit() override;
72  virtual void invokeSuspend() override;
73  virtual bool invokeResume() override;
74  virtual void invokeTick() override;
75  virtual bool invokeCheck() override;
76  virtual void invokeCheckInit() override;
77  virtual void invokeShutdown() override;
78  virtual void invokeUpdateDisplayGraph() override;
79 
82  virtual void invokeDisable() override;
83 
84  virtual bool loadScript(bool reload) override;
85 
86  virtual void setLuaState(lua_State* L);
87  virtual lua_State* getLuaState();
88 
89  virtual std::string dumpLuaStack() const;
90  virtual int luaStackSize() const;
91  virtual void collectGarbage();
92 
93  virtual DtReaderWriter* saveState() override;
94  virtual bool loadState(const DtReaderWriter* loadState) override;
95  virtual void processClearForReuse() override;
96 
101  static void addLuaScriptInterfaceExtension(DtLuaScriptInterfaceExtension::CreatorFcn extension, void* usr);
102 
107  static void addLuaScriptInterfaceExtension(DtLuaScriptInterfaceExtension::CreatorFcn extension,
108  const DtLocalObject* onlyForEntity, void* usr);
109 
111  static void removeLuaScriptInterfaceExtension(DtLuaScriptInterfaceExtension::CreatorFcn extension, void* usr);
112 
115  static void removeLuaScriptInterfaceExtension(DtLuaScriptInterfaceExtension::CreatorFcn extension,
116  const DtLocalObject* onlyForEntity, void* usr);
117 
118  virtual bool initializeVRFLuaExtensions(lua_State* L);
119  virtual bool importTaskParams(lua_State* L);
120 
122  virtual bool importSetParams(lua_State* L);
123 
125  virtual luabind::object createLuaTableFromRegistry(lua_State* L, const DtReaderWriterRegistry& rwRegistry, bool requireMetadata = true, bool hasParamMetaData = true);
128  static luabind::object createLuaTableFromRwRegistry(lua_State* L, const DtReaderWriterRegistry& rwRegistry, DtSimulationServices* simServices);
129 
131  static void addKeyToIgnore(const std::string&);
132 
134  static void removeKeyToIgnore(const std::string&);
135 
137  void luaEndTask(bool success);
138  void luaEndSet();
139 
141 
143 
144  virtual void luaPlayScenarioEvent(DtScriptVrfObject eventName);
145  virtual void luaStopScenarioEvent(DtScriptVrfObject eventName);
146  virtual void luaStopScenarioEventWithRewind(DtScriptVrfObject eventName, bool rewind);
147  virtual bool luaIsScenarioEventPlaying(DtScriptVrfObject eventName);
148  virtual void luaSetScenarioEventEnabled(DtScriptVrfObject eventName, bool);
149  virtual bool luaIsScenarioEventEnabled(DtScriptVrfObject eventName);
151 
153 
154  virtual int luaSendEmbeddedEntityTask(std::string eeName, std::string taskName, luabind::object const& parms);
156  virtual int luaSendEmbeddedEntityTaskActAsSubtask(std::string eeName, std::string taskName,
157  luabind::object const& parms, bool actAsSubtask);
159  virtual int luaSendEmbeddedEntitySet(std::string eeName, std::string setName, luabind::object const& parms);
161 
163 
164  int luaStartSubtask(const std::string taskName, luabind::object const& parameters);
166  void luaStopSubtask(int subtaskId);
168  void luaStopAllSubtasks();
170  bool luaIsSubtaskRunning(int subtaskId);
172  bool luaIsSubtaskComplete(int subtaskId);
174  bool luaIsSubtaskCanceled(int subtaskId);
176  bool luaSubtaskResult(int subtaskId);
180  void luaCleanupInactiveSubtaskStatus();
182 
184  void luaSendReportWithoutRecipients(const::std::string reportType,
185  luabind::object const& parameters);
186  void luaSendReport(const::std::string reportType,
187  luabind::object const& reciptients,
188  luabind::object const& parameters);
189 
191  int luaSendTask(DtScriptVrfObject& object, const::std::string taskName,
192  luabind::object const& parameters);
193  int luaSendTaskNotAsSubtask(DtScriptVrfObject& object, const::std::string taskName,
194  luabind::object const& parameters);
195  int luaSendTaskActAsSubtask(DtScriptVrfObject& object, const::std::string taskName,
196  luabind::object const& parameters, bool actAsSubtask);
197  int luaSendRadioTask(DtScriptVrfObject& object, const::std::string taskName,
198  luabind::object const& parameters);
199  int luaSendRadioTaskActAsSubtask(DtScriptVrfObject& object, const::std::string taskName,
200  luabind::object const& parameters, bool actAsSubtask);
201  int luaSendTaskActAsSubtaskWithRadio(DtScriptVrfObject& object, const::std::string taskName,
202  luabind::object const& parameters, bool actAsSubtask, bool sendWithRadio);
203 
205  void luaStopAllTasks();
206 
208  void luaSendSetDataToSelf(const::std::string setName,
209  luabind::object const& parameters);
210 
212  void luaSendSetData(DtScriptVrfObject& object, const::std::string setName,
213  luabind::object const& parameters);
214  void luaSendRadioSetData(DtScriptVrfObject& object, const::std::string setName,
215  luabind::object const& parameters);
216  void sendSetDataWithRadio(DtScriptVrfObject& object, const::std::string setName,
217  luabind::object const& parameters, bool useRadio);
218 
219  bool luaIsTaskAvailable(const::std::string taskName);
220  bool luaIsSetAvailable(const::std::string setName);
221 
223  luabind::object luaGetReactionStatus();
224 
233  luabind::object luaGetOrbatList();
234 
236  std::string luaGetScriptId();
237 
239  std::string luaGetSystemName();
240 
241  luabind::object luaGetObjectsNear(const DtLocation3D& loc, double distance);
242  luabind::object luaGetObjectsNearWithFilter(const DtLocation3D& loc, double distance, luabind::object const& parameters);
243 
244  luabind::object luaGetScriptAttribute(const std::string& attributeName, bool& error);
245 
247  luabind::object luaGetVrfObjects();
248 
250 
251  luabind::object luaGetDesignatorsNearWithFilter(const DtLocation3D& loc, double distance,
252  const luabind::object& params);
253 
254  luabind::object luaGetDesignatorsNear(const DtLocation3D& loc, double distance);
256 
258 
259  DtLuaFeatureSet luaGetFeaturesWithinArea(luabind::object const& points, luabind::object const& attributes);
262  DtLuaFeatureSet luaGetFeaturesWithinAreaNoAttributes(luabind::object const& points);
263 
266  DtLuaFeatureSet luaGetFeaturesWithinRange(const DtLocation3D&, double range, luabind::object const& attributes);
268  DtLuaFeatureSet luaGetFeaturesWithinRangeNoAttributes(const DtLocation3D&, double range);
269 
271  DtLuaFeatureSet luaGetFeaturesType(const std::string& type);
273  DtLuaFeatureSet luaGetFeatures();
275 
277 
278  DtLuaFeatureGeometry luaMakePointGeometry(const DtLocation3D&);
281  DtLuaFeatureGeometry luaMakePathGeometry(luabind::object const& table);
283  DtLuaFeatureGeometry luaMakeAreaGeometry(luabind::object const& table);
285 
287  boost::shared_ptr<DtLuaAsyncJob> generateRandomPoints(const luabind::object& parameters);
288 
290  boost::shared_ptr<DtLuaAsyncJob> findNearbyPointOfInterest(const int type);
291 
293  boost::shared_ptr<DtLuaAsyncJob> findCoverPoint(
294  const DtLocation3D& startLocation, const DtLocation3D& threatLocation,
295  double threatRadius, double distanceFromThreat, double range, unsigned numberOfPoints);
296 
298  luabind::object findLadders(lua_State* L, const DtLocation3D& startLocation, double range);
300  luabind::object findLaddersWithId(lua_State* L, const DtLocation3D& startLocation,
301  double range, const unsigned int id);
302 
304  boost::shared_ptr<DtLuaAsyncJob> findPathToLocation(
305  const DtLocation3D& startLocation, const DtLocation3D& destinationLocation,
306  bool useAbstractGraphs, const DtLocation3D& avoidLocation, double avoidanceRadius);
307 
309  DtTranslatableStream translateStringFromScript(const std::string& format);
310 
313  boost::shared_ptr<DtLuaAsyncJob> luaNavigateThroughFeatures(const luabind::object& parameters);
314 
317  virtual boost::shared_ptr<DtLuaAsyncJob> luaFindHighPoints(const luabind::object& corners, unsigned int nPoints);
318  virtual boost::shared_ptr<DtLuaAsyncJob> luaFindHighPointsDebug(const luabind::object& corners, unsigned int nPoints, bool bDebug);
320 
322  /*
323  job = vrf:luaFindSinglePosition(taskParameters.targetArea:getLocations3D(),
324  taskParameters.battlePosition,
325  targetHeightMeters, -- 2/3 vehicle height, for example.
326  double viewHeightMeters, -- 2/3 vehicle height, for example.
327  double hideHeightMeters, -- 1.1x vehicle height, for example.
328  double forwardBackSearchLimitMeters, -- 50m forward + 50m backward = 100m
329  double forwardBackSearchIntervalMeters, -- half vehicle length, for example.
330  double maxSlopeDegrees, -- *todo add comments*
331  )
332  )
333 
334  */
335  virtual boost::shared_ptr<DtLuaAsyncJob> luaFindSinglePosition(
336  const luabind::object& targetAreaCorners,
337  const DtLocation3D& pivotPoint,
338  double targetHeightMeters,
339  double viewHeightMeters,
340  double hideHeightMeters,
341  double forwardBackSearchLimitMeters,
342  double forwardBackSearchIntervalMeters,
343  double maxSlopeDegrees);
344 
346  /*
347  job = vrf:luaFindSinglePosition(taskParameters.targetArea:getLocations3D(),
348  taskParameters.battlePosition,
349  targetHeightMeters, -- 2/3 vehicle height, for example.
350  double viewHeightMeters, -- 2/3 vehicle height, for example.
351  double hideHeightMeters, -- 1.1x vehicle height, for example.
352  double forwardBackSearchLimitMeters, -- 50m forward + 50m backward = 100m
353  double forwardBackSearchIntervalMeters, -- half vehicle length, for example.
354  double maxSlopeDegrees, -- *todo add comments*
355  bool bDebug -- Log additional information)
356  )
357  */
358  virtual boost::shared_ptr<DtLuaAsyncJob> luaFindSinglePositionDebug(
359  const luabind::object& targetAreaCorners,
360  const DtLocation3D& pivotPoint,
361  double targetHeightMeters,
362  double viewHeightMeters,
363  double hideHeightMeters,
364  double forwardBackSearchLimitMeters,
365  double forwardBackSearchIntervalMeters,
366  double maxSlopeDegrees,
367  bool bDebug);
368 
369 
371  /*
372  job = vrf:findVehicleFightingPositions(taskParameters.numberOfPoints,
373  taskParameters.targetArea:getLocations3D(),
374  taskParameters.battlePosition,
375  maxVolume, -- half dimensions of hide position
376  maxVolume:getUp() * 0.67, --67% of total height for shooting height
377  maxVolume:getUp() * 0.50, -- half height for target height
378  searchWidthForward, -- how much forward and back to search forward and back
379  searchWidthSide -- how much side to side to search
380  positionSpacing -- how many meters between positions, side to side
381  )
382  */
383  virtual boost::shared_ptr<DtLuaAsyncJob> luaFindVehicleFightingPositions(
384  unsigned int nPositionPairs,
385  const luabind::object& targetAreaCorners,
386  const DtLocation3D& originPoint,
387  const DtVectorOffset3D& hideVolume,
388  double shootHeight,
389  double targetHeight,
390  double forwardBackSearchLimit,
391  double sideSideSearchLimit,
392  double maxSlopeDegrees,
393  double positionSpacing);
394 
396  virtual boost::shared_ptr<DtLuaAsyncJob> luaFindVehicleFightingPositionsDebug(
397  unsigned int nPositionPairs,
398  const luabind::object& targetAreaCorners,
399  const DtLocation3D& originPoint,
400  const DtVectorOffset3D& hideVolume,
401  double shootHeight,
402  double targetHeight,
403  double forwardBackSearchLimit,
404  double sideSideSearchLimit,
405  double maxSlopeDegrees,
406  double positionSpacing,
407  bool useDebug);
408 
409  virtual boost::shared_ptr<DtLuaAsyncJob> luaFindPositionGroupsInAreaHilltop(
410  unsigned int nPositionPairsPerGroup,
411  const luabind::object& searchAreaVertices,
412  const luabind::object& targetsAreaVertices,
413  double viewHeightMeters,
414  double coverHeightMeters,
415  unsigned int forwardBackRangeMeters,
416  unsigned int sideSideRangeMeters,
417  unsigned int searchIntervalMeters,
418  double maxSlopeDegrees,
419  unsigned int positionsLateralSpacingMeters);
420 
421  virtual boost::shared_ptr<DtLuaAsyncJob> luaFindPositionGroupsInAreaHilltopDebug(
422  unsigned int nPositionPairsPerGroup,
423  const luabind::object& searchAreaVertices,
424  const luabind::object& targetsAreaVertices,
425  double viewHeightMeters,
426  double coverHeightMeters,
427  unsigned int forwardBackRangeMeters,
428  unsigned int sideSideRangeMeters,
429  unsigned int searchIntervalMeters,
430  double maxSlopeDegrees,
431  unsigned int positionsLateralSpacingMeters,
432  bool useDebug);
433 
434  virtual boost::shared_ptr<DtLuaAsyncJob> luaFindPositionGroupsInAreaRidge(
435  unsigned int nPositionPairsPerGroup,
436  const luabind::object& searchAreaVertices,
437  const luabind::object& targetsAreaVertices,
438  unsigned int targetsAreaSampleRate,
439  const luabind::object& tableOfDoubles
440  );
441 
442  virtual boost::shared_ptr<DtLuaAsyncJob> luaFindPositionGroupsInAreaRidgeDebug(
443  unsigned int nPositionPairsPerGroup,
444  const luabind::object& searchAreaVertices,
445  const luabind::object& targetsAreaVertices,
446  unsigned int targetsAreaSampleRate,
447  const luabind::object& tableOfDoubles
448  , bool useDebug);
449 
452  boost::shared_ptr<DtLuaAsyncJob> getAllEmbarkationSlots(DtScriptVrfObject& object);
453 
456  boost::shared_ptr<DtLuaAsyncJob> getEmbarkationSlots(DtScriptVrfObject& object);
457 
459  boost::shared_ptr<DtLuaAsyncJob> getEmbarkationSlotsFiltered(DtScriptVrfObject& object,
460  bool bAllSlots);
461 
463  boost::shared_ptr<DtLuaAsyncJob> reserveEmbarkationSlot(DtScriptVrfObject& object, int slotNumber);
464 
466  boost::shared_ptr<DtLuaAsyncJob> getEmbarkationEgressPoints(DtScriptVrfObject& object);
467 
468  void luaSendMessage(const DtScriptVrfObject& receiver, const std::string& message);
469  void luaSendRadioMessage(const DtScriptVrfObject& receiver, const std::string& message);
470  void luaSendRadioMessageToUuid(const std::string& uuid, const std::string& message);
471  void luaDeleteObject(std::string const& receiver);
472  void luaDeleteScriptObject(const DtScriptVrfObject& receiver);
473  void luaSetInterest(const DtLocation3D& location, double range);
474 
475  void luaSendObjectMessage(const DtScriptVrfObject& receiver, const std::string& messageType, const luabind::object& messageContents);
476  void luaSendRadioObjectMessage(const DtScriptVrfObject& receiver, const std::string& messageType, const luabind::object& messageContents);
477  void luaRegisterForObjectMessage(const std::string& messageType);
478  void luaUnregisterForObjectMessage(const std::string& messageType);
479  void processObjectMessage(const DtVrfObjectMessage* msg);
480 
481  static void textReportCallback(const DtVrfObjectMessage* m, void* usr);
482  virtual void queueTextReport(const DtVrfObjectMessage* m);
483  virtual void processTextReport(const DtVrfObjectMessage* m);
484 
485  void luaSendInfluence(const DtScriptVrfObject& target,
486  const std::string& influenceName, luabind::object const& influenceParams);
487 
489  static void addReaderWriterToLuaTableFunction(const DtString&, ReaderWriterToLuaTableFcn);
490 
491  static void influenceEventCallback(DtBoost::shared_ptr<const makVrfEvents::DtInfluenceEvent> event, void* usr);
492  virtual void queueInfluence(DtBoost::shared_ptr<const makVrfEvents::DtInfluenceEvent> e);
493  virtual void processInfluence(DtBoost::shared_ptr<const makVrfEvents::DtInfluenceEvent> e);
494 
496  virtual void processEntityDestroyed() override;
497 
499  luabind::object luaGetCloudLayerDescriptionsAt(lua_State *L, const DtLocation3D& location);
502 
505 
506  virtual double luaGetIllumination(DtScriptVrfObject& object);
507  virtual double luaGetExpectedIllumination(DtScriptVrfObject& object, double dateAndTimeOfDay);
508  virtual double luaGetSnowAccumulationByLocation(const DtLocation3D& object);
509  virtual double luaGetSnowRoadAccumulationByLocation(const DtLocation3D& object);
510  virtual double luaGetRainAccumulationByLocation(const DtLocation3D& object);
511 
512  virtual double luaGetAirTemperatureByLocation(const DtLocation3D& object);
513  virtual double luaGetAirPressureByLocation(const DtLocation3D& object);
514  virtual unsigned int luaGetPrecipitationByLocation(const DtLocation3D& location, double*);
515  virtual double luaGetPrecipitationIntensityByLocation(const DtLocation3D& object);
516  virtual unsigned int luaGetPrecipitationTypeByLocation(const DtLocation3D& object);
517  virtual double luaGetVisibilityDistanceByLocation(const DtLocation3D& object);
518  virtual int luaGetVisibilityObscurantByLocation(const DtLocation3D& object);
519  virtual double luaGetWindDirectionByLocation(const DtLocation3D& object);
520  virtual double luaGetWindSpeedByLocation(const DtLocation3D& object);
521  virtual double luaGetUnderwaterVisibilityByLocation(const DtLocation3D& object);
522  virtual unsigned int luaGetSwellStateByLocation(const DtLocation3D& object);
523  virtual double luaGetSwellStateDirectionByLocation(const DtLocation3D& object);
524  virtual unsigned int luaGetSeaStateByLocation(const DtLocation3D& object);
525  virtual double luaGetSeaStateDirectionByLocation(const DtLocation3D& object);
526  virtual double luaGetSurgeDepthByLocation(const DtLocation3D& object);
527  virtual double luaGetIlluminationByLocation(const DtLocation3D& object);
528  virtual double luaGetExpectedIlluminationByLocation(const DtLocation3D& object, double dateAndTimeOfDay);
530 
533  virtual double luaRunDurationTime();
534  virtual void luaRunForDuration(double);
535  virtual void luaStopSimulationDurationTimer();
537 
540  virtual void luaSetCheckpointMode(bool);
541  virtual void initializeCheckpointStateTable(lua_State* L);
542 
551  virtual int luaAskUserQuestion(const DtTranslatableStream& title, const DtTranslatableStream& message,
552  luabind::object const& options, int displayFlags);
553  virtual int luaAskUserQuestionST(const std::string& title, const DtTranslatableStream& message,
554  luabind::object const& options, int displayFlags);
555  virtual int luaAskUserQuestionTS(const DtTranslatableStream& title, const std::string& message,
556  luabind::object const& options, int displayFlags);
557  virtual int luaAskUserQuestionSS(const std::string& title, const std::string& message,
558  luabind::object const& options, int displayFlags);
559 
563  virtual int luaStatusOfUserQuestion(int questionId);
564 
566  virtual void luaCancelUserQuestion(int questionId);
567 
571 
573  DtScriptVrfObject luaCreateEntity(luabind::object const& parameters);
574  void luaCreateEntityParallel(luabind::object const& parameters);
575 
577  DtScriptVrfObject luaCreateFromOrbat(std::string orbatItem, const DtLocation3D& loc);
578 
580  DtScriptVrfObject luaCreateTacticalGraphic(luabind::object const& parameters);
581 
583  DtScriptVrfObject luaCreateObstacle(luabind::object const& parameters);
584 
586  DtScriptVrfObject luaCreateRoute(luabind::object const& parameters);
587 
589  DtScriptVrfObject luaCreateArea(luabind::object const& parameters);
590 
592  DtScriptVrfObject luaCreateWaypoint(luabind::object const& parameters);
593 
595  DtScriptVrfObject luaCreatePhaseLine(luabind::object const& parameters);
597 
604  std::vector<DtLocation3D> luaMakeOffsetPoints(
605  luabind::object const& fromPoints,
606  const DtVectorOffset3D& offset);
607  std::vector<DtLocation3D> luaMakeOffsetPointsWithRadius(luabind::object const& fromPoints,
608  const DtVectorOffset3D& offset, const double minimumTurnRadius);
609 
611  void luaCreateSelectionGroup(const std::string& name, luabind::object const& parameters);
612 
616  void luaFinishTest(const int status, const std::string message);
617 
619  bool luaUpdateTaskVisualization(const std::string& visualizationName,
620  const std::string& visualizationType, luabind::object const& parameters);
621 
623  void luaDeleteTaskVisualization(const std::string& visualizationName);
624 
626  void luaRequire(lua_State* L, const std::string& filename);
627 
630  unsigned luaBitwiseOr(unsigned val1, unsigned val2);
631  unsigned luaBitwiseAnd(unsigned val1, unsigned val2);
632  unsigned luaBitwiseXor(unsigned val1, unsigned val2);
633  unsigned luaBitwiseNot(unsigned val);
634  unsigned luaBitwiseLeftShift(unsigned val, unsigned shift);
635  unsigned luaBitwiseRightShift(unsigned val, unsigned shift);
637 
638  bool luaIntersectSegments2D(const DtLocation3D& p1, const DtLocation3D& p2,
639  const DtLocation3D& p3, const DtLocation3D& p4,
640  DtLocation3D& intersectPoint);
641 
643  virtual bool luaIsDatabaseLoggingEnabled();
644 
646  virtual void luaLogEventToDatabase(unsigned eventType, luabind::object const& parameters);
647 
652  {
653  public:
654  DtLuaScriptFunctionReference(const std::string& functionName)
656  , myFunctionName(functionName)
657  {
658 
659  }
660 
662  {
663 
664  }
665 
666  std::string functionName() const
667  {
668  return myFunctionName;
669  }
670 
671  virtual bool operator<(const DtScriptFunctionReference& other) const override
672  {
673  try
674  {
675  const DtLuaScriptFunctionReference& rhs =
676  dynamic_cast<const DtLuaScriptFunctionReference&>(other);
677  return myFunctionName.compare(rhs.myFunctionName) < 0;
678  }
679  catch(...)
680  {
681  DtInfo << "DtLuaScriptFunctionReference::operator< attempt to compare with wrong type.\n";
682  return false;
683  }
684  }
685 
686  protected:
687  std::string myFunctionName;
688  };
689 
692  virtual void addPostSetDataCallback(const std::string& setDataType,
693  const std::string& functionName);
696  virtual void removePostSetDataCallback(const std::string& setDataType,
697  const std::string& functionName);
698 
701  virtual void invokePostSetDataCallback(
702  DtScriptFunctionReferencePtr functionReference,
703  DtSetDataRequestMessage* setDatRequest) override;
704 
710  virtual luabind::object luaGetParamPropertyFromType(
711  const std::string typeString, std::string const& paramName);
712 
714  virtual void putObjectsFromTableIntoGlobalTable(lua_State* state, luabind::object& table);
715  virtual void putObjectsFromGlobalTableIntoTable(lua_State* state, luabind::object& table);
716 
718  virtual luabind::object luaGetSubordinateFunctionNames();
719 
721  virtual luabind::object luaGetParameterSubordinateFunctionsFromType(
722  const std::string typeString);
723 
724  virtual void connectForCallbacks();
725  virtual void processEvents();
726 
728  boost::shared_ptr<DtLuaAsyncJob> luaGetWeaponSystemsInfo(DtScriptVrfObject& object);
729 
730 protected:
734  virtual bool callLuaNoArgFunction(const std::string& functionName, bool* functionExists = nullptr);
735 
736  virtual void updateFuncCallCount();
737 
738  lua_State* myLState;
739  unsigned myFuncCallCount;
741 
742  typedef std::vector<DtLuaScriptInterfaceExtension*> LocalInterfaceExtensions;
744 
746  {
747  LuaExtension() : creator(nullptr), onlyForEntity(nullptr), usr(nullptr) {};
748  LuaExtension(const LuaExtension& orig) : creator(orig.creator), onlyForEntity(orig.onlyForEntity),
749  usr(orig.usr) {};
750 
753  void* usr;
754  };
755 
756  typedef std::vector<LuaExtension> GlobalInterfaceExtensions;
757 
759 
760  luabind::object myCheckpointStateTable;
761 
762  typedef std::map<DtString, ReaderWriterToLuaTableFcn> ReaderWriterToLuaTableMap;
765 
766  std::vector<DtVrfObjectMessage*> myTextReportCallbacks;
767  std::vector<DtBoost::shared_ptr<const makVrfEvents::DtInfluenceEvent> > myInfluenceEvents;
768 
769  bool myNeedsInvokeShutdown = true;
770 };
771 
773 
781 namespace luaScriptInterface
782 {
783  typedef luabind::object (*rwToLuaBindObjectFcn)(
784  const DtReaderWriter* rw, lua_State* L);
785 
786  luabind::object luaGetEntityParam(lua_State* L,
787  const DtScriptVrfObject& entity, std::string const& paramName);
788 
789  luabind::object luaGetSystemAttribute(
790  const DtScriptComponentSystem& system, const std::string& attributeName
791  , bool *error
792  , lua_State *L
793  );
794 
796  luabind::object luaGetContactInfo(lua_State* L, const DtScriptOwnshipObject& thisEntity,
797  const DtScriptVrfObject& otherEntity);
798 
802  luabind::object luaGetSubordinateFormation(lua_State* L,
803  const DtScriptOwnshipObject& entity,
804  DtScriptVrfObject& leadSubordinate);
805 
813  std::list<DtVectorOffset3D> luaGetOptionFormationPositions(lua_State* L,
814  const DtScriptVrfObject& unit,
815  const std::string& formationName, luabind::object const& options,
816  int* leaderIndex);
817 
819  std::list<DtVectorOffset3D> luaGetFormationPositions(lua_State* L,
820  const DtScriptVrfObject& unit,
821  const std::string& formationName,
822  int* leaderIndex);
823 
826  luabind::object luaGetParameterSubordinateFunctions(lua_State* L, const DtScriptVrfObject& entity);
827 
829  luabind::object luaGetSubordinateFunctions(lua_State* L, const DtScriptVrfObject& entity);
830 
834  bool luaSetSubordinateFunctions(lua_State* L, const DtScriptVrfObject& entity, luabind::object const& subsAndFunctions);
835 
837  std::string luaGetSubordinateFunction(lua_State* L, const DtScriptVrfObject& entity, const DtScriptVrfObject& subEntity);
838 
842  bool luaSetSubordinateFunction(lua_State* L, const DtScriptVrfObject& entity, const DtScriptVrfObject& subEntity, const std::string& subFunction);
843 
845  luabind::object luaGetAisData(lua_State* L, const DtScriptVrfObject& entity);
846 
848  luabind::object luaGetTargetPriorityList(lua_State* L, const DtScriptOwnshipObject& thisEntity);
849 
857  std::list<DtScriptVrfObject> luaGetContactsWithFilter(
858  lua_State* L, const DtScriptOwnshipObject& entity,
859  luabind::object const& typeFilters, bool observedOnly);
862  std::list<DtScriptVrfObject> luaGetContactsWithFilterAliveOnly(
863  lua_State* L, const DtScriptOwnshipObject& entity,
864  luabind::object const& typeFilters, bool observedOnly,
865  bool aliveOnly);
866 
869  std::list<DtScriptVrfObject> luaGetHostileContactsWithFilterAliveOnly(
870  lua_State* L, const DtScriptOwnshipObject& entity,
871  luabind::object const& typeFilters, bool observedOnly,
872  bool aliveOnly);
873 
878  std::list<DtScriptVrfObject> luaGetContacts(
879  lua_State* L, const DtScriptOwnshipObject& entity,
880  luabind::object const& typeFilters,
881  luabind::object const& flags);
882 
885  luabind::object luaGetWeaponInfoList(lua_State* L, const DtScriptOwnshipObject& thisEntity);
886 
887  luabind::object luaGetWeaponInfo(lua_State* L, const DtScriptOwnshipObject& thisEntity, const std::string& weaponId);
888 
890  bool luaWeaponCanTargetLocation(lua_State* L, const DtScriptOwnshipObject& thisEntity,
891  const std::string& weaponId, const DtLocation3D& location);
892 
894  std::string luaWeaponTargetApplicability(lua_State* L, const DtScriptOwnshipObject& thisEntity,
895  const std::string& weaponId, const std::string& targetType);
896 
897  luabind::object luaGetWeaponFireTask(lua_State* L, const DtScriptOwnshipObject& thisEntity,
898  const std::string& weaponId, luabind::object const& locationRef);
899 
902  bool luaSetStateProperty(lua_State* L, DtScriptOwnshipObject& entity,
903  const std::string& propertyName, luabind::object const& prop);
904 
908  bool luaSetOrAddStateProperty(lua_State* L, DtScriptOwnshipObject& entity,
909  const std::string& propertyName, luabind::object const& prop, bool addIfNotFound);
910 
917  bool luaSetStatePropertyListItem(lua_State* L,
918  DtScriptOwnshipObject& entity, const std::string& propertyName,
919  luabind::object const& keyValues, luabind::object const& itemValue);
920 
927  lua_State* L, DtScriptOwnshipObject& entity, const std::string& propertyName,
928  int index, luabind::object const& itemValue);
929 
936  bool luaSetStatePropertyMapItem(lua_State* L,
937  DtScriptOwnshipObject& entity, const std::string& propertyName,
938  luabind::object const& keyValue, luabind::object const& itemValue);
939 
944  luabind::object luaGetStateProperty(lua_State* L,
945  const DtScriptVrfObject& entity, const std::string& propertyName);
946  luabind::object luaGetStateOwnshipProperty(lua_State* L,
947  const DtScriptOwnshipObject& entity, const std::string& propertyName);
948 
957  luabind::object luaGetStatePropertyListItem(lua_State* L,
958  const DtScriptVrfObject& entity, const std::string& propertyName,
959  luabind::object const& keyValues, int& index);
960  luabind::object luaGetStateOwnshipPropertyListItem(lua_State* L,
961  const DtScriptOwnshipObject& entity, const std::string& propertyName,
962  luabind::object const& keyValues, int& index);
963 
971  luabind::object luaGetStatePropertyListItemByIndex(lua_State* L,
972  const DtScriptVrfObject& entity, const std::string& propertyName,
973  int index);
974  luabind::object luaGetStateOwnshipPropertyListItemByIndex(lua_State* L,
975  const DtScriptOwnshipObject& entity, const std::string& propertyName,
976  int index);
977 
985  luabind::object luaGetStatePropertyMapItem(lua_State* L,
986  const DtScriptVrfObject& entity, const std::string& propertyName,
987  luabind::object const& keyValue);
988  luabind::object luaGetStateOwnshipPropertyMapItem(lua_State* L,
989  const DtScriptOwnshipObject& entity, const std::string& propertyName,
990  luabind::object const& keyValue);
991 
996  luabind::object luaGetParamProperty(lua_State* L,
997  const DtScriptVrfObject& entity, std::string const& paramName);
998  luabind::object luaGetOwnshipParamProperty(lua_State* L,
999  const DtScriptOwnshipObject& entity, std::string const& paramName);
1000 
1009  luabind::object luaGetParameterPropertyListItem(lua_State* L,
1010  const DtScriptVrfObject& entity, const std::string& propertyName,
1011  luabind::object const& keyValues, int& index);
1012  luabind::object luaGetOwnshipParameterPropertyListItem(lua_State* L,
1013  const DtScriptOwnshipObject& entity, const std::string& propertyName,
1014  luabind::object const& keyValues, int& index);
1015 
1023  luabind::object luaGetParameterPropertyListItemByIndex(lua_State* L,
1024  const DtScriptVrfObject& entity, const std::string& propertyName,
1025  int index);
1026  luabind::object luaGetOwnshipParameterPropertyListItemByIndex(lua_State* L,
1027  const DtScriptOwnshipObject& entity, const std::string& propertyName,
1028  int index);
1029 
1037  luabind::object luaGetParameterPropertyMapItem(lua_State* L,
1038  const DtScriptVrfObject& entity, const std::string& propertyName,
1039  luabind::object const& keyValue);
1040  luabind::object luaGetOwnshipParameterPropertyMapItem(lua_State* L,
1041  const DtScriptOwnshipObject& entity, const std::string& propertyName,
1042  luabind::object const& keyValue);
1043 
1044  bool luaSetSystemAttribute(
1045  DtScriptComponentSystem& system, const std::string& attributeName,
1046  const luabind::object & value,
1047  lua_State *L);
1048 
1049  static const std::map<DtString, rwToLuaBindObjectFcn>& rwToLuaBindObjectMap();
1050 };
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:200
std::vector< DtVrfObjectMessage * > myTextReportCallbacks
Definition: luaScriptInterfaceImpl.h:766
virtual bool operator<(const DtScriptFunctionReference &other) const override
Required for std::set.
Definition: luaScriptInterfaceImpl.h:671
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.
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:22
luabind::object luaGetParamProperty(lua_State *L, const DtScriptVrfObject &entity, std::string const &paramName)
Returns an object containing the value of the requested parameter property. May be a table containing...
const char ContactObservedOnly[]
Definition: luaScriptInterfaceImpl.h:42
luabind::object luaGetSubordinateFunctions(lua_State *L, const DtScriptVrfObject &entity)
Return a table of {{&quot;subordinate&quot; = DtScriptVrfObject, &quot;function&quot; = string}}.
static GlobalInterfaceExtensions theLuaInterfaceExtensions
Definition: luaScriptInterfaceImpl.h:758
std::vector< LuaExtension > GlobalInterfaceExtensions
Definition: luaScriptInterfaceImpl.h:756
lua_State * myLState
Definition: luaScriptInterfaceImpl.h:738
virtual bool invokeResume()=0
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 {{&quot;subordinate&quot; = DtScriptVrfObject, &quot;function&quot; = 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:739
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
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
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:31
Default on in debug, off in release.
Definition: objectCounter.h:27
luabind::object(* ReaderWriterToLuaTableFcn)(lua_State *LS, const DtReaderWriter *rwString, const DtSimulationServices *mgr, const DtString &parameterType)
When adding decoder functions to turn reader/writer into lua tables, the format must be of the follow...
Definition: luaScriptInterfaceImpl.h:39
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.
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. If the property or list item could not be found, the returned table will be empty.
LocalInterfaceExtensions myInterfaceExtensions
Definition: luaScriptInterfaceImpl.h:743
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:740
static ReaderWriterToLuaTableMap theReaderWriterToLuaTableMap
Definition: luaScriptInterfaceImpl.h:763
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)
luabind::object luaGetWeaponFireTask(lua_State *L, const DtScriptOwnshipObject &thisEntity, const std::string &weaponId, luabind::object const &locationRef)
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...
std::string functionName() const
Definition: luaScriptInterfaceImpl.h:666
DtLuaScriptFunctionReference(const std::string &functionName)
Definition: luaScriptInterfaceImpl.h:654
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. If the property or map item could not be found, the returned table will be empty.
VectorOffset3D is a direction vector that is relative to some direction specified by a Vector3D...
Definition: scriptGeometry.h:424
Handles translation of messages from C++ structures into Lua tables and the reverse translation as we...
Definition: luaMessageInterface.h:23
luabind::object luaGetOwnshipParamProperty(lua_State *L, const DtScriptOwnshipObject &entity, std::string const &paramName)
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:748
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...
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:752
Definition: luaScriptInterfaceImpl.h:50
luabind::object luaGetOwnshipParameterPropertyListItem(lua_State *L, const DtScriptOwnshipObject &entity, const std::string &propertyName, luabind::object const &keyValues, int &index)
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)
luabind::object(* rwToLuaBindObjectFcn)(const DtReaderWriter *rw, lua_State *L)
Definition: luaScriptInterfaceImpl.h:783
virtual void invokeDisable()=0
Only called for reactive tasks which can be enabled but not active. When the task is completely disab...
std::vector< DtBoost::shared_ptr< const makVrfEvents::DtInfluenceEvent > > myInfluenceEvents
Definition: luaScriptInterfaceImpl.h:767
virtual void invokeTick()=0
This will be called by the parent to invoke the script tick.
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...
std::string luaWeaponTargetApplicability(lua_State *L, const DtScriptOwnshipObject &thisEntity, const std::string &weaponId, const std::string &targetType)
lua &quot;weaponTargetApplicability()&quot;
const char ContactAliveOnly[]
Definition: luaScriptInterfaceImpl.h:43
boost::shared_ptr< DtScriptFunctionReference > DtScriptFunctionReferencePtr
Shared ptr to DtScriptFunctionReference.
Definition: scriptInterface.h:54
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. 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:651
std::vector< DtLuaScriptInterfaceExtension * > LocalInterfaceExtensions
Definition: luaScriptInterfaceImpl.h:742
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
luabind::object luaGetEntityParam(lua_State *L, const DtScriptVrfObject &entity, std::string const &paramName)
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 {{&quot;subordinate&quot; = DtScriptVrfObject, &quot;function&quot; = string}} Set the state propert...
Contains the DtTranslatableStream class declaration.
const char ContactCurrentlyDetectedOnly[]
Definition: luaScriptInterfaceImpl.h:45
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:95
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:28
luabind::object luaGetAisData(lua_State *L, const DtScriptVrfObject &entity)
Returns a table of AIS data for the specified entity.
LuaExtension()
Definition: luaScriptInterfaceImpl.h:747
std::map< DtString, ReaderWriterToLuaTableFcn > ReaderWriterToLuaTableMap
Definition: luaScriptInterfaceImpl.h:762
DtLuaScriptInterfaceExtension.
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
luabind::object myCheckpointStateTable
Definition: luaScriptInterfaceImpl.h:760
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.
void * usr
Definition: luaScriptInterfaceImpl.h:753
const char ContactHostileOnly[]
Definition: luaScriptInterfaceImpl.h:44
Definition: luaScriptInterfaceImpl.h:745
The &quot;this&quot; version is the own-ship object. It is separated to allow special functions for the ownshi...
Definition: scriptVrfObject.h:405
DtLuaMessageInterface * myMessageInterface
Definition: luaScriptInterfaceImpl.h:764
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 &quot;getWeaponInfo()&quot; 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:687
bool luaWeaponCanTargetLocation(lua_State *L, const DtScriptOwnshipObject &thisEntity, const std::string &weaponId, const DtLocation3D &location)
lua &quot;weaponCanTargetLocation()&quot;
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:29
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 &quot;getContacts()&quot; 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...
virtual void invokeShutdown()=0
virtual void invokeUpdateDisplayGraph()=0
Called when graphs are enabled to get an immediate graph output.
virtual ~DtLuaScriptFunctionReference()
Definition: luaScriptInterfaceImpl.h:661
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86
Definition: scriptVrfObject.h:30
A location3D is a point in space, i.e. a geocentric coordinate.
Definition: scriptGeometry.h:22

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)