Modding:Synchronization: Difference between revisions

From Vintage Story Wiki
(Created page with "As a modder, if haven't had experience with multiplayer environments, the learning curve can be a bit steep at first. This document is here to help you with common pitfalls. A...")
 
 
Line 27: Line 27:
=== Blocks ===
=== Blocks ===


A call to SetBlock() and ExchangeBlock() is automatically synced.
A call to <code>SetBlock()</code> and <code>ExchangeBlock()</code> is automatically synced.


If you change any data on a block entity, you usualay have to call `MarkDirty()` inside the block entity. It will resend all block entity data to all nearby clients.  
If you change any data on a block entity, you usualay have to call <code>MarkDirty()</code> inside the block entity. It will resend all block entity data to all nearby clients.  


=== Inventory ===
=== Inventory ===


Changing inventory contents usually requires you to call <code>slot.MarkDirty()</code> so that the client sees the change.
Changing inventory contents usually requires you to call <code>slot.MarkDirty()</code> so that the client sees the change.
=== Sound&Particles ===
Playing sounds and spawning particles on the server side is possible! These are automatically synced to all nearby clients.
Confirmedusers, Bureaucrats, editor, Administrators
1,778

edits