Skip to content

Commit feba35b

Browse files
committed
Expose sync_object_get_object
1 parent dd13da2 commit feba35b

6 files changed

Lines changed: 51 additions & 1 deletion

File tree

autogen/convert_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"src/engine/level_script.h": [ "area_create_warp_node" ],
9898
"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", ],
9999
"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" ],
100-
"src/pc/network/sync_object.h": [ "sync_object_is_initialized", "sync_object_is_owned_locally" ]
100+
"src/pc/network/sync_object.h": [ "sync_object_is_initialized", "sync_object_is_owned_locally", "sync_object_get_object" ]
101101
}
102102

103103
override_disallowed_functions = {

autogen/lua_definitions/functions.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11722,6 +11722,13 @@ function surface_has_force(surfaceType)
1172211722
-- ...
1172311723
end
1172411724

11725+
--- @param syncId integer
11726+
--- @return Object
11727+
--- Retrieves an object from a sync ID
11728+
function sync_object_get_object(syncId)
11729+
-- ...
11730+
end
11731+
1172511732
--- @param syncId integer
1172611733
--- @return boolean
1172711734
--- Checks if a sync object is initialized using a `syncId`

docs/lua/functions-6.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7413,6 +7413,29 @@ Checks if a surface has force
74137413
<br />
74147414

74157415

7416+
## [sync_object_get_object](#sync_object_get_object)
7417+
7418+
### Description
7419+
Retrieves an object from a sync ID
7420+
7421+
### Lua Example
7422+
`local ObjectValue = sync_object_get_object(syncId)`
7423+
7424+
### Parameters
7425+
| Field | Type |
7426+
| ----- | ---- |
7427+
| syncId | `integer` |
7428+
7429+
### Returns
7430+
[Object](structs.md#Object)
7431+
7432+
### C Prototype
7433+
`struct Object* sync_object_get_object(u32 syncId);`
7434+
7435+
[:arrow_up_small:](#)
7436+
7437+
<br />
7438+
74167439
## [sync_object_is_initialized](#sync_object_is_initialized)
74177440

74187441
### Description

docs/lua/functions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,6 +2115,7 @@
21152115
<br />
21162116

21172117
- sync_object.h
2118+
- [sync_object_get_object](functions-6.md#sync_object_get_object)
21182119
- [sync_object_is_initialized](functions-6.md#sync_object_is_initialized)
21192120
- [sync_object_is_owned_locally](functions-6.md#sync_object_is_owned_locally)
21202121

src/pc/lua/smlua_functions_autogen.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35167,6 +35167,23 @@ int smlua_func_surface_has_force(lua_State* L) {
3516735167
// sync_object.h //
3516835168
///////////////////
3516935169

35170+
int smlua_func_sync_object_get_object(lua_State* L) {
35171+
if (L == NULL) { return 0; }
35172+
35173+
int top = lua_gettop(L);
35174+
if (top != 1) {
35175+
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "sync_object_get_object", 1, top);
35176+
return 0;
35177+
}
35178+
35179+
u32 syncId = smlua_to_integer(L, 1);
35180+
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sync_object_get_object"); return 0; }
35181+
35182+
smlua_push_object(L, LOT_OBJECT, sync_object_get_object(syncId), NULL);
35183+
35184+
return 1;
35185+
}
35186+
3517035187
int smlua_func_sync_object_is_initialized(lua_State* L) {
3517135188
if (L == NULL) { return 0; }
3517235189

@@ -37204,6 +37221,7 @@ void smlua_bind_functions_autogen(void) {
3720437221
smlua_bind_function(L, "surface_has_force", smlua_func_surface_has_force);
3720537222

3720637223
// sync_object.h
37224+
smlua_bind_function(L, "sync_object_get_object", smlua_func_sync_object_get_object);
3720737225
smlua_bind_function(L, "sync_object_is_initialized", smlua_func_sync_object_is_initialized);
3720837226
smlua_bind_function(L, "sync_object_is_owned_locally", smlua_func_sync_object_is_owned_locally);
3720937227

src/pc/network/sync_object.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void sync_object_init_field_with_size(struct Object *o, void* field, u8 size);
5959
struct SyncObject* sync_object_get(u32 syncId);
6060
struct SyncObject* sync_object_get_first(void);
6161
struct SyncObject* sync_object_get_next(void);
62+
/* |description|Retrieves an object from a sync ID|descriptionEnd| */
6263
struct Object* sync_object_get_object(u32 syncId);
6364
/* |description|Checks if a sync object is initialized using a `syncId`|descriptionEnd| */
6465
bool sync_object_is_initialized(u32 syncId);

0 commit comments

Comments
 (0)