File tree Expand file tree Collapse file tree 7 files changed +40
-10
lines changed
Expand file tree Collapse file tree 7 files changed +40
-10
lines changed Original file line number Diff line number Diff line change 33name =" netfox.extras"
44description =" Game-specific utilities for Netfox"
55author =" Tamas Galffy and contributors"
6- version =" 1.32.2 "
6+ version =" 1.32.3 "
77script =" netfox-extras.gd"
Original file line number Diff line number Diff line change 33name =" netfox.internals"
44description =" Shared internals for netfox addons"
55author =" Tamas Galffy and contributors"
6- version =" 1.32.2 "
6+ version =" 1.32.3 "
77script =" plugin.gd"
Original file line number Diff line number Diff line change 33name =" netfox.noray"
44description =" Bulletproof your connectivity with noray integration for netfox"
55author =" Tamas Galffy and contributors"
6- version =" 1.32.2 "
6+ version =" 1.32.3 "
77script =" netfox-noray.gd"
Original file line number Diff line number Diff line change 33name =" netfox"
44description =" Shared internals for netfox addons"
55author =" Tamas Galffy and contributors"
6- version =" 1.32.2 "
6+ version =" 1.32.3 "
77script =" netfox.gd"
Original file line number Diff line number Diff line change @@ -6,12 +6,16 @@ var _auth_properties: Dictionary = {} # Peer (int) to owned properties (Array[Pr
66
77var local_peer_id : int
88
9+ func clear () -> void :
10+ _properties .clear ()
11+ _auth_properties .clear ()
12+
913func set_properties (p_properties : Array [PropertyEntry ]) -> void :
14+ clear ()
1015 _properties .assign (p_properties )
11- _auth_properties .clear ()
1216
1317func set_properties_from_paths (property_paths : Array [String ], property_cache : PropertyCache ) -> void :
14- _properties . clear ()
18+ clear ()
1519 for path in property_paths :
1620 _properties .append (property_cache .get_entry (path ))
1721
Original file line number Diff line number Diff line change @@ -32,6 +32,25 @@ func suite():
3232 expect_empty (config .get_properties_owned_by (LOCAL_PEER ))
3333 )
3434
35+ test ("should get remote owned properties after ownership change" , func ():
36+ var properties := SnapshotFixtures .state_properties ()
37+ var cache := PropertyCache .new (remote_node )
38+ var config := _PropertyConfig .new ()
39+ config .set_properties_from_paths (SnapshotFixtures .state_properties (), cache )
40+ config .local_peer_id = LOCAL_PEER
41+
42+ expect_empty (config .get_owned_properties ())
43+
44+ # Update ownership
45+ remote_node .set_multiplayer_authority (1 )
46+ config .set_properties_from_paths (SnapshotFixtures .state_properties (), cache )
47+
48+ # Convert to a list of property paths for easier comparison
49+ var owned_properties := config .get_owned_properties ()\
50+ .map (func (it ): return str (it ))
51+ expect_equal (owned_properties , properties )
52+ )
53+
3554 on_finish .connect (func ():
3655 local_node .queue_free ()
3756 remote_node .queue_free ()
Original file line number Diff line number Diff line change @@ -8,12 +8,19 @@ static func state_snapshot(p_position: Vector3 = Vector3.ONE) -> _PropertySnapsh
88 ":health" : 100.
99 })
1010
11+ static func state_properties () -> Array [String ]:
12+ var result : Array [String ] = [
13+ ":position" ,
14+ ":velocity" ,
15+ ":health"
16+ ]
17+ return result
18+
1119static func state_propery_entries (root_node : Node ) -> Array [PropertyEntry ]:
1220 var result : Array [PropertyEntry ] = []
13- result .append (PropertyEntry .parse (root_node , ":position" ))
14- result .append (PropertyEntry .parse (root_node , ":velocity" ))
15- result .append (PropertyEntry .parse (root_node , ":health" ))
16-
21+ result .assign (state_properties ().map (func (path ):
22+ return PropertyEntry .parse (root_node , path )
23+ ))
1724 return result
1825
1926static func state_node () -> StateNode :
You can’t perform that action at this time.
0 commit comments