private static void AreaSkyBoxStormIcy(NwArea area)
        {
            if (area.SkyBox == Skybox.GrassStorm)
            {
                area.Weather = WeatherType.Rain;
            }

            if (area.SkyBox == Skybox.Icy)
            {
                area.Weather = WeatherType.Snow;
            }
        }
Exemple #2
0
        /// <summary>
        /// Export the .git file of this area to the UserDirectory/nwnx folder, or to the location of alias.
        /// </summary>
        /// <param name="area">The NwArea to check.</param>
        /// <param name="fileName">The filename, 16 characters or less and should be lowercase. If left blank the resref of oArea will be used.</param>
        /// <param name="exportVariables">If true, local variables set on this area will be exported.</param>
        /// <param name="exportUUID">If true, the UUID of this area will be exported.</param>
        /// <param name="objectTypeFilter">Filter object types. These objects will not be exported.</param>
        /// <param name="alias">The alias of the resource directory to add the .git file to. Default: 'UserDirectory/nwnx'.</param>
        /// <param name="objectsToIgnore">The NwObjects we want to not export. Players are already ignored.</param>
        /// <return>true if exported successfully, false if not.</return>
        public static bool ExportGIT(this NwArea area, string fileName = "", bool exportVariables = true, bool exportUUID = true, ObjectTypes objectTypeFilter = ObjectTypes.All, string alias = "NWNX", params NwObject[] objectsToIgnore)
        {
            foreach (var obj in objectsToIgnore)
            {
                AreaPlugin.AddObjectToExclusionList(obj);
            }

            var returnValue = AreaPlugin.ExportGIT(area, fileName, exportVariables.ToInt(), exportUUID.ToInt(), (int)objectTypeFilter, alias).ToBool();

            foreach (var obj in objectsToIgnore)
            {
                AreaPlugin.RemoveObjectFromExclusionList(obj);
            }

            return(returnValue);
        }
Exemple #3
0
        public void ChangeAreaUnderGroundUpdatesAreaFlags()
        {
            NwArea area = NwModule.Instance.StartingLocation.Area !;

            area.IsUnderGround = true;
            Assert.That(area.IsUnderGround, Is.EqualTo(true));
            Assert.That(area.IsAboveGround, Is.EqualTo(false));
            Assert.That(NWScript.GetIsAreaAboveGround(area).ToBool(), Is.EqualTo(false));
            Assert.That(area.AreaFlags.HasFlag(AreaFlags.UnderGround), Is.EqualTo(true));

            area.IsUnderGround = false;
            Assert.That(area.IsUnderGround, Is.EqualTo(false));
            Assert.That(area.IsAboveGround, Is.EqualTo(true));
            Assert.That(NWScript.GetIsAreaAboveGround(area).ToBool(), Is.EqualTo(true));
            Assert.That(area.AreaFlags.HasFlag(AreaFlags.UnderGround), Is.EqualTo(false));
        }
Exemple #4
0
        public void ChangeAreaUrbanUpdatesAreaFlags()
        {
            NwArea area = NwModule.Instance.StartingLocation.Area !;

            area.IsUrban = true;
            Assert.That(area.IsUrban, Is.EqualTo(true));
            Assert.That(area.IsNatural, Is.EqualTo(false));
            Assert.That(NWScript.GetIsAreaNatural(area).ToBool(), Is.EqualTo(false));
            Assert.That(area.AreaFlags.HasFlag(AreaFlags.Natural), Is.EqualTo(false));

            area.IsUrban = false;
            Assert.That(area.IsUrban, Is.EqualTo(false));
            Assert.That(area.IsNatural, Is.EqualTo(true));
            Assert.That(NWScript.GetIsAreaNatural(area).ToBool(), Is.EqualTo(true));
            Assert.That(area.AreaFlags.HasFlag(AreaFlags.Natural), Is.EqualTo(true));
        }
Exemple #5
0
        public void ChangeAreaExteriorUpdatesAreaFlags()
        {
            NwArea area = NwModule.Instance.StartingLocation.Area !;

            area.IsExterior    = true;
            area.IsAboveGround = true; // NWScript.GetIsAreaInterior() always returns true if this flag is set to false.

            Assert.That(area.IsExterior, Is.EqualTo(true));
            Assert.That(area.IsInterior, Is.EqualTo(false));
            Assert.That(NWScript.GetIsAreaInterior(area).ToBool(), Is.EqualTo(false));
            Assert.That(area.AreaFlags.HasFlag(AreaFlags.Interior), Is.EqualTo(false));

            area.IsExterior = false;
            Assert.That(area.IsExterior, Is.EqualTo(false));
            Assert.That(area.IsInterior, Is.EqualTo(true));
            Assert.That(NWScript.GetIsAreaInterior(area).ToBool(), Is.EqualTo(true));
            Assert.That(area.AreaFlags.HasFlag(AreaFlags.Interior), Is.EqualTo(true));
        }
            public static void Signal(NwArea area, int eventId)
            {
                Event nwEvent = NWScript.EventUserDefined(eventId) !;

                NWScript.SignalEvent(area, nwEvent);
            }
Exemple #7
0
 /// <summary>
 /// Export the .git file of this area to the UserDirectory/nwnx folder, or to the location of alias.
 /// </summary>
 /// <param name="area">The NwArea to check.</param>
 /// <param name="fileName">The filename, 16 characters or less and should be lowercase. If left blank the resref of oArea will be used.</param>
 /// <param name="newName">Optional new name of the area. Leave blank to use the current name.</param>
 /// <param name="newTag">Optional new tag of the area. Leave blank to use the current tag.</param>
 /// <param name="alias">The alias of the resource directory to add the .git file to. Default: 'UserDirectory/nwnx'.</param>
 /// <return>true if exported successfully, false if not.</return>
 public static bool ExportARE(this NwArea area, string fileName = "", string newName = "", string newTag = "", string alias = "NWNX") => AreaPlugin.ExportARE(area, fileName, newName, newTag, alias).ToBool();
Exemple #8
0
 public static void AddToArea(this NwGameObject gameObject, NwArea area, Vector3 position)
 {
     ObjectPlugin.AddToArea(gameObject, area, position);
 }