Added ServerOnly option to NetworkedObject
This commit is contained in:
parent
24c03f6324
commit
dbc6ac1370
@ -6,10 +6,15 @@ namespace MLAPI
|
|||||||
//Will be used for objects which will be spawned automatically across clients
|
//Will be used for objects which will be spawned automatically across clients
|
||||||
public class NetworkedObject : MonoBehaviour
|
public class NetworkedObject : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[HideInInspector]
|
||||||
public uint NetworkId;
|
public uint NetworkId;
|
||||||
|
[HideInInspector]
|
||||||
public int OwnerClientId = -1;
|
public int OwnerClientId = -1;
|
||||||
|
[HideInInspector]
|
||||||
public int SpawnablePrefabId;
|
public int SpawnablePrefabId;
|
||||||
internal bool IsPlayerObject = false;
|
[HideInInspector]
|
||||||
|
public bool IsPlayerObject = false;
|
||||||
|
public bool ServerOnly = false;
|
||||||
public bool isLocalPlayer
|
public bool isLocalPlayer
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -744,9 +744,19 @@ namespace MLAPI
|
|||||||
}
|
}
|
||||||
if (NetworkConfig.HandleObjectSpawning)
|
if (NetworkConfig.HandleObjectSpawning)
|
||||||
{
|
{
|
||||||
writer.Write(spawnedObjectIds.Count);
|
int amountOfObjectsToSend = 0;
|
||||||
for (int i = 0; i < spawnedObjectIds.Count; i++)
|
for (int i = 0; i < spawnedObjectIds.Count; i++)
|
||||||
{
|
{
|
||||||
|
if (spawnedObjects[spawnedObjectIds[i]].ServerOnly)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
amountOfObjectsToSend++;
|
||||||
|
}
|
||||||
|
writer.Write(amountOfObjectsToSend);
|
||||||
|
for (int i = 0; i < spawnedObjectIds.Count; i++)
|
||||||
|
{
|
||||||
|
if (spawnedObjects[spawnedObjectIds[i]].ServerOnly)
|
||||||
|
continue;
|
||||||
writer.Write(spawnedObjects[spawnedObjectIds[i]].IsPlayerObject);
|
writer.Write(spawnedObjects[spawnedObjectIds[i]].IsPlayerObject);
|
||||||
writer.Write(spawnedObjects[spawnedObjectIds[i]].NetworkId);
|
writer.Write(spawnedObjects[spawnedObjectIds[i]].NetworkId);
|
||||||
writer.Write(spawnedObjects[spawnedObjectIds[i]].OwnerClientId);
|
writer.Write(spawnedObjects[spawnedObjectIds[i]].OwnerClientId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user