mirror of
https://github.com/godotengine/godot-visual-script.git
synced 2026-01-04 18:10:07 +03:00
Refactor RPCMode enum and checks
This commit is contained in:
@@ -1971,11 +1971,11 @@ Ref<Script> VisualScriptInstance::get_script() const {
|
|||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptInstance::RPCMode VisualScriptInstance::get_rpc_mode(const StringName &p_method) const {
|
MultiplayerAPI::RPCMode VisualScriptInstance::get_rpc_mode(const StringName &p_method) const {
|
||||||
|
|
||||||
const Map<StringName, VisualScript::Function>::Element *E = script->functions.find(p_method);
|
const Map<StringName, VisualScript::Function>::Element *E = script->functions.find(p_method);
|
||||||
if (!E) {
|
if (!E) {
|
||||||
return RPC_MODE_DISABLED;
|
return MultiplayerAPI::RPC_MODE_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (E->get().function_id >= 0 && E->get().nodes.has(E->get().function_id)) {
|
if (E->get().function_id >= 0 && E->get().nodes.has(E->get().function_id)) {
|
||||||
@@ -1987,12 +1987,12 @@ ScriptInstance::RPCMode VisualScriptInstance::get_rpc_mode(const StringName &p_m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RPC_MODE_DISABLED;
|
return MultiplayerAPI::RPC_MODE_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptInstance::RPCMode VisualScriptInstance::get_rset_mode(const StringName &p_variable) const {
|
MultiplayerAPI::RPCMode VisualScriptInstance::get_rset_mode(const StringName &p_variable) const {
|
||||||
|
|
||||||
return RPC_MODE_DISABLED;
|
return MultiplayerAPI::RPC_MODE_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_owner) {
|
void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_owner) {
|
||||||
|
|||||||
@@ -433,8 +433,8 @@ public:
|
|||||||
|
|
||||||
virtual ScriptLanguage *get_language();
|
virtual ScriptLanguage *get_language();
|
||||||
|
|
||||||
virtual RPCMode get_rpc_mode(const StringName &p_method) const;
|
virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const;
|
||||||
virtual RPCMode get_rset_mode(const StringName &p_variable) const;
|
virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const;
|
||||||
|
|
||||||
VisualScriptInstance();
|
VisualScriptInstance();
|
||||||
~VisualScriptInstance();
|
~VisualScriptInstance();
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ bool VisualScriptFunction::_set(const StringName &p_name, const Variant &p_value
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p_name == "rpc/mode") {
|
if (p_name == "rpc/mode") {
|
||||||
rpc_mode = ScriptInstance::RPCMode(int(p_value));
|
rpc_mode = MultiplayerAPI::RPCMode(int(p_value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,11 +267,11 @@ int VisualScriptFunction::get_argument_count() const {
|
|||||||
return arguments.size();
|
return arguments.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptFunction::set_rpc_mode(ScriptInstance::RPCMode p_mode) {
|
void VisualScriptFunction::set_rpc_mode(MultiplayerAPI::RPCMode p_mode) {
|
||||||
rpc_mode = p_mode;
|
rpc_mode = p_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptInstance::RPCMode VisualScriptFunction::get_rpc_mode() const {
|
MultiplayerAPI::RPCMode VisualScriptFunction::get_rpc_mode() const {
|
||||||
return rpc_mode;
|
return rpc_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +319,7 @@ VisualScriptFunction::VisualScriptFunction() {
|
|||||||
stack_size = 256;
|
stack_size = 256;
|
||||||
stack_less = false;
|
stack_less = false;
|
||||||
sequenced = true;
|
sequenced = true;
|
||||||
rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
|
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptFunction::set_stack_less(bool p_enable) {
|
void VisualScriptFunction::set_stack_less(bool p_enable) {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class VisualScriptFunction : public VisualScriptNode {
|
|||||||
|
|
||||||
bool stack_less;
|
bool stack_less;
|
||||||
int stack_size;
|
int stack_size;
|
||||||
ScriptInstance::RPCMode rpc_mode;
|
MultiplayerAPI::RPCMode rpc_mode;
|
||||||
bool sequenced;
|
bool sequenced;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -93,8 +93,8 @@ public:
|
|||||||
void set_return_type(Variant::Type p_type);
|
void set_return_type(Variant::Type p_type);
|
||||||
Variant::Type get_return_type() const;
|
Variant::Type get_return_type() const;
|
||||||
|
|
||||||
void set_rpc_mode(ScriptInstance::RPCMode p_mode);
|
void set_rpc_mode(MultiplayerAPI::RPCMode p_mode);
|
||||||
ScriptInstance::RPCMode get_rpc_mode() const;
|
MultiplayerAPI::RPCMode get_rpc_mode() const;
|
||||||
|
|
||||||
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
|
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user