|
4 | 4 |
|
5 | 5 | The data is stored on the server using instance of classes [Player](#players), [Cell](#cells) [WorldInstance](#world). Specifically, all of the long-term information which gets kept between server restarts is in the `data` field of each instance.
|
6 | 6 |
|
7 |
| -However, simply changing the `data` table of an object will only only alter that information on the server. To distribute it to the players' clients, you need to call a relevant `Load` function. There are too many to give a compehensive list here, so I will provide a few examples and leave the reader to explore source code for the remaining options. [scripts/player/base.lua](../scripts/player/base.lua), [scripts/cell/base.lua](../scripts/cell/base.lua). |
| 7 | +However, simply changing the `data` table of an object will only only alter that information on the server. To distribute it to the players' clients, you need to call a relevant `Load` function. There are too many to give a comprehensive list here, so I will provide a few examples and leave the reader to explore source code for the remaining options. [scripts/player/base.lua](../scripts/player/base.lua), [scripts/cell/base.lua](../scripts/cell/base.lua). |
8 | 8 |
|
9 | 9 | Altering `data` tables doesn't directly change the values stored on disk either. For them to stay after server restart, you need to eventually call either `SaveToDrive` or `QuicksaveToDrive` function (if you are not sure which one to choose, use `QuicksaveToDrive`). Keep in mind that file operations are much slower than almost anything else you could do, so perform them as rarely as possible (e. g. to prevent data loss due to a crash, or when unloading data from memory).
|
10 | 10 |
|
|
44 | 44 | ```
|
45 | 45 |
|
46 | 46 | Some regularly updated data is not passed to Lua scripts each time it changes.
|
47 |
| -You have to call `Players[pid]:SaveCell` for current cell and location, and `Players[pid]:SaveStatsDynamic`for curent and total health, magicka and stamina. |
| 47 | +You have to call `Players[pid]:SaveCell` for current cell and location, and `Players[pid]:SaveStatsDynamic`for current and total health, magicka and stamina. |
48 | 48 | ```Lua
|
49 | 49 | customEventHooks.registerHandler('OnCellLoad', function(eventStatus, pid)
|
50 | 50 | if eventStatus.validCustomHandlers then
|
|
57 | 57 |
|
58 | 58 | ## Cells
|
59 | 59 |
|
60 |
| -Currently active cells are stored in the `LoadedCells` global table, with `cellDescription`s as keys. Unlike the players, they get unloaded from memory quite ofen - whenever there are no players in a cell. |
| 60 | +Currently active cells are stored in the `LoadedCells` global table, with `cellDescription`s as keys. Unlike the players, they get unloaded from memory quite often - whenever there are no players in a cell. |
61 | 61 |
|
62 | 62 | Remove all pillows from a cell, whenever it is loaded
|
63 | 63 | ```Lua
|
|
0 commit comments