522 Commits over 1,461 Days - 0.01cph!
Ignore packets from non-host until we're fully connected ( Fixes Facepunch/sbox-issues#1595 )
When calling NetworkSpawn we break from prefabs in all of our ancestors ( Fixes Facepunch/sbox-issues#5046 )
Add Priority to CodeGeneratorAttribute - allows you to specify priority. Higher priority means the target method/property is wrapped first.
Check valid scene in SceneNetworkSystem message handlers
Don't interpolate when setting local transform within fixed update if the GameObject isn't enabled. Fixes trying to interpolate to initial position when cloning GameObjects in fixed update, but really we need a way to say "was the game object created this frame" and if it was then don't interpolate.
Clear interpolation properly and don't apply new interpolation if transform update received over network with clear interpolation flag
Another minor fix
Flush network updates before send RPCs (#1594)
* Flush network updates before send RPCs
* Keep track of potential pending network updates to flush for RPCs
* Make sure to unregister for update after sending
* Add some documentation
Simplify InterpolationBuffer a little bit (internal API)
Disable interpolation during certain initialization callbacks for components
Fix transform update delay when Skinned Model Renderer is attached to bone of another Skinned Model Renderer (#1578)
* Fix lag/wobbly update when Skinned Model Renderer is attached to bone of another Skinned Model Renderer
* Use Channel to contain changed transforms, write to that in threads for animation updates, then call transform changed on main thread for them after
Query game package MaxPlayers when creating a lobby
Initiailize target local with Transform.Zero. SceneUtility.GetPrefabScene never actually saves the cached scene to the var. ( Fixes Facepunch/sbox-issues#5511 )
Independently Interpolated Transform Parts + Other Fixes (#1577)
Silently term any new children created from children's OnDestroy when clearing scene. Fixes Facepunch/sbox-issues#4855
Wrapped method resume will get async keyword when wrapped method has it
Fixes to restore some old and intended behavior, additional documentation
This shiz is confusing - try this
When copying and pasting GameObjects in the editor - use the world transform instead of the local transform ( Fixes Facepunch/sbox-issues#4514 )
Shapshot -> Snapshot in loading screen ( Fixes Facepunch/sbox-issues#5439 ) 😂
Some clearer documentation
Interpolation v2 (#1516)
* Test
* Clean up - use TransformInterpolate class
* Can't modify transform if we're a network object root and a proxy - we must stay true to network transform target
* Hook up Interpolation enable/disable from Inspector. When Owner calls ClearInterpolation, set a bit on the update msg to have other clients do so as well. Hook up Network.Interpolation and Enable/DisableInterpolation() on the accessor.
* Fix to allow interp property to be set by GameObjectHeader
* Serialize the interpolation bool with GameObject
* Combination of fixed update interpolator and networked interpolation buffer. Working nicely
* Some cleanup
* Some extra docs + let's call it Query to match the other class
* Use Time.Now
* Restore backward compat LerpTo
* Cull after, ensure move direct to last tx if query out of time but entries remaining
* Fix formatting
* Tiny tidyup
* Add InterpolationSystem (GameObjectSystem) - update GameTransform to Add/Remove GameObjects from this system as appropriate
* Actually enable it
* Add new Interpolation stage - the updates need to happen at the right point. Clear interpolation if interpolation isn't enabled and we receive a transform update
RPC Filter (#1549)
* Update documentation
* Add recipient filter struct, type, and Rpc.FilterOnly and Rpc.AllExcept methods
* Update documentation
* Change filtertype options
* Move to Connection.Filter. Can pass optional filter to Broadcast. Use this for Rpcs with current filter.
* More docs
* Same logic for static Rpcs
* Add single Connection overloads
* this can be made private
* Fix ambigious docs
* Inverse logic (doh!)
* Use hasvalue etc
* Some fixes
* Remove duplicate docs
* Better docs
* RPC in log for consistency
* Add overloads for filtering RPC recipients based on a predicate
* FilterOnly -> FilterInclude. AllExcept -> FilterExclude. Only one RPC filter can be active at any time
* Add Rpc.Resume. This handles disabling and restoring filter if the Rpc.Caller is us before and after resuming. Use this everywhere.
* Restore the old filter here even if e.Resume() throws
* Early out / cut nesting
* Tidy up
Serialize and Deserialize Scene properties such as Time Scale, Fixed Update Frequency, Threaded Animation... joining clients will now have correct values for the Scene. These don't replicate when changed after that though. Fixes Facepunch/sbox-issues#4483
When creating networked object from remote (networked), wrap Deserialize and NetworkSpawnRemote in CallbackBatch so that _net is initialized before OnAwake is called. Fixes Facepunch/sbox-issues#4950
Use StringTable.Remove instead of StringTable.Entries.Remove when removing Connection from ConnectionInfoManager. Fixes Facepunch/sbox-issues#4983
Specify in documentation that NetPermission.OwnerOnly works the same as NetPermission.HostOnly for static actions.
Fixed reading String Table snapshot that has an entry with 0 elements throwing an exception. Instead, ByteStream.ReadArray should return null (empty span) if it has a length of 0. Added a test to prove the bug. Fixes Facepunch/sbox-issues#5357
Serialize Component FullName instead of ClassName. Fixes cases where two components with the same name exist in different namespaces, sometimes the wrong one will be serialized. Fully backwards compatible. Fixes Facepunch/sbox-issues#5331
Fixed NetPermission not working for static Rpcs (Fixes Facepunch/sbox-issues#5188)
Fix failing test, use float.PositiveInfinity not -1
NetList implements IList, IList<T>
NetDictionary implements IDictionary, IDictionary<TKey,TValue>
Avoid collection modified error in NetworkPrune (Fixes Facepunch/sbox-issues#5280)
Temp comment out this line to fix tests
Object Snapshot Refresh (#1500)
* Initial commit
* Component id + prune those for refresh as well
* Serialize id properly
* OnRefresh
* Fix refresh for bones
* Revert comp ids on this branch
* Use Id not __id as that is what was settled with for Component Ids
* When a component is added to a GameObject after it has been network spawned, and it has Sync vars we should register them with the network table
* Don't do on the root though save that for the multi-comp PR
* Include latest table snapshot with full refresh. Update to support __guid
* Undo this bit
* Added Connection.CanRefreshObjects permission (def: true)
* Add checks for CanRefreshObjects to Network.Refresh() and when OnObjectRefresh is called
* Register properties recursively when sending network refresh or receiving one
* Test to re-register Sync props after Network.Refresh
* Make docs clearer
* If a Component isn't valid then just set the property anyway for a Sync var
* By default, clients (except host) can NOT refresh network objects. Host can change this with Connection.CanRefreshObjects
* Some additional validation checks
* Better logic
* Fix issue with nested types not having correct identity hash for wrapped property codegen
Multi-Component Sync Vars + Sync Vars in Children (#1503)
* Support for multiple components of the same type on a Network Object to have sync vars. Adding support for children of a network object that aren't themselves network objects to have components with Sync vars too
* Register and unregister Sync properties for child gos/comps appropriately
* It goes here
* Also unregister/register sync properties accordingly when GameObject id changes
* NetworkMode can't be changed from NetworkMode.Object if we are actually a networked object (_net is valid)
* Simplify a bunch - allow setting property if slot not registered
* Remove unused UnregisterProperties methods
* Add a test to make sure child sync vars are added to network table
* Suppress these warnings for now - there are legitimate reasons why we might not find these GOs
* Suppress unknown slot
Authority RPC now correctly uses invoke permissions from the AuthorityAttribute. When calling Authority RPC, if there's no owner, the target would be the host connection
Authority check for network destroy - can never arbitrarily destroy unnetworked objects
In the PrefabFile upgrader, upgrade Id to __guid as well if possible, fixes corrupt prefabs from before when it was called Id
Fixes unable to parse guid error when trying to load properties called "id" but the type is not a guid (Fixes Facepunch/sbox-issues#5181)
When a component is added to a GameObject after it has been network spawned, and it has Sync vars we should register them with the network table
Don't do on the root though save that for the multi-comp PR
Update SceneEditorMenus to use MakeIdGuidsUnique instead of MakeGameObjectsUnique
Unforseen but when we link component reference from a prefab to property on something else in scene, we should still store component reference like we used to. We'll try to find the component in the scene directory by id if we can, but revert to old behavior if not
Put in guards against people having a property name of "id" (case-insensitive) on a component. Warn them if they do, don't serialize that property or try to deserialize it. Catch exception if trying to deserialize Id as a Guid but it isn't one.
Component Ids (#1501)
* Component id + prune those for refresh as well
* Serialize id properly
* Add unit tests for component id serialization / deserialization - make sure references to Components with Property are properly restored to the correct components by id
* Update GameObjectInspector to use Component.Id to determine already seen components. This makes it rebuild properly for multiple components of the same type
* Serialize as Id not __id so also picked up by MakeGameObjectsUnique
* Scene unique component ids - update serialization test accordingly
* Phase out storing GO guid and component type
* MakeGameObjectsUnique -> MakeIdGuidsUnique (make old method Obsolete and redirect to MakeIdGuidsUnique)
* Unit test for clone with references
* When adding component or game object to Directory - check is there a component or game object with that id already, if so, force change it to a new one and spit a warning out. No component or game object should ever be able to share the same guid anyway but this makes sure
* Add test for loading old reference model type from prefab / json
* Test both old and new formats
* Let's not make this elseif - always check both
Allow both Sync and HostSync on a property. It means that both the Owner and the Host can control the value. Fixes Facepunch/sbox-issues#5153