public void SetPlayerCharacter(MyPlayer player, MyCharacter newCharacter, MyEntity spawnedBy) { Debug.Assert(Sync.IsServer, "SetPlayerCharacter can be only called on the server!"); newCharacter.SetPlayer(player); if(spawnedBy != null) { long relatedEntity = spawnedBy.EntityId; Vector3 relativePosition = (newCharacter.WorldMatrix * MatrixD.Invert(spawnedBy.WorldMatrix)).Translation; MyMultiplayer.RaiseEvent(newCharacter, x => x.SpawCharacterRelative, relatedEntity, relativePosition); } }
public void SetPlayerCharacter(MyPlayer player, MyCharacter newCharacter, MyEntity spawnedBy) { Debug.Assert(Sync.IsServer, "SetPlayerCharacter can be only called on the server!"); newCharacter.SetPlayer(player); if (MyVisualScriptLogicProvider.PlayerSpawned != null && !newCharacter.IsBot) MyVisualScriptLogicProvider.PlayerSpawned(newCharacter.ControllerInfo.Controller.Player.Identity.IdentityId); if(spawnedBy != null) { long relatedEntity = spawnedBy.EntityId; Vector3 relativePosition = (newCharacter.WorldMatrix * MatrixD.Invert(spawnedBy.WorldMatrix)).Translation; MyMultiplayer.RaiseEvent(newCharacter, x => x.SpawCharacterRelative, relatedEntity, relativePosition); } }