Add some sync object functions [build]
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run

This commit is contained in:
Agent X 2025-05-26 14:51:57 -04:00
parent 625646aeeb
commit 3795e5afbc
6 changed files with 121 additions and 2 deletions

View file

@ -77,7 +77,8 @@ in_files = [
"src/game/first_person_cam.h",
"src/engine/behavior_script.h",
"src/audio/seqplayer.h",
"src/engine/lighting_engine.h"
"src/engine/lighting_engine.h",
"src/pc/network/sync_object.h"
]
override_allowed_functions = {
@ -95,7 +96,8 @@ override_allowed_functions = {
"src/game/area.h": [ "get_mario_spawn_type", "area_get_warp_node", "area_get_any_warp_node", "play_transition" ],
"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/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" ]
}
override_disallowed_functions = {

View file

@ -11671,6 +11671,20 @@ function surface_has_force(surfaceType)
-- ...
end
--- @param syncId integer
--- @return boolean
--- Checks if a sync object is initialized using a `syncId`
function sync_object_is_initialized(syncId)
-- ...
end
--- @param syncId integer
--- @return boolean
--- Checks if a sync object is owned locally using a `syncId`
function sync_object_is_owned_locally(syncId)
-- ...
end
--- @alias Pointer_integer integer
--- @alias Pointer_BehaviorScript BehaviorScript
--- @alias Pointer_number number

View file

@ -7115,6 +7115,58 @@ Checks if a surface has force
<br />
---
# functions from sync_object.h
<br />
## [sync_object_is_initialized](#sync_object_is_initialized)
### Description
Checks if a sync object is initialized using a `syncId`
### Lua Example
`local booleanValue = sync_object_is_initialized(syncId)`
### Parameters
| Field | Type |
| ----- | ---- |
| syncId | `integer` |
### Returns
- `boolean`
### C Prototype
`bool sync_object_is_initialized(u32 syncId);`
[:arrow_up_small:](#)
<br />
## [sync_object_is_owned_locally](#sync_object_is_owned_locally)
### Description
Checks if a sync object is owned locally using a `syncId`
### Lua Example
`local booleanValue = sync_object_is_owned_locally(syncId)`
### Parameters
| Field | Type |
| ----- | ---- |
| syncId | `integer` |
### Returns
- `boolean`
### C Prototype
`bool sync_object_is_owned_locally(u32 syncId);`
[:arrow_up_small:](#)
<br />
---
[< prev](functions-5.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | [5](functions-5.md) | 6]

View file

@ -2108,6 +2108,12 @@
<br />
- sync_object.h
- [sync_object_is_initialized](functions-6.md#sync_object_is_initialized)
- [sync_object_is_owned_locally](functions-6.md#sync_object_is_owned_locally)
<br />
---
# manually written functions

View file

@ -52,6 +52,7 @@
#include "src/engine/behavior_script.h"
#include "src/audio/seqplayer.h"
#include "src/engine/lighting_engine.h"
#include "src/pc/network/sync_object.h"
///////////////
@ -34925,6 +34926,44 @@ int smlua_func_surface_has_force(lua_State* L) {
return 1;
}
///////////////////
// sync_object.h //
///////////////////
int smlua_func_sync_object_is_initialized(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_is_initialized", 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_is_initialized"); return 0; }
lua_pushboolean(L, sync_object_is_initialized(syncId));
return 1;
}
int smlua_func_sync_object_is_owned_locally(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_is_owned_locally", 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_is_owned_locally"); return 0; }
lua_pushboolean(L, sync_object_is_owned_locally(syncId));
return 1;
}
void smlua_bind_functions_autogen(void) {
@ -36921,4 +36960,8 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "obj_get_surface_from_index", smlua_func_obj_get_surface_from_index);
smlua_bind_function(L, "surface_has_force", smlua_func_surface_has_force);
// sync_object.h
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

@ -60,7 +60,9 @@ struct SyncObject* sync_object_get(u32 syncId);
struct SyncObject* sync_object_get_first(void);
struct SyncObject* sync_object_get_next(void);
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);
/* |description|Checks if a sync object is owned locally using a `syncId`|descriptionEnd| */
bool sync_object_is_owned_locally(u32 syncId);
struct Packet* sync_object_get_last_reliable_packet(u32 syncId);