This mod renders a clock in the top-right corner
and is always available (disabled by default).
It is useful to have a mod available by default
as we work on mod support.
We may want to migrate this to 1 file per monster but for now the
migration is as close to the hard-coded version as possible.
Sprites that are used by multiple monsters are only loaded from disk
once.
1. `Events` global is replaced with `require('devilutionx.events')`.
2. Table is simplified and documented.
3. `On` removed from the event names as it was a bit redundant.
4. Functions are camelCase for consistency (e.g. `add` instead of
`Add`).
Example script:
```lua
local events = require("devilutionx.events")
local render = require("devilutionx.render")
local message = require("devilutionx.message")
local function greet()
message("Hello from " .. _VERSION)
print("Hello from ", _VERSION)
end
events.GameStart.add(greet)
local function drawGreet()
render.string("Hello from " .. _VERSION, 10, 40)
end
events.GameDrawComplete.add(drawGreet)
```
Runs lua/repl_prelude.lua at console initialization.
The default prelude contains global assignments for all devilutionx
modules. This should save us on typing.
Enabled only in Debug mode.
Runs Lua similar to the `lua` CLI.
Supports multiline input with Shift+Enter.
Missing features:
1. Scrollback.
2. Input history on up/down.
Open with backtick, close with Esc.
Also added an iterator based API, though it's not useful for this use-case. Might be nice in the future?
The field/record iterators is single-pass input iterators with shared state.
To avoid rescanning fields unnecessarily parseInt currently can only be called once, it would be possible to make these iterators bidirectional with a bit of extra state (holding onto the start pointer)
Co-authored-by: Gleb Mazovetskiy <glex.spb@gmail.com>
We want to be able to use unpacked MPQs on low-end platforms
(PS2/rg99/etc).
This is tricky on case-sensitive filesystems. Avoids case issues by
lowercasing all paths in the code (then we'll just need lowercased
listfiles).