1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-18 04:10:06 +00:00
OpenMW/files/lua_api/openmw/world.lua

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

106 lines
3.5 KiB
Lua
Raw Normal View History

2022-02-23 21:08:50 +00:00
---
2021-04-02 17:42:19 +00:00
-- `openmw.world` is an interface to the game world for global scripts.
-- Can not be used from local scripts.
-- @module world
-- @usage local world = require('openmw.world')
2022-02-23 21:08:50 +00:00
---
2021-04-02 17:42:19 +00:00
-- List of currently active actors.
-- @field [parent=#world] openmw.core#ObjectList activeActors
2022-02-23 21:08:50 +00:00
---
2021-04-02 17:42:19 +00:00
-- Loads a named cell
-- @function [parent=#world] getCellByName
-- @param #string cellName
-- @return openmw.core#Cell
2022-02-23 21:08:50 +00:00
---
2021-04-02 17:42:19 +00:00
-- Loads an exterior cell by grid indices
-- @function [parent=#world] getExteriorCell
-- @param #number gridX
-- @param #number gridY
2023-05-13 17:30:18 +00:00
-- @param #any cellOrName (optional) other cell or cell name in the same exterior world space
2021-04-02 17:42:19 +00:00
-- @return openmw.core#Cell
2023-05-13 17:30:18 +00:00
---
-- List of all cells
-- @field [parent=#world] #list<openmw.core#Cell> cells
-- @usage for i, cell in ipairs(world.cells) do print(cell) end
2022-02-23 21:08:50 +00:00
---
-- Simulation time in seconds.
-- The number of simulation seconds passed in the game world since starting a new game.
2022-06-04 13:28:04 +00:00
-- @function [parent=#world] getSimulationTime
-- @return #number
2022-02-23 21:08:50 +00:00
---
-- The scale of simulation time relative to real time.
2022-06-04 13:28:04 +00:00
-- @function [parent=#world] getSimulationTimeScale
-- @return #number
2022-07-03 12:51:28 +00:00
---
-- Set the simulation time scale.
-- @function [parent=#world] setSimulationTimeScale
-- @param #number scale
2022-02-23 21:08:50 +00:00
---
-- Game time in seconds.
2022-06-04 13:28:04 +00:00
-- @function [parent=#world] getGameTime
-- @return #number
2022-02-23 21:08:50 +00:00
---
-- The scale of game time relative to simulation time.
2022-06-04 13:28:04 +00:00
-- @function [parent=#world] getGameTimeScale
-- @return #number
2022-02-23 21:08:50 +00:00
---
-- Set the ratio of game time speed to simulation time speed.
-- @function [parent=#world] setGameTimeScale
-- @param #number ratio
2022-02-23 21:08:50 +00:00
---
-- Whether the world is paused (onUpdate doesn't work when the world is paused).
-- @function [parent=#world] isWorldPaused
-- @return #boolean
2021-04-02 17:42:19 +00:00
---
-- Return an object by RefNum/FormId.
2023-06-07 20:20:35 +00:00
-- Note: the function always returns @{openmw.core#GameObject} and doesn't validate that
-- the object exists in the game world. If it doesn't exist or not yet loaded to memory),
-- then `obj:isValid()` will be `false`.
-- @function [parent=#world] getObjectByFormId
-- @param #string formId String returned by `core.getFormId`
-- @return openmw.core#GameObject
-- @usage local obj = world.getObjectByFormId(core.getFormId('Morrowind.esm', 128964))
---
-- Create a new instance of the given record.
-- After creation the object is in the disabled state. Use :teleport to place to the world or :moveInto to put it into a container or an inventory.
-- @function [parent=#world] createObject
-- @param #string recordId Record ID in lowercase
-- @param #number count (optional, 1 by default) The number of objects in stack
-- @return openmw.core#GameObject
-- @usage -- put 100 gold on the ground at the position of `actor`
-- money = world.createObject('gold_001', 100)
-- money:teleport(actor.cell.name, actor.position)
-- @usage -- put 50 gold into the actor's inventory
-- money = world.createObject('gold_001', 50)
-- money:moveInto(types.Actor.inventory(actor))
2023-03-29 07:46:11 +00:00
---
-- Creates a custom record in the world database.
-- Eventually meant to support all records, but the current
-- set of supported types is limited to:
-- * @{openmw.types#PotionRecord},
-- * @{openmw.types#ArmorRecord},
-- * @{openmw.types#BookRecord},
-- * @{openmw.types#MiscellaneousRecord},
-- * @{openmw.types#ActivatorRecord}
2023-03-29 07:46:11 +00:00
-- @function [parent=#world] createRecord
-- @param #any record A record to be registered in the database. Must be one of the supported types.
-- @return #any A new record added to the database. The type is the same as the input's.
2021-04-02 17:42:19 +00:00
return nil