summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/io/networked_multiplayer_peer.cpp17
-rw-r--r--core/io/networked_multiplayer_peer.h17
-rw-r--r--core/script_language.h18
3 files changed, 42 insertions, 10 deletions
diff --git a/core/io/networked_multiplayer_peer.cpp b/core/io/networked_multiplayer_peer.cpp
index 851064b6e8..a771ba06b7 100644
--- a/core/io/networked_multiplayer_peer.cpp
+++ b/core/io/networked_multiplayer_peer.cpp
@@ -5,14 +5,16 @@ void NetworkedMultiplayerPeer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_transfer_mode","mode"), &NetworkedMultiplayerPeer::set_transfer_mode );
ObjectTypeDB::bind_method(_MD("set_target_peer","id"), &NetworkedMultiplayerPeer::set_target_peer );
- ObjectTypeDB::bind_method(_MD("set_channel","id"), &NetworkedMultiplayerPeer::set_channel );
ObjectTypeDB::bind_method(_MD("get_packet_peer"), &NetworkedMultiplayerPeer::get_packet_peer );
- ObjectTypeDB::bind_method(_MD("get_packet_channel"), &NetworkedMultiplayerPeer::get_packet_channel );
ObjectTypeDB::bind_method(_MD("poll"), &NetworkedMultiplayerPeer::poll );
ObjectTypeDB::bind_method(_MD("get_connection_status"), &NetworkedMultiplayerPeer::get_connection_status );
+ ObjectTypeDB::bind_method(_MD("get_unique_id"), &NetworkedMultiplayerPeer::get_unique_id );
+
+ ObjectTypeDB::bind_method(_MD("set_refuse_new_connections","enable"), &NetworkedMultiplayerPeer::set_refuse_new_connections );
+ ObjectTypeDB::bind_method(_MD("is_refusing_new_connections"), &NetworkedMultiplayerPeer::is_refusing_new_connections );
BIND_CONSTANT( TRANSFER_MODE_UNRELIABLE );
BIND_CONSTANT( TRANSFER_MODE_RELIABLE );
@@ -22,8 +24,15 @@ void NetworkedMultiplayerPeer::_bind_methods() {
BIND_CONSTANT( CONNECTION_CONNECTING );
BIND_CONSTANT( CONNECTION_CONNECTED );
- ADD_SIGNAL( MethodInfo("peer_connected",PropertyInfo(Variant::STRING,"id")));
- ADD_SIGNAL( MethodInfo("peer_disconnected",PropertyInfo(Variant::STRING,"id")));
+ BIND_CONSTANT( TARGET_PEER_BROADCAST );
+ BIND_CONSTANT( TARGET_PEER_SERVER );
+
+
+ ADD_SIGNAL( MethodInfo("peer_connected",PropertyInfo(Variant::INT,"id")));
+ ADD_SIGNAL( MethodInfo("peer_disconnected",PropertyInfo(Variant::INT,"id")));
+ ADD_SIGNAL( MethodInfo("server_disconnected"));
+ ADD_SIGNAL( MethodInfo("connection_succeeded") );
+ ADD_SIGNAL( MethodInfo("connection_failed") );
}
NetworkedMultiplayerPeer::NetworkedMultiplayerPeer() {
diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h
index 7071a52d7b..1c39096ab5 100644
--- a/core/io/networked_multiplayer_peer.h
+++ b/core/io/networked_multiplayer_peer.h
@@ -11,6 +11,10 @@ protected:
static void _bind_methods();
public:
+ enum {
+ TARGET_PEER_BROADCAST=0,
+ TARGET_PEER_SERVER=1
+ };
enum TransferMode {
TRANSFER_MODE_UNRELIABLE,
TRANSFER_MODE_RELIABLE,
@@ -25,17 +29,20 @@ public:
virtual void set_transfer_mode(TransferMode p_mode)=0;
- virtual void set_target_peer(const StringName& p_peer_id)=0;
- virtual void set_channel(int p_channel)=0;
-
+ virtual void set_target_peer(int p_peer_id)=0;
- virtual StringName get_packet_peer() const=0;
- virtual int get_packet_channel() const=0;
+ virtual int get_packet_peer() const=0;
virtual bool is_server() const=0;
virtual void poll()=0;
+ virtual int get_unique_id() const=0;
+
+ virtual void set_refuse_new_connections(bool p_enable)=0;
+ virtual bool is_refusing_new_connections() const=0;
+
+
virtual ConnectionStatus get_connection_status() const=0;
NetworkedMultiplayerPeer();
diff --git a/core/script_language.h b/core/script_language.h
index 0e3f298790..aac94bb067 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -113,7 +113,7 @@ public:
virtual bool get_property_default_value(const StringName& p_property,Variant& r_value) const=0;
virtual void update_exports() {} //editor tool
- virtual void get_method_list(List<MethodInfo> *p_list) const=0;
+ virtual void get_script_method_list(List<MethodInfo> *p_list) const=0;
Script() {}
@@ -121,6 +121,8 @@ public:
class ScriptInstance {
public:
+
+
virtual bool set(const StringName& p_name, const Variant& p_value)=0;
virtual bool get(const StringName& p_name, Variant &r_ret) const=0;
virtual void get_property_list(List<PropertyInfo> *p_properties) const=0;
@@ -148,6 +150,17 @@ public:
virtual bool is_placeholder() const { return false; }
+ enum RPCMode {
+ RPC_MODE_DISABLED,
+ RPC_MODE_REMOTE,
+ RPC_MODE_SYNC,
+ RPC_MODE_MASTER,
+ RPC_MODE_SLAVE,
+ };
+
+ virtual RPCMode get_rpc_mode(const StringName& p_method) const=0;
+ virtual RPCMode get_rset_mode(const StringName& p_variable) const=0;
+
virtual ScriptLanguage *get_language()=0;
virtual ~ScriptInstance();
};
@@ -279,6 +292,9 @@ public:
virtual bool is_placeholder() const { return true; }
+ virtual RPCMode get_rpc_mode(const StringName& p_method) const { return RPC_MODE_DISABLED; }
+ virtual RPCMode get_rset_mode(const StringName& p_variable) const { return RPC_MODE_DISABLED; }
+
PlaceHolderScriptInstance(ScriptLanguage *p_language, Ref<Script> p_script,Object *p_owner);
~PlaceHolderScriptInstance();