Add reset_level to lua api (#16)

This commit is contained in:
Isaac 2022-03-09 20:11:03 +10:00 committed by GitHub
parent 5e0981824a
commit 09e4345f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -80,6 +80,19 @@ int smlua_func_init_mario_after_warp(lua_State* L) {
return 1;
}
int smlua_func_reset_level(lua_State* L) {
if (network_player_connected_count() >= 2) {
LOG_LUA("This function can only be used in single-player");
return 0;
}
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
gChangeLevel = gCurrLevelNum;
return 1;
}
int smlua_func_network_init_object(lua_State* L) {
if (!smlua_functions_valid_param_count(L, 3)) { return 0; }
@ -172,4 +185,5 @@ void smlua_bind_functions(void) {
smlua_bind_function(L, "init_mario_after_warp", smlua_func_init_mario_after_warp);
smlua_bind_function(L, "network_init_object", smlua_func_network_init_object);
smlua_bind_function(L, "network_send_object", smlua_func_network_send_object);
smlua_bind_function(L, "reset_level", smlua_func_reset_level);
}