Files
BMagnu 272d6261c4 Generic Lua Multiplayer RPC (#4835)
* Add automatic lua obj serialization function dispatch

* Implement fundamental and object de/serialization

* Proper default case for package deserialization

* Add No Multi func

* Add Serialization part

* Fix max encoding size for userdata

* Implement exception handling

* Start Implementing lua RPC

* Prepare waitAsync for RPC

* Add packet order enforcing and forwarding

* Add RPC registry

* Make RPCs callable

* Add waitRPC

* Add serializers

* Fix GCC error

* Explicitly specify lua_net_exception

* Fix Warnings

* Replace Seriliaze fundamental with cross-platform data types

* Appease Clang

* Prevent serialization CTD on invalid objects

* Actually use the temporaries assigned

* Fix OSWPT shadow

* Fix table deserialize order

* Incorporate Feedback

* Fix Warnigs

* ix WArnings 2

* Add sanity checks for OSWPT wing serialization

* Multi Bump

* Forgot we have american-style dates there
2023-03-28 03:07:03 +09:00

20 lines
718 B
C++

#pragma once
#include "network/multi.h"
#include "scripting/api/objs/rpc.h"
#include <exception>
constexpr uint16_t lua_net_bitmask_rpchash = 0b0001111111111111U;
constexpr uint16_t lua_net_bitmask_ordered = 1U << 13U;
constexpr uint16_t lua_net_bitmask_server = 1U << 14U;
constexpr uint16_t lua_net_bitmask_client = 1U << 15U;
enum class lua_net_mode : uint8_t { RELIABLE, ORDERED, UNRELIABLE };
enum class lua_net_reciever : uint8_t { CLIENTS, SERVER, BOTH };
void process_lua_packet(ubyte* data, header* hinfo, bool reliable);
bool send_lua_packet(const luacpp::LuaValue& value, ushort target, lua_net_mode mode, lua_net_reciever reciever);
bool add_rpc(scripting::api::rpc_h_ref ref);
void clean_rpc_refs();