File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ impl ServerPuppet {
4747 #[ method]
4848 fn on_connected_to_server ( & mut self , #[ base] owner : TRef < Node > ) {
4949 owner. rpc ( "greet_server" , & [ Variant :: new ( "hello" ) ] ) ;
50+ owner. rset ( "foo" , 42 ) ;
5051 }
5152
5253 #[ method( rpc = "puppet" ) ]
Original file line number Diff line number Diff line change @@ -8,12 +8,15 @@ const OUT_BANDWIDTH: i64 = 1000;
88
99#[ derive( NativeClass ) ]
1010#[ inherit( Node ) ]
11- pub struct Server ;
11+ pub struct Server {
12+ #[ property( rpc = "master" , set = "Self::set_foo" ) ]
13+ foo : i32 ,
14+ }
1215
1316#[ methods]
1417impl Server {
1518 fn new ( _owner : & Node ) -> Self {
16- Self
19+ Self { foo : 0 }
1720 }
1821
1922 #[ method]
@@ -41,4 +44,10 @@ impl Server {
4144 & [ Variant :: new ( "hello" ) ] ,
4245 ) ;
4346 }
47+
48+ #[ method]
49+ fn set_foo ( & mut self , #[ base] _owner : TRef < Node > , value : i32 ) {
50+ godot_print ! ( "Client sets foo to: {}" , value) ;
51+ self . foo = value;
52+ }
4453}
You can’t perform that action at this time.
0 commit comments