Example #1
0
        private void LoadInterior(List <NFive.SDK.Core.Models.Vector3> locations, List <InteriorProp> interiorProps)
        {
            foreach (var location in locations)
            {
                // Try to get the interior from the location specified
                var interiorId = API.GetInteriorAtCoords(location.X, location.Y, location.Z);
                if (API.IsValidInterior(interiorId))
                {
                    // Load the interior to memory
                    API.PinInteriorInMemory(interiorId);

                    // Load all props for the interior
                    foreach (var interiorProp in interiorProps)
                    {
                        API.ActivateInteriorEntitySet(interiorId, interiorProp.Name);

                        // Load prop color if it has any
                        if (interiorProp.Color.HasValue)
                        {
                            API.SetInteriorEntitySetColor(interiorId, interiorProp.Name, interiorProp.Color.Value);
                        }
                    }

                    // Refresh to get all props that were added in the interior
                    API.RefreshInterior(interiorId);

                    Logger.Info("Loaded interior ID " + interiorId);
                }
                else
                {
                    Logger.Info("Couldn't find interior at " + location.ToString());
                }
            }
        }