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 {
47
47
#[ method]
48
48
fn on_connected_to_server ( & mut self , #[ base] owner : TRef < Node > ) {
49
49
owner. rpc ( "greet_server" , & [ Variant :: new ( "hello" ) ] ) ;
50
+ owner. rset ( "foo" , 42 ) ;
50
51
}
51
52
52
53
#[ method( rpc = "puppet" ) ]
Original file line number Diff line number Diff line change @@ -8,12 +8,15 @@ const OUT_BANDWIDTH: i64 = 1000;
8
8
9
9
#[ derive( NativeClass ) ]
10
10
#[ inherit( Node ) ]
11
- pub struct Server ;
11
+ pub struct Server {
12
+ #[ property( rpc = "master" , set = "Self::set_foo" ) ]
13
+ foo : i32 ,
14
+ }
12
15
13
16
#[ methods]
14
17
impl Server {
15
18
fn new ( _owner : & Node ) -> Self {
16
- Self
19
+ Self { foo : 0 }
17
20
}
18
21
19
22
#[ method]
@@ -41,4 +44,10 @@ impl Server {
41
44
& [ Variant :: new ( "hello" ) ] ,
42
45
) ;
43
46
}
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
+ }
44
53
}
You can’t perform that action at this time.
0 commit comments