From 34d28ffb3c89c68c2a77a31959785e3fefbc0e9c Mon Sep 17 00:00:00 2001 From: MysterD Date: Wed, 30 Mar 2022 20:03:59 -0700 Subject: [PATCH] Ran autogen --- autogen/lua_definitions/functions.lua | 23 ++++++++ docs/lua/functions.md | 82 +++++++++++++++++++++++++++ src/pc/lua/smlua_functions_autogen.c | 50 ++++++++++++++++ 3 files changed, 155 insertions(+) diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 489f44a07..454593119 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -2136,6 +2136,11 @@ function is_nearest_player_to_object(m, obj) -- ... end +--- @return integer +function is_other_player_active() + -- ... +end + --- @param m MarioState --- @return integer function is_player_active(m) @@ -2167,6 +2172,18 @@ function is_point_within_radius_of_mario(x, y, z, dist) -- ... end +--- @param obj Object +--- @return MarioState +function nearest_interacting_mario_state_to_object(obj) + -- ... +end + +--- @param obj Object +--- @return Object +function nearest_interacting_player_to_object(obj) + -- ... +end + --- @param obj Object --- @return MarioState function nearest_mario_state_to_object(obj) @@ -3499,6 +3516,12 @@ function enable_time_stop_including_mario() -- ... end +--- @param behavior Pointer_BehaviorScript +--- @return Object +function find_object_with_behavior(behavior) + -- ... +end + --- @return Object function find_unimportant_object() -- ... diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 684218e5e..2e8274660 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -398,10 +398,13 @@ - [current_mario_room_check](#current_mario_room_check) - [is_nearest_mario_state_to_object](#is_nearest_mario_state_to_object) - [is_nearest_player_to_object](#is_nearest_player_to_object) + - [is_other_player_active](#is_other_player_active) - [is_player_active](#is_player_active) - [is_player_in_local_area](#is_player_in_local_area) - [is_point_close_to_object](#is_point_close_to_object) - [is_point_within_radius_of_mario](#is_point_within_radius_of_mario) + - [nearest_interacting_mario_state_to_object](#nearest_interacting_mario_state_to_object) + - [nearest_interacting_player_to_object](#nearest_interacting_player_to_object) - [nearest_mario_state_to_object](#nearest_mario_state_to_object) - [nearest_player_to_object](#nearest_player_to_object) - [obj_check_floor_death](#obj_check_floor_death) @@ -618,6 +621,7 @@ - [enable_time_stop](#enable_time_stop) - [enable_time_stop_if_alone](#enable_time_stop_if_alone) - [enable_time_stop_including_mario](#enable_time_stop_including_mario) + - [find_object_with_behavior](#find_object_with_behavior) - [find_unimportant_object](#find_unimportant_object) - [geo_offset_klepto_debug](#geo_offset_klepto_debug) - [get_object_list_from_behavior](#get_object_list_from_behavior) @@ -7431,6 +7435,24 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
+## [is_other_player_active](#is_other_player_active) + +### Lua Example +`local integerValue = is_other_player_active()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`u8 is_other_player_active(void);` + +[:arrow_up_small:](#) + +
+ ## [is_player_active](#is_player_active) ### Lua Example @@ -7518,6 +7540,46 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
+## [nearest_interacting_mario_state_to_object](#nearest_interacting_mario_state_to_object) + +### Lua Example +`local MarioStateValue = nearest_interacting_mario_state_to_object(obj)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | + +### Returns +[MarioState](structs.md#MarioState) + +### C Prototype +`struct MarioState *nearest_interacting_mario_state_to_object(struct Object *obj);` + +[:arrow_up_small:](#) + +
+ +## [nearest_interacting_player_to_object](#nearest_interacting_player_to_object) + +### Lua Example +`local ObjectValue = nearest_interacting_player_to_object(obj)` + +### Parameters +| Field | Type | +| ----- | ---- | +| obj | [Object](structs.md#Object) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *nearest_interacting_player_to_object(struct Object *obj);` + +[:arrow_up_small:](#) + +
+ ## [nearest_mario_state_to_object](#nearest_mario_state_to_object) ### Lua Example @@ -11701,6 +11763,26 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
+## [find_object_with_behavior](#find_object_with_behavior) + +### Lua Example +`local ObjectValue = find_object_with_behavior(behavior)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behavior | `Pointer` <`BehaviorScript`> | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *find_object_with_behavior(const BehaviorScript *behavior);` + +[:arrow_up_small:](#) + +
+ ## [find_unimportant_object](#find_unimportant_object) ### Lua Example diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 6994fee0e..5d1e6702e 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -4924,6 +4924,16 @@ int smlua_func_is_nearest_player_to_object(lua_State* L) { return 1; } +int smlua_func_is_other_player_active(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + extern u8 is_other_player_active(void); + lua_pushinteger(L, is_other_player_active()); + + return 1; +} + int smlua_func_is_player_active(lua_State* L) { if(!smlua_functions_valid_param_count(L, 1)) { return 0; } @@ -4986,6 +4996,30 @@ int smlua_func_is_point_within_radius_of_mario(lua_State* L) { return 1; } +int smlua_func_nearest_interacting_mario_state_to_object(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); + if (!gSmLuaConvertSuccess) { return 0; } + + extern struct MarioState *nearest_interacting_mario_state_to_object(struct Object *obj); + smlua_push_object(L, LOT_MARIOSTATE, nearest_interacting_mario_state_to_object(obj)); + + return 1; +} + +int smlua_func_nearest_interacting_player_to_object(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); + if (!gSmLuaConvertSuccess) { return 0; } + + extern struct Object *nearest_interacting_player_to_object(struct Object *obj); + smlua_push_object(L, LOT_OBJECT, nearest_interacting_player_to_object(obj)); + + return 1; +} + int smlua_func_nearest_mario_state_to_object(lua_State* L) { if(!smlua_functions_valid_param_count(L, 1)) { return 0; } @@ -7686,6 +7720,18 @@ int smlua_func_enable_time_stop_including_mario(UNUSED lua_State* L) { return 1; } +int smlua_func_find_object_with_behavior(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + const BehaviorScript* behavior = (const BehaviorScript*)smlua_to_cpointer(L, 1, LVT_BEHAVIORSCRIPT_P); + if (!gSmLuaConvertSuccess) { return 0; } + + extern struct Object *find_object_with_behavior(const BehaviorScript *behavior); + smlua_push_object(L, LOT_OBJECT, find_object_with_behavior(behavior)); + + return 1; +} + int smlua_func_find_unimportant_object(UNUSED lua_State* L) { if(!smlua_functions_valid_param_count(L, 0)) { return 0; } @@ -10328,10 +10374,13 @@ void smlua_bind_functions_autogen(void) { //smlua_bind_function(L, "geo_obj_transparency_something", smlua_func_geo_obj_transparency_something); <--- UNIMPLEMENTED smlua_bind_function(L, "is_nearest_mario_state_to_object", smlua_func_is_nearest_mario_state_to_object); smlua_bind_function(L, "is_nearest_player_to_object", smlua_func_is_nearest_player_to_object); + smlua_bind_function(L, "is_other_player_active", smlua_func_is_other_player_active); smlua_bind_function(L, "is_player_active", smlua_func_is_player_active); smlua_bind_function(L, "is_player_in_local_area", smlua_func_is_player_in_local_area); smlua_bind_function(L, "is_point_close_to_object", smlua_func_is_point_close_to_object); smlua_bind_function(L, "is_point_within_radius_of_mario", smlua_func_is_point_within_radius_of_mario); + smlua_bind_function(L, "nearest_interacting_mario_state_to_object", smlua_func_nearest_interacting_mario_state_to_object); + smlua_bind_function(L, "nearest_interacting_player_to_object", smlua_func_nearest_interacting_player_to_object); smlua_bind_function(L, "nearest_mario_state_to_object", smlua_func_nearest_mario_state_to_object); smlua_bind_function(L, "nearest_player_to_object", smlua_func_nearest_player_to_object); smlua_bind_function(L, "obj_check_floor_death", smlua_func_obj_check_floor_death); @@ -10545,6 +10594,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "enable_time_stop", smlua_func_enable_time_stop); smlua_bind_function(L, "enable_time_stop_if_alone", smlua_func_enable_time_stop_if_alone); smlua_bind_function(L, "enable_time_stop_including_mario", smlua_func_enable_time_stop_including_mario); + smlua_bind_function(L, "find_object_with_behavior", smlua_func_find_object_with_behavior); smlua_bind_function(L, "find_unimportant_object", smlua_func_find_unimportant_object); smlua_bind_function(L, "geo_offset_klepto_debug", smlua_func_geo_offset_klepto_debug); //smlua_bind_function(L, "geo_offset_klepto_held_object", smlua_func_geo_offset_klepto_held_object); <--- UNIMPLEMENTED