Exemple #1
0
        public LSL_Integer aaWindlightSetScene(int dayCycleIndex, LSL_List list)
        {
            IGenericsConnector gc = DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            OSDWrapper d = gc.GetGeneric<OSDWrapper>(World.RegionInfo.RegionID, "EnvironmentSettings", "");
            WindlightDayCycle cycle = new WindlightDayCycle();
            if (d != null)
            {
                cycle.FromOSD(d.Info);
                if (cycle.Cycle.IsStaticDayCycle)
                    return ScriptBaseClass.WL_ERROR_SCENE_MUST_BE_STATIC;
                if (dayCycleIndex >= cycle.Cycle.DataSettings.Count)
                    return ScriptBaseClass.WL_ERROR_BAD_SETTING;
            }
            else
                return ScriptBaseClass.WL_ERROR_NO_SCENE_SET;

            ConvertLSLToWindlight(ref cycle, dayCycleIndex, list);
            gc.AddGeneric(World.RegionInfo.RegionID, "EnvironmentSettings", "", new OSDWrapper { Info = cycle.ToOSD() }.ToOSD());

            IEnvironmentSettingsModule environmentSettings = World.RequestModuleInterface<IEnvironmentSettingsModule>();
            if (environmentSettings != null)
                environmentSettings.TriggerWindlightUpdate(1);
            
            return ScriptBaseClass.WL_OK;
        }
Exemple #2
0
        public LSL_Integer aaWindlightRemoveDayCycleFrame(int dayCycleFrame)
        {
            IGenericsConnector gc = DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            OSDWrapper d = gc.GetGeneric<OSDWrapper>(World.RegionInfo.RegionID, "EnvironmentSettings", "");
            if (d != null)
            {
                WindlightDayCycle cycle = new WindlightDayCycle();
                cycle.FromOSD(d.Info);

                if (cycle.Cycle.IsStaticDayCycle || dayCycleFrame >= cycle.Cycle.DataSettings.Count)
                    return LSL_Integer.FALSE;

                var data = cycle.Cycle.DataSettings.Keys.ToList();
                string keyToRemove = data[dayCycleFrame];
                cycle.Cycle.DataSettings.Remove(keyToRemove);
                gc.AddGeneric(World.RegionInfo.RegionID, "EnvironmentSettings", "", new OSDWrapper { Info = cycle.ToOSD() }.ToOSD());
                return LSL_Integer.TRUE;
            }
            return LSL_Integer.FALSE;
        }
Exemple #3
0
        public LSL_Integer aaWindlightAddDayCycleFrame(LSL_Float dayCyclePosition, int dayCycleFrameToCopy)
        {
            IGenericsConnector gc = DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            OSDWrapper d = gc.GetGeneric<OSDWrapper>(World.RegionInfo.RegionID, "EnvironmentSettings", "");
            if (d != null)
            {
                WindlightDayCycle cycle = new WindlightDayCycle();
                cycle.FromOSD(d.Info);

                if (cycle.Cycle.IsStaticDayCycle || dayCycleFrameToCopy >= cycle.Cycle.DataSettings.Count)
                    return LSL_Integer.FALSE;

                var data = cycle.Cycle.DataSettings.Keys.ToList();
                cycle.Cycle.DataSettings.Add(dayCyclePosition.ToString(), cycle.Cycle.DataSettings[data[dayCycleFrameToCopy]]);
                gc.AddGeneric(World.RegionInfo.RegionID, "EnvironmentSettings", "", new OSDWrapper { Info = cycle.ToOSD() }.ToOSD());
                return LSL_Integer.TRUE;
            }
            return LSL_Integer.FALSE;
        }