Copy state from local entity to networked entity once the local entity is networked

Currently after networking an entity with a local state the networked state will be empty. It would be nice if the local state would get copied to the networked state once the entity is networked. It would also be nice if any state properties that were set with replication set to true on local state would get replicated once the entity would be networked.

On my server I use local vehicles in vehicle select and network them when the player has selected vehicle and customized it. I plan to use state bags to synchronize vehicle xenon lights custom color. Currently I would have to manually copy the local entity state to the networked entity state.

Since you can easily copy the states from the local entity, there would be very little reason for Cfx to change it so that it’s automatically done, mainly because it’ll introduce a change in behavior that you would have to undo if it was undesired for your use case, and because it’ll be a breaking change for those who already use it like that.

Then there could possibly be a new native for copying state from one state bag to other. Otherwise in order to copy the whole state you would have to manually copy every possible key value pair even if the state bag is empty or does not have all those properties set.