mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-30 12:59:18 +01:00
Removed rpc keywords from cscript. Note that networking should still work with it using rset_config (like how it works in engine side code).
This commit is contained in:
parent
73ac91dc86
commit
8611d7d9c8
@ -1284,34 +1284,11 @@ ScriptLanguage *CScriptInstance::get_language() {
|
||||
}
|
||||
|
||||
MultiplayerAPI::RPCMode CScriptInstance::get_rpc_mode(const StringName &p_method) const {
|
||||
const CScript *cscript = script.ptr();
|
||||
|
||||
while (cscript) {
|
||||
const Map<StringName, CScriptFunction *>::Element *E = cscript->member_functions.find(p_method);
|
||||
if (E) {
|
||||
if (E->get()->get_rpc_mode() != MultiplayerAPI::RPC_MODE_DISABLED) {
|
||||
return E->get()->get_rpc_mode();
|
||||
}
|
||||
}
|
||||
cscript = cscript->_base;
|
||||
}
|
||||
|
||||
//note that methods set up using rpc_config should still work, even if they are declared in scripts.
|
||||
return MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
}
|
||||
|
||||
MultiplayerAPI::RPCMode CScriptInstance::get_rset_mode(const StringName &p_variable) const {
|
||||
const CScript *cscript = script.ptr();
|
||||
|
||||
while (cscript) {
|
||||
const Map<StringName, CScript::MemberInfo>::Element *E = cscript->member_indices.find(p_variable);
|
||||
if (E) {
|
||||
if (E->get().rpc_mode) {
|
||||
return E->get().rpc_mode;
|
||||
}
|
||||
}
|
||||
cscript = cscript->_base;
|
||||
}
|
||||
|
||||
return MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
}
|
||||
|
||||
@ -1784,14 +1761,6 @@ void CScriptLanguage::get_reserved_words(List<String> *p_words) const {
|
||||
"return",
|
||||
"match",
|
||||
"while",
|
||||
"remote",
|
||||
"sync",
|
||||
"master",
|
||||
"puppet",
|
||||
"slave",
|
||||
"remotesync",
|
||||
"mastersync",
|
||||
"puppetsync",
|
||||
nullptr
|
||||
};
|
||||
|
||||
|
@ -60,7 +60,6 @@ class CScript : public Script {
|
||||
int index;
|
||||
StringName setter;
|
||||
StringName getter;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
CScriptDataType data_type;
|
||||
};
|
||||
|
||||
|
@ -1729,7 +1729,6 @@ Error CScriptCompiler::_parse_function(CScript *p_script, const CScriptParser::C
|
||||
|
||||
if (p_func) {
|
||||
gdfunc->_static = p_func->_static;
|
||||
gdfunc->rpc_mode = p_func->rpc_mode;
|
||||
gdfunc->argument_types.resize(p_func->argument_types.size());
|
||||
for (int i = 0; i < p_func->argument_types.size(); i++) {
|
||||
gdfunc->argument_types.write[i] = _gdtype_from_datatype(p_func->argument_types[i], p_script);
|
||||
@ -1737,7 +1736,6 @@ Error CScriptCompiler::_parse_function(CScript *p_script, const CScriptParser::C
|
||||
gdfunc->return_type = _gdtype_from_datatype(p_func->return_type, p_script);
|
||||
} else {
|
||||
gdfunc->_static = false;
|
||||
gdfunc->rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
gdfunc->return_type = CScriptDataType();
|
||||
gdfunc->return_type.has_type = true;
|
||||
gdfunc->return_type.kind = CScriptDataType::BUILTIN;
|
||||
@ -1944,7 +1942,6 @@ Error CScriptCompiler::_parse_class_level(CScript *p_script, const CScriptParser
|
||||
minfo.index = p_script->member_indices.size();
|
||||
minfo.setter = p_class->variables[i].setter;
|
||||
minfo.getter = p_class->variables[i].getter;
|
||||
minfo.rpc_mode = p_class->variables[i].rpc_mode;
|
||||
minfo.data_type = _gdtype_from_datatype(p_class->variables[i].data_type, p_script);
|
||||
|
||||
PropertyInfo prop_info = minfo.data_type;
|
||||
|
@ -2195,8 +2195,7 @@ static void _find_identifiers(const CScriptCompletionContext &p_context, bool p_
|
||||
"and", "in", "not", "or", "false", "PI", "TAU", "INF", "NAN", "self", "true", "as", "assert",
|
||||
"breakpoint", "class", "extends", "is", "func", "preload", "setget", "signal", "tool", "yield",
|
||||
"const", "enum", "export", "onready", "static", "var", "break", "continue", "if", "elif",
|
||||
"else", "for", "pass", "return", "match", "while", "remote", "sync", "master", "puppet", "slave",
|
||||
"remotesync", "mastersync", "puppetsync",
|
||||
"else", "for", "pass", "return", "match", "while",
|
||||
nullptr
|
||||
};
|
||||
|
||||
|
@ -1699,7 +1699,6 @@ CScriptFunction::CScriptFunction() :
|
||||
function_list(this) {
|
||||
_stack_size = 0;
|
||||
_call_size = 0;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
name = "<anonymous>";
|
||||
#ifdef DEBUG_ENABLED
|
||||
_func_cname = nullptr;
|
||||
|
@ -246,7 +246,6 @@ private:
|
||||
int _call_size;
|
||||
int _initial_line;
|
||||
bool _static;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
|
||||
CScript *_script;
|
||||
|
||||
@ -355,9 +354,6 @@ public:
|
||||
|
||||
Variant call(CScriptInstance *p_instance, const Variant **p_args, int p_argcount, Variant::CallError &r_err, CallState *p_state = nullptr);
|
||||
|
||||
_FORCE_INLINE_ MultiplayerAPI::RPCMode get_rpc_mode() const {
|
||||
return rpc_mode;
|
||||
}
|
||||
CScriptFunction();
|
||||
~CScriptFunction();
|
||||
};
|
||||
|
@ -4035,8 +4035,6 @@ void CScriptParser::_parse_class(ClassNode *p_class) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
function->arguments_usage = arguments_usage;
|
||||
#endif // DEBUG_ENABLED
|
||||
function->rpc_mode = rpc_mode;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
|
||||
if (name == "_init") {
|
||||
if (_static) {
|
||||
@ -4710,9 +4708,9 @@ void CScriptParser::_parse_class(ClassNode *p_class) {
|
||||
#undef _ADVANCE_AND_CONSUME_NEWLINES
|
||||
}
|
||||
|
||||
if (tokenizer->get_token() != CScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != CScriptTokenizer::TK_PR_ONREADY && tokenizer->get_token() != CScriptTokenizer::TK_PR_REMOTE && tokenizer->get_token() != CScriptTokenizer::TK_PR_MASTER && tokenizer->get_token() != CScriptTokenizer::TK_PR_PUPPET && tokenizer->get_token() != CScriptTokenizer::TK_PR_SYNC && tokenizer->get_token() != CScriptTokenizer::TK_PR_REMOTESYNC && tokenizer->get_token() != CScriptTokenizer::TK_PR_MASTERSYNC && tokenizer->get_token() != CScriptTokenizer::TK_PR_PUPPETSYNC && tokenizer->get_token() != CScriptTokenizer::TK_PR_SLAVE) {
|
||||
if (tokenizer->get_token() != CScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != CScriptTokenizer::TK_PR_ONREADY) {
|
||||
current_export = PropertyInfo();
|
||||
_set_error("Expected \"var\", \"onready\", \"remote\", \"master\", \"puppet\", \"sync\", \"remotesync\", \"mastersync\", \"puppetsync\".");
|
||||
_set_error("Expected \"var\", \"onready\".");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4728,114 +4726,6 @@ void CScriptParser::_parse_class(ClassNode *p_class) {
|
||||
|
||||
continue;
|
||||
} break;
|
||||
case CScriptTokenizer::TK_PR_REMOTE: {
|
||||
//may be fallthrough from export, ignore if so
|
||||
tokenizer->advance();
|
||||
if (current_export.type) {
|
||||
if (tokenizer->get_token() != CScriptTokenizer::TK_PR_VAR) {
|
||||
_set_error("Expected \"var\".");
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (tokenizer->get_token() != CScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != CScriptTokenizer::TK_PR_FUNCTION) {
|
||||
_set_error("Expected \"var\" or \"func\".");
|
||||
return;
|
||||
}
|
||||
}
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_REMOTE;
|
||||
|
||||
continue;
|
||||
} break;
|
||||
case CScriptTokenizer::TK_PR_MASTER: {
|
||||
//may be fallthrough from export, ignore if so
|
||||
tokenizer->advance();
|
||||
if (current_export.type) {
|
||||
if (tokenizer->get_token() != CScriptTokenizer::TK_PR_VAR) {
|
||||
_set_error("Expected \"var\".");
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (tokenizer->get_token() != CScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != CScriptTokenizer::TK_PR_FUNCTION) {
|
||||
_set_error("Expected \"var\" or \"func\".");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_MASTER;
|
||||
continue;
|
||||
} break;
|
||||
case CScriptTokenizer::TK_PR_SLAVE:
|
||||
#ifdef DEBUG_ENABLED
|
||||
_add_warning(CScriptWarning::DEPRECATED_KEYWORD, tokenizer->get_token_line(), "slave", "puppet");
|
||||
#endif
|
||||
FALLTHROUGH;
|
||||
case CScriptTokenizer::TK_PR_PUPPET: {
|
||||
//may be fallthrough from export, ignore if so
|
||||
tokenizer->advance();
|
||||
if (current_export.type) {
|
||||
if (tokenizer->get_token() != CScriptTokenizer::TK_PR_VAR) {
|
||||
_set_error("Expected \"var\".");
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (tokenizer->get_token() != CScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != CScriptTokenizer::TK_PR_FUNCTION) {
|
||||
_set_error("Expected \"var\" or \"func\".");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_PUPPET;
|
||||
continue;
|
||||
} break;
|
||||
case CScriptTokenizer::TK_PR_REMOTESYNC:
|
||||
case CScriptTokenizer::TK_PR_SYNC: {
|
||||
//may be fallthrough from export, ignore if so
|
||||
tokenizer->advance();
|
||||
if (tokenizer->get_token() != CScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != CScriptTokenizer::TK_PR_FUNCTION) {
|
||||
if (current_export.type) {
|
||||
_set_error("Expected \"var\".");
|
||||
} else {
|
||||
_set_error("Expected \"var\" or \"func\".");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_REMOTESYNC;
|
||||
continue;
|
||||
} break;
|
||||
case CScriptTokenizer::TK_PR_MASTERSYNC: {
|
||||
//may be fallthrough from export, ignore if so
|
||||
tokenizer->advance();
|
||||
if (tokenizer->get_token() != CScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != CScriptTokenizer::TK_PR_FUNCTION) {
|
||||
if (current_export.type) {
|
||||
_set_error("Expected \"var\".");
|
||||
} else {
|
||||
_set_error("Expected \"var\" or \"func\".");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_MASTERSYNC;
|
||||
continue;
|
||||
} break;
|
||||
case CScriptTokenizer::TK_PR_PUPPETSYNC: {
|
||||
//may be fallthrough from export, ignore if so
|
||||
tokenizer->advance();
|
||||
if (tokenizer->get_token() != CScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != CScriptTokenizer::TK_PR_FUNCTION) {
|
||||
if (current_export.type) {
|
||||
_set_error("Expected \"var\".");
|
||||
} else {
|
||||
_set_error("Expected \"var\" or \"func\".");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_PUPPETSYNC;
|
||||
continue;
|
||||
} break;
|
||||
case CScriptTokenizer::TK_PR_VAR: {
|
||||
// variable declaration and (eventual) initialization
|
||||
|
||||
@ -4860,7 +4750,6 @@ void CScriptParser::_parse_class(ClassNode *p_class) {
|
||||
member._export.name = member.identifier;
|
||||
member.line = tokenizer->get_token_line();
|
||||
member.usages = 0;
|
||||
member.rpc_mode = rpc_mode;
|
||||
|
||||
if (current_class->constant_expressions.has(member.identifier)) {
|
||||
_set_error("A constant named \"" + String(member.identifier) + "\" already exists in this class (at line: " +
|
||||
@ -4898,8 +4787,6 @@ void CScriptParser::_parse_class(ClassNode *p_class) {
|
||||
#endif // DEBUG_ENABLED
|
||||
tokenizer->advance();
|
||||
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
|
||||
if (tokenizer->get_token() == CScriptTokenizer::TK_COLON) {
|
||||
if (tokenizer->get_token(1) == CScriptTokenizer::TK_OP_ASSIGN) {
|
||||
member.data_type = DataType();
|
||||
@ -8850,7 +8737,6 @@ void CScriptParser::clear() {
|
||||
current_class = nullptr;
|
||||
|
||||
completion_found = false;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
|
||||
current_function = nullptr;
|
||||
|
||||
|
@ -164,7 +164,6 @@ public:
|
||||
int line;
|
||||
Node *expression;
|
||||
OperatorNode *initial_assignment;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
int usages;
|
||||
};
|
||||
|
||||
@ -204,7 +203,6 @@ public:
|
||||
|
||||
struct FunctionNode : public Node {
|
||||
bool _static;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
bool has_yield;
|
||||
bool has_unreachable_code;
|
||||
StringName name;
|
||||
@ -230,7 +228,6 @@ public:
|
||||
FunctionNode() {
|
||||
type = TYPE_FUNCTION;
|
||||
_static = false;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
has_yield = false;
|
||||
has_unreachable_code = false;
|
||||
}
|
||||
@ -593,8 +590,6 @@ private:
|
||||
|
||||
PropertyInfo current_export;
|
||||
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
|
||||
void _set_error(const String &p_error, int p_line = -1, int p_column = -1);
|
||||
#ifdef DEBUG_ENABLED
|
||||
void _add_warning(int p_code, int p_line = -1, const String &p_symbol1 = String(), const String &p_symbol2 = String(), const String &p_symbol3 = String(), const String &p_symbol4 = String());
|
||||
|
@ -106,14 +106,6 @@ const char *CScriptTokenizer::token_names[TK_MAX] = {
|
||||
"yield",
|
||||
"signal",
|
||||
"breakpoint",
|
||||
"rpc",
|
||||
"sync",
|
||||
"master",
|
||||
"puppet",
|
||||
"slave",
|
||||
"remotesync",
|
||||
"mastersync",
|
||||
"puppetsync",
|
||||
"'['",
|
||||
"']'",
|
||||
"'{'",
|
||||
@ -211,14 +203,6 @@ static const _kws _keyword_list[] = {
|
||||
{ CScriptTokenizer::TK_PR_YIELD, "yield" },
|
||||
{ CScriptTokenizer::TK_PR_SIGNAL, "signal" },
|
||||
{ CScriptTokenizer::TK_PR_BREAKPOINT, "breakpoint" },
|
||||
{ CScriptTokenizer::TK_PR_REMOTE, "remote" },
|
||||
{ CScriptTokenizer::TK_PR_MASTER, "master" },
|
||||
{ CScriptTokenizer::TK_PR_SLAVE, "slave" },
|
||||
{ CScriptTokenizer::TK_PR_PUPPET, "puppet" },
|
||||
{ CScriptTokenizer::TK_PR_SYNC, "sync" },
|
||||
{ CScriptTokenizer::TK_PR_REMOTESYNC, "remotesync" },
|
||||
{ CScriptTokenizer::TK_PR_MASTERSYNC, "mastersync" },
|
||||
{ CScriptTokenizer::TK_PR_PUPPETSYNC, "puppetsync" },
|
||||
{ CScriptTokenizer::TK_PR_CONST, "const" },
|
||||
{ CScriptTokenizer::TK_PR_ENUM, "enum" },
|
||||
//controlflow
|
||||
@ -257,13 +241,6 @@ bool CScriptTokenizer::is_token_literal(int p_offset, bool variable_safe) const
|
||||
case TK_PR_EXPORT:
|
||||
case TK_PR_SETGET:
|
||||
case TK_PR_SIGNAL:
|
||||
case TK_PR_REMOTE:
|
||||
case TK_PR_MASTER:
|
||||
case TK_PR_PUPPET:
|
||||
case TK_PR_SYNC:
|
||||
case TK_PR_REMOTESYNC:
|
||||
case TK_PR_MASTERSYNC:
|
||||
case TK_PR_PUPPETSYNC:
|
||||
return true;
|
||||
|
||||
// Literal for non-variables only:
|
||||
|
@ -111,14 +111,6 @@ public:
|
||||
TK_PR_YIELD,
|
||||
TK_PR_SIGNAL,
|
||||
TK_PR_BREAKPOINT,
|
||||
TK_PR_REMOTE,
|
||||
TK_PR_SYNC,
|
||||
TK_PR_MASTER,
|
||||
TK_PR_SLAVE, // Deprecated by TK_PR_PUPPET, to remove in 4.0
|
||||
TK_PR_PUPPET,
|
||||
TK_PR_REMOTESYNC,
|
||||
TK_PR_MASTERSYNC,
|
||||
TK_PR_PUPPETSYNC,
|
||||
TK_BRACKET_OPEN,
|
||||
TK_BRACKET_CLOSE,
|
||||
TK_CURLY_BRACKET_OPEN,
|
||||
|
Loading…
Reference in New Issue
Block a user