static void OnMessageSpawnGrid(ref SpawnGridMsg msg, MyNetworkClient sender) { Debug.Assert(MyCubeBuilder.BuildComponent != null, "The build component was not set in cube builder!"); MyEntity builder = null; MyEntities.TryGetEntityById(msg.BuilderEntityId, out builder); var definition = Definitions.MyDefinitionManager.Static.GetCubeBlockDefinition(msg.Definition); MatrixD worldMatrix = MatrixD.CreateWorld(msg.Position, msg.Forward, msg.Up); var reply = new SpawnGridReplyMsg(); MyCubeBuilder.BuildComponent.GetGridSpawnMaterials(definition, worldMatrix, msg.Static); bool canSpawn = MyCubeBuilder.BuildComponent.HasBuildingMaterials(builder); MySession.Static.SyncLayer.SendMessage(ref reply, sender.SteamUserId, canSpawn ? MyTransportMessageEnum.Success : MyTransportMessageEnum.Failure); if (!canSpawn) { return; } MyCubeBuilder.SpawnGrid(definition, worldMatrix, builder, msg.Static); }