mirror of
https://github.com/godotengine/godot-visual-script.git
synced 2026-01-03 10:09:19 +03:00
[Net] Move multiplayer to core subdir, split RPCManager.
Move multiplayer classes to "core/multiplayer" subdir. Move the RPCConfig and enums (TransferMode, RPCMode) to a separate file (multiplayer.h), and bind them to the global namespace. Move the RPC handling code to its own class (RPCManager). Renames "get_rpc_sender_id" to "get_remote_sender_id".
This commit is contained in:
@@ -955,7 +955,7 @@ bool VisualScript::are_subnodes_edited() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
const Vector<MultiplayerAPI::RPCConfig> VisualScript::get_rpc_methods() const {
|
||||
const Vector<Multiplayer::RPCConfig> VisualScript::get_rpc_methods() const {
|
||||
return rpc_functions;
|
||||
}
|
||||
|
||||
@@ -1022,11 +1022,11 @@ void VisualScript::_set_data(const Dictionary &p_data) {
|
||||
if (functions[E].func_id >= 0 && nodes.has(functions[E].func_id)) {
|
||||
Ref<VisualScriptFunction> vsf = nodes[functions[E].func_id].node;
|
||||
if (vsf.is_valid()) {
|
||||
if (vsf->get_rpc_mode() != MultiplayerAPI::RPC_MODE_DISABLED) {
|
||||
MultiplayerAPI::RPCConfig nd;
|
||||
if (vsf->get_rpc_mode() != Multiplayer::RPC_MODE_DISABLED) {
|
||||
Multiplayer::RPCConfig nd;
|
||||
nd.name = E;
|
||||
nd.rpc_mode = vsf->get_rpc_mode();
|
||||
nd.transfer_mode = MultiplayerPeer::TRANSFER_MODE_RELIABLE; // TODO
|
||||
nd.transfer_mode = Multiplayer::TRANSFER_MODE_RELIABLE; // TODO
|
||||
if (rpc_functions.find(nd) == -1) {
|
||||
rpc_functions.push_back(nd);
|
||||
}
|
||||
@@ -1036,7 +1036,7 @@ void VisualScript::_set_data(const Dictionary &p_data) {
|
||||
}
|
||||
|
||||
// Sort so we are 100% that they are always the same.
|
||||
rpc_functions.sort_custom<MultiplayerAPI::SortRPCConfig>();
|
||||
rpc_functions.sort_custom<Multiplayer::SortRPCConfig>();
|
||||
}
|
||||
|
||||
Dictionary VisualScript::_get_data() const {
|
||||
@@ -1833,7 +1833,7 @@ Ref<Script> VisualScriptInstance::get_script() const {
|
||||
return script;
|
||||
}
|
||||
|
||||
const Vector<MultiplayerAPI::RPCConfig> VisualScriptInstance::get_rpc_methods() const {
|
||||
const Vector<Multiplayer::RPCConfig> VisualScriptInstance::get_rpc_methods() const {
|
||||
return script->get_rpc_methods();
|
||||
}
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ private:
|
||||
HashMap<StringName, Function> functions;
|
||||
HashMap<StringName, Variable> variables;
|
||||
Map<StringName, Vector<Argument>> custom_signals;
|
||||
Vector<MultiplayerAPI::RPCConfig> rpc_functions;
|
||||
Vector<Multiplayer::RPCConfig> rpc_functions;
|
||||
|
||||
Map<Object *, VisualScriptInstance *> instances;
|
||||
|
||||
@@ -362,7 +362,7 @@ public:
|
||||
|
||||
virtual int get_member_line(const StringName &p_member) const override;
|
||||
|
||||
virtual const Vector<MultiplayerAPI::RPCConfig> get_rpc_methods() const override;
|
||||
virtual const Vector<Multiplayer::RPCConfig> get_rpc_methods() const override;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual bool are_subnodes_edited() const;
|
||||
@@ -443,7 +443,7 @@ public:
|
||||
|
||||
virtual ScriptLanguage *get_language();
|
||||
|
||||
virtual const Vector<MultiplayerAPI::RPCConfig> get_rpc_methods() const;
|
||||
virtual const Vector<Multiplayer::RPCConfig> get_rpc_methods() const;
|
||||
|
||||
VisualScriptInstance();
|
||||
~VisualScriptInstance();
|
||||
|
||||
@@ -90,7 +90,7 @@ bool VisualScriptFunction::_set(const StringName &p_name, const Variant &p_value
|
||||
}
|
||||
|
||||
if (p_name == "rpc/mode") {
|
||||
rpc_mode = MultiplayerAPI::RPCMode(int(p_value));
|
||||
rpc_mode = Multiplayer::RPCMode(int(p_value));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -261,11 +261,11 @@ int VisualScriptFunction::get_argument_count() const {
|
||||
return arguments.size();
|
||||
}
|
||||
|
||||
void VisualScriptFunction::set_rpc_mode(MultiplayerAPI::RPCMode p_mode) {
|
||||
void VisualScriptFunction::set_rpc_mode(Multiplayer::RPCMode p_mode) {
|
||||
rpc_mode = p_mode;
|
||||
}
|
||||
|
||||
MultiplayerAPI::RPCMode VisualScriptFunction::get_rpc_mode() const {
|
||||
Multiplayer::RPCMode VisualScriptFunction::get_rpc_mode() const {
|
||||
return rpc_mode;
|
||||
}
|
||||
|
||||
@@ -311,14 +311,14 @@ void VisualScriptFunction::reset_state() {
|
||||
stack_size = 256;
|
||||
stack_less = false;
|
||||
sequenced = true;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
rpc_mode = Multiplayer::RPC_MODE_DISABLED;
|
||||
}
|
||||
|
||||
VisualScriptFunction::VisualScriptFunction() {
|
||||
stack_size = 256;
|
||||
stack_less = false;
|
||||
sequenced = true;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
rpc_mode = Multiplayer::RPC_MODE_DISABLED;
|
||||
}
|
||||
|
||||
void VisualScriptFunction::set_stack_less(bool p_enable) {
|
||||
|
||||
@@ -49,7 +49,7 @@ class VisualScriptFunction : public VisualScriptNode {
|
||||
|
||||
bool stack_less;
|
||||
int stack_size;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
Multiplayer::RPCMode rpc_mode;
|
||||
bool sequenced;
|
||||
|
||||
protected:
|
||||
@@ -96,8 +96,8 @@ public:
|
||||
void set_return_type(Variant::Type p_type);
|
||||
Variant::Type get_return_type() const;
|
||||
|
||||
void set_rpc_mode(MultiplayerAPI::RPCMode p_mode);
|
||||
MultiplayerAPI::RPCMode get_rpc_mode() const;
|
||||
void set_rpc_mode(Multiplayer::RPCMode p_mode);
|
||||
Multiplayer::RPCMode get_rpc_mode() const;
|
||||
|
||||
virtual VisualScriptNodeInstance *instantiate(VisualScriptInstance *p_instance) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user