Curation round 13: grid entities, more enemies, Caves, boss helpers and five bosses, chests and costumes, curses and alt stages, the Lua API
This commit is contained in:
1 parent
f8ce24fc6c
commit
8ae02a8422
160 files changed
+16231
-1689
No files matched your search
@@ -0,0 +1,18 @@
|
||||
#include "classes.h"
|
||||
#include "lua_api.h"
|
||||
#include "seeds.h"
|
||||
|
||||
constexpr RNG LUA_RNG_DEFAULT = {RNG_SEED_DEFAULT, 5, 9, 7};
|
||||
|
||||
// (008bbcf0) Registers Lua's RNG: a default seeded constructor and the game's RNG methods.
|
||||
void lua_api_rng_register(lua_State* state)
|
||||
{
|
||||
lua_class_begin(state, "RNG", LUA_CLASS_RNG);
|
||||
lua_static(state, "__call", [](LuaIgnored) { return LUA_RNG_DEFAULT; });
|
||||
lua_method(state, "GetSeed", [](RNG& rng) { return rng._seed; });
|
||||
lua_method(state, "SetSeed", [](RNG& rng, uint32_t seed, uint32_t shiftIndex) { rng.SetSeed(seed, shiftIndex); });
|
||||
lua_method(state, "RandomInt", [](RNG& rng, uint32_t max) { return rng.RandomInt(max); });
|
||||
lua_method(state, "RandomFloat", [](RNG& rng) { return rng.RandomFloat(); });
|
||||
lua_method(state, "Next", [](RNG& rng) { return rng.Next(); });
|
||||
lua_class_end(state);
|
||||
}
|
||||
Reference in new issue
Block a user