Skip to content

Commit

Permalink
👼 Added doc for callbacks and races.
Browse files Browse the repository at this point in the history
The angelscript documentation is now divided into 3 pseudo-modules:

 	Game-to-script
 	^AngelScript^ Documents script functions (callbacks) invoked by the game.

 	Script-to-game
 	^AngelScript^ Documents game functions which scripts can invoke to control it.

 	Script-to-script
 	^AngelScript^ Documents built-in scripts.
  • Loading branch information
ohlidalp committed Feb 26, 2022
1 parent 6d8af64 commit cf12baf
Show file tree
Hide file tree
Showing 11 changed files with 166 additions and 51 deletions.
39 changes: 39 additions & 0 deletions doc/angelscript/Game2Script/script_callbacks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

namespace Game2Script {

/** \addtogroup ScriptSideAPIs
* @{
*/

/** \addtogroup Game2Script
* @{
*/

/** Required; Script setup function - invoked once when script is loaded.
* If not present, the game will report error and abandon the script.
*/
void main();

/** Optional; Script update function - invoked once every rendered frame.
* @param dt Elapsed time (delta time) in seconds.
*/
void frameStep(float dt);

/** Optional; Invoked if a registered event is triggered, see Script2Game::game::registerForEvent.
* @param event Event code.
* @param param Event-specific parameter, see docs for the event codes.
*/
void eventCallback(Script2Game::scriptEvents event, int param);

/** Optional; Invoked when a vehicle touches an eventbox which has no custom handler function.
* @param trigger_type Unused, always 0.
* @param inst Unique ID of the terrain object instance which created the eventbox.
* @param box Name of the eventbox as defined by the terrain object's ODEF file.
* @param nodeid Number of the node which triggered the event, or -1 if not known.
*/
void defaultEventCallback(int trigger_type, string inst, string box, int nodeid);

/** @}*/ //addtogroup Game2Script
/** @}*/ //addtogroup ScriptSideAPIs

} // namespace Game2Script
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
namespace ScriptAPI {

/** \addtogroup ScriptAPI
/** \addtogroup ScriptSideAPIs
* @{
*/
*/

/** \addtogroup Script2Game
* @{
*/

namespace Script2Game {

/**
* @brief Binding of RoR::Actor; a softbody-physics gameplay object, can be anything from soda can to space shuttle.
Expand Down Expand Up @@ -189,6 +194,7 @@ class BeamClass
Ogre::Vector3 getNodePosition(int nodeNumber);
}

/** @}*/ //addtogroup ScriptAPI
/** @}*/ //addtogroup Script2Game
/** @}*/ //addtogroup ScriptSideAPIs

} //namespace ScriptAPI
} //namespace Script2Game
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@

/** \addtogroup ScriptSideAPIs
* @{
*/

namespace ScriptAPI {

/** \addtogroup ScriptAPI
/** \addtogroup Script2Game
* @{
*/

namespace Script2Game {

/**
* @brief Types and special attributes of cvars.
Expand Down Expand Up @@ -40,6 +43,7 @@ class CVarClass
std::string const& getName() const { return m_name; }
};

/** @}*/ //addtogroup ScriptAPI
/** @}*/ //addtogroup Script2Game
/** @}*/ //addtogroup ScriptSideAPIs

} //namespace ScriptAPI
} //namespace Script2Game
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
namespace ScriptAPI {

/** \addtogroup ScriptAPI
/** \addtogroup ScriptSideAPIs
* @{
*/
*/

/** \addtogroup Script2Game
* @{
*/

namespace Script2Game {

/**
* @brief Binding of RoR::Console; provides console variables (cvars), usually defined in RoR.cfg file.
Expand Down Expand Up @@ -38,6 +43,7 @@ class ConsoleClass
CVar* cVarGet(std::string const& input_name, int flags);
};

/** @}*/ //addtogroup ScriptAPI
/** @}*/ //addtogroup Script2Game
/** @}*/ //addtogroup ScriptSideAPIs

} //namespace ScriptAPI
} //namespace Script2Game
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@

/** \addtogroup ScriptSideAPIs
* @{
*/

namespace ScriptAPI {

/** \addtogroup ScriptAPI
/** \addtogroup Script2Game
* @{
*/
*/

namespace Script2Game {

/**
* @brief Binding of RoR::InputEngine; Manages input devices, their configuration (input.map ...) and state.
Expand Down Expand Up @@ -36,8 +39,9 @@ class InputEngineClass

};

/** @}*/ //addtogroup ScriptAPI
/** @}*/ //addtogroup Script2Game
/** @}*/ //addtogroup ScriptSideAPIs

} //namespace ScriptAPI
} //namespace Script2Game


Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@

/** \addtogroup ScriptSideAPIs
* @{
*/

namespace ScriptAPI {

/** \addtogroup ScriptAPI
/** \addtogroup Script2Game
* @{
*/
*/

namespace Script2Game {

/**
* @brief Binding of LocalStorage; A class that allows your script to store data persistently.
Expand Down Expand Up @@ -114,6 +117,7 @@ class LocalStorage
void changeSection(const string section);
};

/** @}*/ //addtogroup ScriptAPI
/** @}*/ //addtogroup Script2Game
/** @}*/ //addtogroup ScriptSideAPIs

} //namespace ScriptAPI
} //namespace Script2Game
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@
@date 03/2016
*/

namespace ScriptAPI {

/** \addtogroup ScriptAPI
/** \addtogroup ScriptSideAPIs
* @{
*/

/** \addtogroup Script2Game
* @{
*/

namespace Script2Game {

/**
* Enum with AI events
*/
Expand Down Expand Up @@ -98,6 +102,7 @@ class VehicleAI

}

/** @}*/ //addtogroup ScriptAPI
/** @}*/ //addtogroup Script2Game
/** @}*/ //addtogroup ScriptSideAPIs

} //namespace ScriptAPI
} //namespace ScriptSideAPIs
17 changes: 11 additions & 6 deletions doc/angelscript/game.h → doc/angelscript/Script2Game/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
*/
// created on 23th May 2011 by neorej16

namespace ScriptAPI {

/** \addtogroup ScriptAPI
/** \addtogroup ScriptSideAPIs
* @{
*/
*/

/** \addtogroup Script2Game
* @{
*/

namespace Script2Game {

/**
* @brief Binding of RoR::GameScript; A general class that will provide you with general functions.
Expand Down Expand Up @@ -454,6 +458,7 @@ class game
void quitGame();
};

/** @}*/ //defgroup ScriptAPI
/** @}*/ //addtogroup Script2Game
/** @}*/ //addtogroup ScriptSideAPIs

} //namespace ScriptAPI
} //namespace Script2Game
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@ along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
*/
// created on 25th May 2011.

/** @defgroup ScriptAPI Script-side API
* @brief This pseudo-module documents features available to scripts.
* Unless otherwise noted, any script (terrain, custom, future enhancements) can access these features.
* @warning This is a pseudo-module; it doesn't exist in codebase, only in this documentation.
*/

/** \addtogroup ScriptAPI
/** \addtogroup ScriptSideAPIs
* @{
*/
*/

/** \addtogroup Script2Game
* @{
*/

/** @brief Pseudo-namespace; it doesn't exist in code or script runtime, only in this documentation.
*/
namespace ScriptAPI {
namespace Script2Game {

/**
* This is an alias for game.log(string message).
Expand Down Expand Up @@ -420,6 +416,7 @@ enum truckStates {
TS_DELETED, //!< special used when truck pointer is 0
};

} //namespace ScriptAPI
} // namespace Script2Game

/** @}*/ //addtogroup ScriptAPI
/** @}*/ //addtogroup Script2Game
/** @}*/ //addtogroup ScriptSideAPIs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
* @author neorej16
*/

namespace Script2Script {

/** \addtogroup ScriptSideAPIs
* @{
*/

/** \addtogroup Script2Script
* @{
*/

/**
* A function signature for the callback pointers.
* When you need to use a RACE_EVENT_CALLBACK as parameter, then
Expand Down Expand Up @@ -560,3 +570,8 @@ class racesManager {
*/
void loadRace(int raceID);
}

/** @}*/ //addtogroup Script2Script
/** @}*/ //addtogroup ScriptSideAPIs

} // namespace Script2Script
30 changes: 30 additions & 0 deletions doc/angelscript/ScriptSideAPIs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

/// @defgroup ScriptSideAPIs Script-side APIs
/// ^AngelScript^ All features provided to/offered by scripting.

/// @defgroup Game2Script Game-to-script
/// ^AngelScript^ Documents script functions (callbacks) invoked by the game.
/// @{

/// @brief Pseudo-namespace; it doesn't exist in code or script runtime, only in this documentation.
namespace Game2Script {}

/// @}

/// @defgroup Script2Game Script-to-game
/// ^AngelScript^ Documents game functions which scripts can invoke to control it.
/// @{

/// @brief Pseudo-namespace; it doesn't exist in code or script runtime, only in this documentation.
namespace Script2Game {}

/// @}

/// @defgroup Script2Script Script-to-script
/// ^AngelScript^ Documents built-in scripts.
/// @{

/// @brief Pseudo-namespace; it doesn't exist in code or script runtime, only in this documentation.
namespace Script2Script {}

/// @}

0 comments on commit cf12baf

Please # to comment.