Expose sync_object_get_object

This commit is contained in:
Agent X 2025-05-29 11:31:31 -04:00
parent dd13da2a0d
commit feba35b010
6 changed files with 51 additions and 1 deletions

View File

@ -97,7 +97,7 @@ override_allowed_functions = {
"src/engine/level_script.h": [ "area_create_warp_node" ],
"src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color", "set_menu_mode", "create_dialog_box", "create_dialog_box_with_var", "create_dialog_inverted_box", "create_dialog_box_with_response", "reset_dialog_render_state", "set_dialog_box_state", ],
"src/audio/seqplayer.h": [ "sequence_player_set_tempo", "sequence_player_set_tempo_acc", "sequence_player_set_transposition", "sequence_player_get_tempo", "sequence_player_get_tempo_acc", "sequence_player_get_transposition", "sequence_player_get_volume", "sequence_player_get_fade_volume", "sequence_player_get_mute_volume_scale" ],
"src/pc/network/sync_object.h": [ "sync_object_is_initialized", "sync_object_is_owned_locally" ]
"src/pc/network/sync_object.h": [ "sync_object_is_initialized", "sync_object_is_owned_locally", "sync_object_get_object" ]
}
override_disallowed_functions = {

View File

@ -11722,6 +11722,13 @@ function surface_has_force(surfaceType)
-- ...
end
--- @param syncId integer
--- @return Object
--- Retrieves an object from a sync ID
function sync_object_get_object(syncId)
-- ...
end
--- @param syncId integer
--- @return boolean
--- Checks if a sync object is initialized using a `syncId`

View File

@ -7413,6 +7413,29 @@ Checks if a surface has force
<br />
## [sync_object_get_object](#sync_object_get_object)
### Description
Retrieves an object from a sync ID
### Lua Example
`local ObjectValue = sync_object_get_object(syncId)`
### Parameters
| Field | Type |
| ----- | ---- |
| syncId | `integer` |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object* sync_object_get_object(u32 syncId);`
[:arrow_up_small:](#)
<br />
## [sync_object_is_initialized](#sync_object_is_initialized)
### Description

View File

@ -2115,6 +2115,7 @@
<br />
- sync_object.h
- [sync_object_get_object](functions-6.md#sync_object_get_object)
- [sync_object_is_initialized](functions-6.md#sync_object_is_initialized)
- [sync_object_is_owned_locally](functions-6.md#sync_object_is_owned_locally)

View File

@ -35167,6 +35167,23 @@ int smlua_func_surface_has_force(lua_State* L) {
// sync_object.h //
///////////////////
int smlua_func_sync_object_get_object(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 1) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "sync_object_get_object", 1, top);
return 0;
}
u32 syncId = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sync_object_get_object"); return 0; }
smlua_push_object(L, LOT_OBJECT, sync_object_get_object(syncId), NULL);
return 1;
}
int smlua_func_sync_object_is_initialized(lua_State* L) {
if (L == NULL) { return 0; }
@ -37204,6 +37221,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "surface_has_force", smlua_func_surface_has_force);
// sync_object.h
smlua_bind_function(L, "sync_object_get_object", smlua_func_sync_object_get_object);
smlua_bind_function(L, "sync_object_is_initialized", smlua_func_sync_object_is_initialized);
smlua_bind_function(L, "sync_object_is_owned_locally", smlua_func_sync_object_is_owned_locally);

View File

@ -59,6 +59,7 @@ void sync_object_init_field_with_size(struct Object *o, void* field, u8 size);
struct SyncObject* sync_object_get(u32 syncId);
struct SyncObject* sync_object_get_first(void);
struct SyncObject* sync_object_get_next(void);
/* |description|Retrieves an object from a sync ID|descriptionEnd| */
struct Object* sync_object_get_object(u32 syncId);
/* |description|Checks if a sync object is initialized using a `syncId`|descriptionEnd| */
bool sync_object_is_initialized(u32 syncId);