Add documentation

This commit is contained in:
Evil Eye
2026-03-01 20:58:14 +01:00
parent 43a9bd9256
commit 75772caa10
15 changed files with 80 additions and 31 deletions
+3 -1
View File
@@ -106,7 +106,9 @@ rst_prolog = f"""
.. |bdg-ctx-global| replace:: :bdg-danger:`global`
.. |bdg-ctx-player| replace:: :bdg-secondary:`player`
.. |bdg-ctx-local| replace:: :bdg-info:`local`
.. |bdg-ctx-all| replace:: :bdg-danger:`global` :bdg-warning:`menu` :bdg-info:`local`
.. |bdg-ctx-load| replace:: :bdg-black:`load`
.. |bdg-ctx-non-load| replace:: :bdg-danger:`global` :bdg-warning:`menu` :bdg-info:`local`
.. |bdg-ctx-all| replace:: :bdg-danger:`global` :bdg-warning:`menu` :bdg-info:`local` :bdg-black:`load`
"""
# The language for content autogenerated by Sphinx. Refer to documentation
@@ -172,3 +172,13 @@ Engine handler is a function defined by a script, that can be called by the engi
* - onStateChanged()
- | Called whenever the current game changes
| (i. e. the result of `getState <openmw_menu.html##(menu).getState>`_ changes)
**Only for load scripts**
|bdg-ctx-load|
.. list-table::
:widths: 20 80
* - onContentFilesLoaded()
- | Called after all content files have been parsed, but before the main menu.
@@ -11,6 +11,7 @@ Packages
animation <openmw_animation>
async <openmw_async>
camera <openmw_camera>
content <openmw_content>
core <openmw_core>
debug <openmw_debug>
input <openmw_input>
@@ -0,0 +1,7 @@
Package openmw.content
===================
.. include:: version.rst
.. raw:: html
:file: generated_html/openmw_content.html
@@ -181,6 +181,7 @@ Possible flags are:
- ``MENU`` - a menu script; always active, even before a game is loaded
- ``CUSTOM`` - dynamic local script that can be started or stopped by a global script;
- ``PLAYER`` - an auto started player script;
- ``LOAD`` - a load script, active while content files are being loaded;
- ``ACTIVATOR`` - a local script that will be automatically attached to any activator;
- ``ARMOR`` - a local script that will be automatically attached to any armor;
- ``BOOK`` - a local script that will be automatically attached to any book;
@@ -207,6 +208,7 @@ Hot reloading
It is possible to modify a script without restarting OpenMW. To apply changes, open the in-game console and run the command: ``reloadlua``.
This will restart all Lua scripts using the `onSave and onLoad`_ handlers the same way as if the game was saved or loaded.
It reloads all ``.omwscripts`` files and ``.lua`` files that are not packed to any archives. ``.omwaddon`` files and scripts packed to BSA can not be changed without restarting the game.
Load scripts will not run again until the game is restarted.
Lua console
===========
@@ -6,10 +6,10 @@
- Context
- Description
* - :doc:`calendar </reference/lua-scripting/openmw_aux_calendar>`
- |bdg-ctx-all|
- |bdg-ctx-non-load|
- Game time calendar
* - :doc:`time </reference/lua-scripting/openmw_aux_time>`
- |bdg-ctx-all|
- |bdg-ctx-non-load|
- Timers and game time utils
* - :doc:`ui </reference/lua-scripting/openmw_aux_ui>`
- |bdg-ctx-menu| |bdg-ctx-player|
@@ -10,13 +10,16 @@
- Controls background sounds for given player.
* - :doc:`animation </reference/lua-scripting/openmw_animation>`
- |bdg-ctx-local|
- Animation controls
- Animation controls.
* - :doc:`async </reference/lua-scripting/openmw_async>`
- |bdg-ctx-all|
- Timers and callbacks.
* - :doc:`camera </reference/lua-scripting/openmw_camera>`
- |bdg-ctx-player|
- Controls camera.
* - :doc:`content </reference/lua-scripting/openmw_content>`
- |bdg-ctx-load|
- Content manipulation.
* - :doc:`core </reference/lua-scripting/openmw_core>`
- |bdg-ctx-all|
- Functions that are common for both global and local scripts
@@ -48,7 +51,7 @@
- |bdg-ctx-all|
- Storage API. In particular can be used to store data between game sessions.
* - :doc:`types </reference/lua-scripting/openmw_types>`
- |bdg-ctx-all|
- |bdg-ctx-non-load|
- Functions for specific types of game objects.
* - :doc:`ui </reference/lua-scripting/openmw_ui>`
- |bdg-ctx-menu| |bdg-ctx-player|
+1
View File
@@ -13,6 +13,7 @@ set(LUA_API_FILES
openmw/animation.lua
openmw/async.lua
openmw/camera.lua
openmw/content.lua
openmw/core.lua
openmw/debug.lua
openmw/input.lua
+1 -1
View File
@@ -1,7 +1,7 @@
---
-- Contains timers and coroutine utilities. All functions require
-- the package itself as a first argument.
-- @context global|menu|local|player
-- @context global|menu|local|player|load
-- @module async
-- @usage local async = require('openmw.async')
+23
View File
@@ -0,0 +1,23 @@
---
-- Allows for manipulation of the data loaded from content files while the game is first started.
-- @context load
-- @module content
-- @usage local content = require('openmw.content')
--- @{#GlobalContent}: Global variable manipulation.
-- @field [parent=#content] #GlobalContent globals
---
-- A mutable list of all global mwscript variables.
-- @field [parent=#GlobalContent] #map<#string, #number> records
-- @usage
-- content.globals.records.MyVariable = 42
--- @{#StaticContent}: Static manipulation.
-- @field [parent=#content] #StaticContent statics
---
-- A mutable list of all #{openmw.types#StaticRecord}s.
-- @field [parent=#GlobalContent] #list<openmw.types#StaticRecord> records
-- @usage
-- content.statics.records.MyStatic = { model = 'meshes/b/B_N_Wood Elf_M_Head_02.nif' }
+21 -21
View File
@@ -1,6 +1,6 @@
---
-- Defines functions and types that are available in local, global and menu scripts.
-- @context global|menu|local|player
-- Defines functions and types that are available in local, global, menu, and load scripts.
-- @context global|menu|local|player|load
-- @module core
-- @usage local core = require('openmw.core')
@@ -11,53 +11,53 @@
-- @field [parent=#core] #number API_REVISION
---
-- Terminates the game and quits to the OS. Should be used only for testing purposes.
-- Terminates the game and quits to the OS. Should be used only for testing purposes. Not available in load scripts.
-- @function [parent=#core] quit
---
-- Send an event to global scripts. Note: in menu scripts, errors if the game is not running (check @{openmw.menu#menu.getState})
-- Send an event to global scripts. Note: in menu scripts, errors if the game is not running (check @{openmw.menu#menu.getState}.) Not available in load scripts.
-- @function [parent=#core] sendGlobalEvent
-- @param #string eventName
-- @param eventData
---
-- Simulation time in seconds.
-- The number of simulation seconds passed in the game world since starting a new game.
-- The number of simulation seconds passed in the game world since starting a new game. Not available in load scripts.
-- @function [parent=#core] getSimulationTime
-- @return #number
---
-- The scale of simulation time relative to real time.
-- The scale of simulation time relative to real time. Not available in load scripts.
-- @function [parent=#core] getSimulationTimeScale
-- @return #number
---
-- Game time in seconds.
-- Game time in seconds. Not available in load scripts.
-- @function [parent=#core] getGameTime
-- @return #number
---
-- The scale of game time relative to simulation time.
-- The scale of game time relative to simulation time. Not available in load scripts.
-- @function [parent=#core] getGameTimeScale
-- @return #number
---
-- Whether the world is paused.
-- Whether the world is paused. Not available in load scripts.
-- @function [parent=#core] isWorldPaused
-- @return #boolean
---
-- Real time in seconds; starting point is not fixed (can be time since last reboot), use only for measuring intervals. For Unix time use `os.time()`.
-- Real time in seconds; starting point is not fixed (can be time since last reboot), use only for measuring intervals. For Unix time use `os.time()`. Not available in load scripts.
-- @function [parent=#core] getRealTime
-- @return #number
---
-- Frame duration in seconds. Not available in global scripts.
-- Frame duration in seconds. Not available in global or load scripts.
-- @function [parent=#core] getRealFrameDuration
-- @return #number
---
-- Get a game setting with given name (from GMST ESM records or from openmw.cfg).
-- Get a game setting with given name (from GMST ESM records or from openmw.cfg). Not available in load scripts.
-- @function [parent=#core] getGMST
-- @param #string setting Setting name
-- @return #any
@@ -478,7 +478,7 @@
-- @usage for _, item in ipairs(inventory:findAll('common_shirt_01')) do ... end
--- @{#Land}: Functions for interacting with land data
--- @{#Land}: Functions for interacting with land data. Not available in load scripts.
-- @field [parent=#core] #Land land
---
@@ -500,7 +500,7 @@
-- @return #nil, #string Plugin name or nil if failed to retrieve the texture
--- @{#Magic}: spells and spell effects
--- @{#Magic}: spells and spell effects. Not available in load scripts.
-- @field [parent=#core] #Magic magic
@@ -783,7 +783,7 @@
-- @field #number magnitudeBase
-- @field #number magnitudeModifier
--- @{#Sound}: Sounds and Speech
--- @{#Sound}: Sounds and Speech. Not available in load scripts.
-- @field [parent=#core] #Sound sound
---
@@ -915,7 +915,7 @@
-- print(sound.fileName)
-- end
--- @{#Stats}: stats
--- @{#Stats}: stats. Not available in load scripts.
-- @field [parent=#core] #Stats stats
@@ -978,7 +978,7 @@
-- @field #string failureSound VFS path to the failure sound
-- @field #string hitSound VFS path to the hit sound
--- @{#Dialogue}: Dialogue
--- @{#Dialogue}: Dialogue. Not available in load scripts.
-- @field [parent=#core] #Dialogue dialogue
---
@@ -1283,7 +1283,7 @@
-- @field #number NotLocal A comparison to the speaker's @{#DialogueInfoCondition.variableName} local variable
--- @{#Regions}: Regions
-- @field [parent=#core] #Regions regions
-- @field [parent=#core] #Regions regions. Not available in load scripts.
---
-- A read-only list of all @{#RegionRecord}s in the world database.
@@ -1311,7 +1311,7 @@
-- @field #number chance Multiplicative percentage used to determine whether to play the sound
--- @{#Factions}: Factions
-- @field [parent=#core] #Factions factions
-- @field [parent=#core] #Factions factions. Not available in load scripts.
---
-- A read-only list of all @{#FactionRecord}s in the world database.
@@ -1341,7 +1341,7 @@
-- @field #number factionReaction (DEPRECATED) Returns the same as factionReputation.
--- @{#MWScripts}: MWScripts
-- @field [parent=#core] #MWScript mwscripts
-- @field [parent=#core] #MWScript mwscripts. Not available in load scripts.
---
-- A read-only list of all @{#MWScriptRecord}s in the world database.
@@ -1357,7 +1357,7 @@
--- @{#Weather}: Weather
-- @field [parent=#core] #Weather weather
-- @field [parent=#core] #Weather weather. Not available in load scripts.
--- List of all @{#WeatherRecord}s.
-- @field [parent=#Weather] #list<#WeatherRecord> records A read-only list of all @{#WeatherRecord}s in the world database, may be indexed by recordId.
+1 -1
View File
@@ -1,6 +1,6 @@
---
-- Allows to work with markup languages.
-- @context global|menu|local|player
-- @context global|menu|local|player|load
-- @module markup
-- @usage local markup = require('openmw.markup')
+1 -1
View File
@@ -1,6 +1,6 @@
---
-- Contains functions to work with permanent Lua storage.
-- @context global|menu|local|player
-- @context global|menu|local|player|load
-- @module storage
-- @usage
-- local storage = require('openmw.storage')
+1 -1
View File
@@ -1,6 +1,6 @@
---
-- Defines utility functions and classes like 3D vectors, that don't depend on the game world.
-- @context global|menu|local|player
-- @context global|menu|local|player|load
-- @module util
-- @usage local util = require('openmw.util')
+1 -1
View File
@@ -1,7 +1,7 @@
---
-- Provides read-only access to data directories via VFS.
-- Interface is very similar to "io" library.
-- @context global|menu|local|player
-- @context global|menu|local|player|load
-- @module vfs
-- @usage local vfs = require('openmw.vfs')