Esempio n. 1
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_subsystemTime               = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemTerrain            = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemBodies             = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true);
     m_subsystemMovingBlocks       = base.Project.FindSubsystem <SubsystemMovingBlocks>(throwOnError: true);
     m_subsystemAudio              = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemParticles          = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemBlockBehaviors     = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
     m_subsystemFluidBlockBehavior = base.Project.FindSubsystem <SubsystemFluidBlockBehavior>(throwOnError: true);
     BoxSize                  = valuesDictionary.GetValue <Vector3>("BoxSize");
     Mass                     = valuesDictionary.GetValue <float>("Mass");
     Density                  = valuesDictionary.GetValue <float>("Density");
     AirDrag                  = valuesDictionary.GetValue <Vector2>("AirDrag");
     WaterDrag                = valuesDictionary.GetValue <Vector2>("WaterDrag");
     WaterSwayAngle           = valuesDictionary.GetValue <float>("WaterSwayAngle");
     WaterTurnSpeed           = valuesDictionary.GetValue <float>("WaterTurnSpeed");
     Velocity                 = valuesDictionary.GetValue <Vector3>("Velocity");
     MaxSmoothRiseHeight      = valuesDictionary.GetValue <float>("MaxSmoothRiseHeight");
     ParentBody               = valuesDictionary.GetValue <EntityReference>("ParentBody").GetComponent <ComponentBody>(base.Entity, idToEntityMap, throwIfNotFound: false);
     ParentBodyPositionOffset = valuesDictionary.GetValue <Vector3>("ParentBodyPositionOffset");
     ParentBodyRotationOffset = valuesDictionary.GetValue <Quaternion>("ParentBodyRotationOffset");
     IsSmoothRiseEnabled      = true;
     IsGravityEnabled         = true;
     IsGroundDragEnabled      = true;
     IsWaterDragEnabled       = true;
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemTime          = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemParticles     = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemViews         = base.Project.FindSubsystem <SubsystemGameWidgets>(throwOnError: true);
     m_subsystemAudio         = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemAmbientSounds = base.Project.FindSubsystem <SubsystemAmbientSounds>(throwOnError: true);
     for (int i = -2; i <= 2; i++)
     {
         for (int j = -1; j <= 2; j++)
         {
             for (int k = -2; k <= 2; k++)
             {
                 if (i != 0 || j != 0 || k != 0)
                 {
                     float num = (j < 0) ? 1.5f : 2.5f;
                     if (MathUtils.Sqrt(i * i + j * j + k * k) <= num)
                     {
                         float num2 = MathUtils.Sqrt(i * i + k * k);
                         float num3 = (j > 0) ? (0.5f * (float)j) : ((float)(-j));
                         m_expansionProbabilities[new Point3(i, j, k)] = 0.02f / (num2 + num3);
                     }
                 }
             }
         }
     }
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemParticles   = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemAudio       = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemTerrain     = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_componentCreature    = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true);
     m_stateMachine.AddState("Inactive", null, delegate
     {
         m_importanceLevel = MathUtils.Lerp(0f, 400f, MathUtils.Saturate((0.75f - m_componentCreature.ComponentHealth.Air) / 0.75f));
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Surface");
         }
     }, null);
     m_stateMachine.AddState("Surface", delegate
     {
         m_componentPathfinding.Stop();
     }, delegate
     {
         _ = m_componentCreature.ComponentBody.Position;
         if (!m_componentPathfinding.Destination.HasValue)
         {
             Vector3?destination = FindSurfaceDestination();
             if (destination.HasValue)
             {
                 float speed = (m_componentCreature.ComponentHealth.Air < 0.25f) ? 1f : m_random.Float(0.4f, 0.6f);
                 m_componentPathfinding.SetDestination(destination, speed, 1f, 0, useRandomMovements: false, ignoreHeightDifference: false, raycastDestination: false, null);
             }
         }
         else if (m_componentPathfinding.IsStuck)
         {
             m_importanceLevel = 0f;
         }
         if (m_componentCreature.ComponentHealth.Air > 0.9f)
         {
             m_stateMachine.TransitionTo("Breathe");
         }
     }, null);
     m_stateMachine.AddState("Breathe", delegate
     {
         Vector3 forward = m_componentCreature.ComponentBody.Matrix.Forward;
         Vector3 value   = m_componentCreature.ComponentBody.Matrix.Translation + 10f * forward + new Vector3(0f, 2f, 0f);
         m_componentPathfinding.SetDestination(value, 0.6f, 1f, 0, useRandomMovements: false, ignoreHeightDifference: false, raycastDestination: false, null);
         m_particleSystem = new WhalePlumeParticleSystem(m_subsystemTerrain, m_random.Float(0.8f, 1.1f), m_random.Float(1f, 1.3f));
         m_subsystemParticles.AddParticleSystem(m_particleSystem);
         m_subsystemAudio.PlayRandomSound("Audio/Creatures/WhaleBlow", 1f, m_random.Float(-0.2f, 0.2f), m_componentCreature.ComponentBody.Position, 10f, autoDelay: true);
     }, delegate
     {
         m_particleSystem.Position = m_componentCreature.ComponentBody.Position + new Vector3(0f, 0.8f * m_componentCreature.ComponentBody.BoxSize.Y, 0f);
         if (!m_subsystemParticles.ContainsParticleSystem(m_particleSystem))
         {
             m_importanceLevel = 0f;
         }
     }, delegate
     {
         m_particleSystem.IsStopped = true;
         m_particleSystem           = null;
     });
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemAudio              = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemPlayers            = base.Project.FindSubsystem <SubsystemPlayers>(throwOnError: true);
     m_subsystemTerrain            = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemSky                = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
     m_subsystemTime               = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemGameInfo           = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemParticles          = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemExplosions         = base.Project.FindSubsystem <SubsystemExplosions>(throwOnError: true);
     m_subsystemBlockBehaviors     = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
     m_subsystemFireBlockBehavior  = base.Project.FindSubsystem <SubsystemFireBlockBehavior>(throwOnError: true);
     m_subsystemFluidBlockBehavior = base.Project.FindSubsystem <SubsystemFluidBlockBehavior>(throwOnError: true);
     foreach (ValuesDictionary item in valuesDictionary.GetValue <ValuesDictionary>("Pickables").Values.Where((object v) => v is ValuesDictionary))
     {
         Pickable pickable = new Pickable();
         pickable.Value        = item.GetValue <int>("Value");
         pickable.Count        = item.GetValue <int>("Count");
         pickable.Position     = item.GetValue <Vector3>("Position");
         pickable.Velocity     = item.GetValue <Vector3>("Velocity");
         pickable.CreationTime = item.GetValue("CreationTime", 0.0);
         if (item.ContainsKey("StuckMatrix"))
         {
             pickable.StuckMatrix = item.GetValue <Matrix>("StuckMatrix");
         }
         m_pickables.Add(pickable);
     }
 }
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemGameInfo           = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemParticles          = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
            m_subsystemAudio              = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_subsystemTime               = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
            m_subsystemTerrain            = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            m_subsystemPickables          = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
            m_componentGui                = base.Entity.FindComponent <ComponentGui>(throwOnError: true);
            m_componentHumanModel         = base.Entity.FindComponent <ComponentHumanModel>(throwOnError: true);
            m_componentBody               = base.Entity.FindComponent <ComponentBody>(throwOnError: true);
            m_componentOuterClothingModel = base.Entity.FindComponent <ComponentOuterClothingModel>(throwOnError: true);
            m_componentVitalStats         = base.Entity.FindComponent <ComponentVitalStats>(throwOnError: true);
            m_componentLocomotion         = base.Entity.FindComponent <ComponentLocomotion>(throwOnError: true);
            m_componentPlayer             = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
            SteedMovementSpeedFactor      = 1f;
            Insulation                    = 0f;
            LeastInsulatedSlot            = ClothingSlot.Feet;
            m_clothes[ClothingSlot.Head]  = new List <int>();
            m_clothes[ClothingSlot.Torso] = new List <int>();
            m_clothes[ClothingSlot.Legs]  = new List <int>();
            m_clothes[ClothingSlot.Feet]  = new List <int>();
            ValuesDictionary value = valuesDictionary.GetValue <ValuesDictionary>("Clothes");

            SetClothes(ClothingSlot.Head, HumanReadableConverter.ValuesListFromString <int>(';', value.GetValue <string>("Head")));
            SetClothes(ClothingSlot.Torso, HumanReadableConverter.ValuesListFromString <int>(';', value.GetValue <string>("Torso")));
            SetClothes(ClothingSlot.Legs, HumanReadableConverter.ValuesListFromString <int>(';', value.GetValue <string>("Legs")));
            SetClothes(ClothingSlot.Feet, HumanReadableConverter.ValuesListFromString <int>(';', value.GetValue <string>("Feet")));
            Display.DeviceReset += Display_DeviceReset;
        }
Esempio n. 6
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemTime      = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
            m_subsystemTimeOfDay = base.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true);
            m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            m_subsystemParticles = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
            m_subsystemGameInfo  = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemPickables = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
            m_componentCreature  = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
            m_componentPlayer    = base.Entity.FindComponent <ComponentPlayer>();
            m_componentOnFire    = base.Entity.FindComponent <ComponentOnFire>(throwOnError: true);
            AttackResilience     = valuesDictionary.GetValue <float>("AttackResilience");
            FallResilience       = valuesDictionary.GetValue <float>("FallResilience");
            FireResilience       = valuesDictionary.GetValue <float>("FireResilience");
            CorpseDuration       = valuesDictionary.GetValue <float>("CorpseDuration");
            BreathingMode        = valuesDictionary.GetValue <BreathingMode>("BreathingMode");
            CanStrand            = valuesDictionary.GetValue <bool>("CanStrand");
            Health      = valuesDictionary.GetValue <float>("Health");
            Air         = valuesDictionary.GetValue <float>("Air");
            AirCapacity = valuesDictionary.GetValue <float>("AirCapacity");
            double value = valuesDictionary.GetValue <double>("DeathTime");

            DeathTime    = ((value >= 0.0) ? new double?(value) : null);
            CauseOfDeath = valuesDictionary.GetValue <string>("CauseOfDeath");
            if (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative && base.Entity.FindComponent <ComponentPlayer>() != null)
            {
                IsInvulnerable = true;
            }
        }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemAudio              = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemSoundMaterials     = base.Project.FindSubsystem <SubsystemSoundMaterials>(throwOnError: true);
     m_subsystemParticles          = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemPickables          = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
     m_subsystemBodies             = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true);
     m_subsystemTerrain            = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemSky                = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
     m_subsystemTime               = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemNoise              = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true);
     m_subsystemExplosions         = base.Project.FindSubsystem <SubsystemExplosions>(throwOnError: true);
     m_subsystemGameInfo           = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemBlockBehaviors     = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
     m_subsystemFluidBlockBehavior = base.Project.FindSubsystem <SubsystemFluidBlockBehavior>(throwOnError: true);
     m_subsystemFireBlockBehavior  = base.Project.FindSubsystem <SubsystemFireBlockBehavior>(throwOnError: true);
     foreach (ValuesDictionary item in valuesDictionary.GetValue <ValuesDictionary>("Projectiles").Values.Where((object v) => v is ValuesDictionary))
     {
         Projectile projectile = new Projectile();
         projectile.Value        = item.GetValue <int>("Value");
         projectile.Position     = item.GetValue <Vector3>("Position");
         projectile.Velocity     = item.GetValue <Vector3>("Velocity");
         projectile.CreationTime = item.GetValue <double>("CreationTime");
         m_projectiles.Add(projectile);
     }
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemTime          = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemParticles     = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemWeather       = base.Project.FindSubsystem <SubsystemWeather>(throwOnError: true);
     m_subsystemAmbientSounds = base.Project.FindSubsystem <SubsystemAmbientSounds>(throwOnError: true);
 }
Esempio n. 9
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemGameInfo  = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemTime      = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemParticles = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_componentPlayer    = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
     m_sicknessDuration   = valuesDictionary.GetValue <float>("SicknessDuration");
 }
Esempio n. 10
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemTerrain     = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemTime        = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemProjectiles = base.Project.FindSubsystem <SubsystemProjectiles>(throwOnError: true);
     m_subsystemParticles   = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemAudio       = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemNoise       = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true);
     base.Load(valuesDictionary);
 }
        public SoundGeneratorElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace)
            : base(subsystemElectricity, cellFace)
        {
            m_subsystemNoise     = subsystemElectricity.Project.FindSubsystem <SubsystemNoise>(throwOnError: true);
            m_subsystemParticles = subsystemElectricity.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
            Vector3 vector   = CellFace.FaceToVector3(cellFace.Face);
            Vector3 position = new Vector3(cellFace.Point) + new Vector3(0.5f) - 0.2f * vector;

            m_particleSystem = new SoundParticleSystem(subsystemElectricity.SubsystemTerrain, position, vector);
        }
Esempio n. 12
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemAudio             = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemParticles         = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemTerrain           = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemNoise             = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true);
     m_subsystemBodies            = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true);
     m_subsystemPickables         = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
     m_subsystemProjectiles       = base.Project.FindSubsystem <SubsystemProjectiles>(throwOnError: true);
     m_subsystemBlockBehaviors    = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
     m_subsystemFireBlockBehavior = base.Project.FindSubsystem <SubsystemFireBlockBehavior>(throwOnError: true);
     m_explosionParticleSystem    = new ExplosionParticleSystem();
     m_subsystemParticles.AddParticleSystem(m_explosionParticleSystem);
 }
Esempio n. 13
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemTime          = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
            m_subsystemTerrain       = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            m_subsystemAudio         = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_subsystemAmbientSounds = base.Project.FindSubsystem <SubsystemAmbientSounds>(throwOnError: true);
            m_subsystemParticles     = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
            ComponentBody            = base.Entity.FindComponent <ComponentBody>();
            float value = valuesDictionary.GetValue <float>("FireDuration");

            if (value > 0f)
            {
                SetOnFire(null, value);
            }
        }
Esempio n. 14
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemAudio     = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemParticles = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_componentBody      = base.Entity.FindComponent <ComponentBody>(throwOnError: true);
     m_componentOnFire    = base.Entity.FindComponent <ComponentOnFire>();
     Hitpoints            = valuesDictionary.GetValue <float>("Hitpoints");
     AttackResilience     = valuesDictionary.GetValue <float>("AttackResilience");
     m_fallResilience     = valuesDictionary.GetValue <float>("FallResilience");
     m_fireResilience     = valuesDictionary.GetValue <float>("FireResilience");
     m_debrisTextureSlot  = valuesDictionary.GetValue <int>("DebrisTextureSlot");
     m_debrisStrength     = valuesDictionary.GetValue <float>("DebrisStrength");
     m_debrisScale        = valuesDictionary.GetValue <float>("DebrisScale");
     DamageSoundName      = valuesDictionary.GetValue <string>("DestructionSoundName");
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemTerrain           = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemParticles         = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemExplosions        = base.Project.FindSubsystem <SubsystemExplosions>(throwOnError: true);
     m_subsystemFireBlockBehavior = base.Project.FindSubsystem <SubsystemFireBlockBehavior>(throwOnError: true);
     m_subsystemAudio             = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_fuseSound          = m_subsystemAudio.CreateSound("Audio/Fuse");
     m_fuseSound.IsLooped = true;
     foreach (ValuesDictionary value3 in valuesDictionary.GetValue <ValuesDictionary>("Explosives").Values)
     {
         Point3 value  = value3.GetValue <Point3>("Point");
         float  value2 = value3.GetValue <float>("TimeToExplosion");
         AddExplosive(value, value2);
     }
 }
Esempio n. 16
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemViews                = base.Project.FindSubsystem <SubsystemGameWidgets>(throwOnError: true);
     SubsystemGameInfo               = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemParticles            = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemPickables            = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
     m_subsystemBlockBehaviors       = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
     SubsystemAnimatedTextures       = base.Project.FindSubsystem <SubsystemAnimatedTextures>(throwOnError: true);
     SubsystemFurnitureBlockBehavior = base.Project.FindSubsystem <SubsystemFurnitureBlockBehavior>(throwOnError: true);
     SubsystemPalette                = base.Project.FindSubsystem <SubsystemPalette>(throwOnError: true);
     Terrain                = new Terrain();
     TerrainRenderer        = new TerrainRenderer(this);
     TerrainUpdater         = new TerrainUpdater(this);
     TerrainSerializer      = new TerrainSerializer22(Terrain, SubsystemGameInfo.DirectoryName);
     BlockGeometryGenerator = new BlockGeometryGenerator(Terrain, this, base.Project.FindSubsystem <SubsystemElectricity>(throwOnError: true), SubsystemFurnitureBlockBehavior, base.Project.FindSubsystem <SubsystemMetersBlockBehavior>(throwOnError: true), SubsystemPalette);
     if (string.CompareOrdinal(SubsystemGameInfo.WorldSettings.OriginalSerializationVersion, "2.1") <= 0)
     {
         TerrainGenerationMode terrainGenerationMode = SubsystemGameInfo.WorldSettings.TerrainGenerationMode;
         if (terrainGenerationMode == TerrainGenerationMode.FlatContinent || terrainGenerationMode == TerrainGenerationMode.FlatIsland)
         {
             TerrainContentsGenerator = new TerrainContentsGeneratorFlat(this);
         }
         else
         {
             TerrainContentsGenerator = new TerrainContentsGenerator21(this);
         }
     }
     else
     {
         TerrainGenerationMode terrainGenerationMode2 = SubsystemGameInfo.WorldSettings.TerrainGenerationMode;
         if (terrainGenerationMode2 == TerrainGenerationMode.FlatContinent || terrainGenerationMode2 == TerrainGenerationMode.FlatIsland)
         {
             TerrainContentsGenerator = new TerrainContentsGeneratorFlat(this);
         }
         else
         {
             TerrainContentsGenerator = new TerrainContentsGenerator22(this);
         }
     }
 }
Esempio n. 17
0
        public override void Load(ValuesDictionary valuesDictionary)
        {
            base.Load(valuesDictionary);
            m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_subsystemSoundMaterials = base.Project.FindSubsystem <SubsystemSoundMaterials>(throwOnError: true);
            m_subsystemItemsScanner   = base.Project.FindSubsystem <SubsystemItemsScanner>(throwOnError: true);
            m_subsystemGameInfo       = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemPickables      = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
            m_subsystemParticles      = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
            ValuesDictionary value = valuesDictionary.GetValue <ValuesDictionary>("FurnitureDesigns");

            foreach (FurnitureDesign item in LoadFurnitureDesigns(base.SubsystemTerrain, value))
            {
                m_furnitureDesigns[item.Index] = item;
            }
            foreach (ValuesDictionary item2 in valuesDictionary.GetValue <ValuesDictionary>("FurnitureSets").Values.Where((object v) => v is ValuesDictionary))
            {
                string       value2       = item2.GetValue <string>("Name");
                string       value3       = item2.GetValue <string>("ImportedFrom", null);
                string       value4       = item2.GetValue <string>("Indices");
                int[]        array        = HumanReadableConverter.ValuesListFromString <int>(';', value4);
                FurnitureSet furnitureSet = new FurnitureSet
                {
                    Name         = value2,
                    ImportedFrom = value3
                };
                m_furnitureSets.Add(furnitureSet);
                int[] array2 = array;
                foreach (int num in array2)
                {
                    if (num >= 0 && num < m_furnitureDesigns.Length && m_furnitureDesigns[num] != null)
                    {
                        m_furnitureDesigns[num].FurnitureSet = furnitureSet;
                    }
                }
            }
            m_subsystemItemsScanner.ItemsScanned += GarbageCollectDesigns;
        }
Esempio n. 18
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemGameInfo      = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     SubsystemTerrain         = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemBlocksScanner = base.Project.FindSubsystem <SubsystemBlocksScanner>(throwOnError: true);
     SubsystemSky             = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
     m_subsystemParticles     = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     SubsystemTime            = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemAudio         = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_precipitationStartTime = valuesDictionary.GetValue <double>("WeatherStartTime");
     m_precipitationEndTime   = valuesDictionary.GetValue <double>("WeatherEndTime");
     m_lightningIntensity     = valuesDictionary.GetValue <float>("LightningIntensity");
     m_rainSound              = m_subsystemAudio.CreateSound("Audio/Rain");
     m_rainSound.IsLooped     = true;
     m_rainSound.Volume       = 0f;
     RainSplashParticleSystem = new RainSplashParticleSystem();
     m_subsystemParticles.AddParticleSystem(RainSplashParticleSystem);
     SnowSplashParticleSystem = new SnowSplashParticleSystem();
     m_subsystemParticles.AddParticleSystem(SnowSplashParticleSystem);
     m_rainVolumeFactor = 0f;
     for (int i = -5; i <= 5; i++)
     {
         for (int j = -5; j <= 5; j++)
         {
             float distance = MathUtils.Sqrt(i * i + j * j);
             m_rainVolumeFactor += m_subsystemAudio.CalculateVolume(distance, 1.5f);
         }
     }
     m_subsystemBlocksScanner.ScanningChunkCompleted += delegate(TerrainChunk chunk)
     {
         if (m_subsystemGameInfo.WorldSettings.EnvironmentBehaviorMode == EnvironmentBehaviorMode.Living)
         {
             FreezeThawAndDepositSnow(chunk);
         }
     };
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemParticles = Project.FindSubsystem <SubsystemParticles>(true);
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemAudio     = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemParticles = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemFireBlockBehavior = base.Project.FindSubsystem <SubsystemFireBlockBehavior>(throwOnError: true);
     m_subsystemParticles         = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
 }