Beispiel #1
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemGameInfo            = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemTime                = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemAudio               = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemMetersBlockBehavior = base.Project.FindSubsystem <SubsystemMetersBlockBehavior>(throwOnError: true);
     m_subsystemWeather             = base.Project.FindSubsystem <SubsystemWeather>(throwOnError: true);
     m_componentPlayer              = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
     m_pantingSound          = m_subsystemAudio.CreateSound("Audio/HumanPanting");
     m_pantingSound.IsLooped = true;
     Food                     = valuesDictionary.GetValue <float>("Food");
     Stamina                  = valuesDictionary.GetValue <float>("Stamina");
     Sleep                    = valuesDictionary.GetValue <float>("Sleep");
     Temperature              = valuesDictionary.GetValue <float>("Temperature");
     Wetness                  = valuesDictionary.GetValue <float>("Wetness");
     m_lastFood               = Food;
     m_lastStamina            = Stamina;
     m_lastSleep              = Sleep;
     m_lastTemperature        = Temperature;
     m_lastWetness            = Wetness;
     m_environmentTemperature = Temperature;
     foreach (KeyValuePair <string, object> item in valuesDictionary.GetValue <ValuesDictionary>("Satiation"))
     {
         m_satiation[int.Parse(item.Key, CultureInfo.InvariantCulture)] = (float)item.Value;
     }
     m_componentPlayer.ComponentHealth.Attacked += delegate
     {
         m_lastAttackedTime = m_subsystemTime.GameTime;
     };
 }
 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);
     }
 }
Beispiel #3
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemGameInfo       = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemSky            = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
            m_subsystemParticles      = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
            m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_componentSpawn          = base.Entity.FindComponent <ComponentSpawn>(throwOnError: true);
            m_componentBody           = base.Entity.FindComponent <ComponentBody>(throwOnError: true);
            m_componentHealth         = base.Entity.FindComponent <ComponentHealth>(throwOnError: true);
            m_dayEntityTemplateName   = valuesDictionary.GetValue <string>("DayEntityTemplateName");
            m_nightEntityTemplateName = valuesDictionary.GetValue <string>("NightEntityTemplateName");
            float value = valuesDictionary.GetValue <float>("Probability");

            if (!string.IsNullOrEmpty(m_dayEntityTemplateName))
            {
                DatabaseManager.FindEntityValuesDictionary(m_dayEntityTemplateName, throwIfNotFound: true);
            }
            if (!string.IsNullOrEmpty(m_nightEntityTemplateName))
            {
                DatabaseManager.FindEntityValuesDictionary(m_nightEntityTemplateName, throwIfNotFound: true);
            }
            m_timeToSwitch              = s_random.Float(3f, 15f);
            IsEnabled                   = (s_random.Float(0f, 1f) < value);
            m_componentSpawn.Despawned += ComponentSpawn_Despawned;
        }
        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;
        }
Beispiel #5
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTime                = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemGameInfo            = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_componentCreature            = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentMount               = base.Entity.FindComponent <ComponentMount>(throwOnError: true);
     m_componentSteedBehavior       = base.Entity.FindComponent <ComponentSteedBehavior>(throwOnError: true);
     m_componentEatPickableBehavior = base.Entity.FindComponent <ComponentEatPickableBehavior>(throwOnError: true);
     m_stubbornProbability          = valuesDictionary.GetValue <float>("StubbornProbability");
     m_stubbornEndTime              = valuesDictionary.GetValue <double>("StubbornEndTime");
     m_periodicEventOffset          = m_random.Float(0f, 100f);
     m_isSaddled = base.Entity.ValuesDictionary.DatabaseObject.Name.EndsWith("_Saddled");
     m_stateMachine.AddState("Inactive", null, delegate
     {
         if (m_subsystemTime.PeriodicGameTimeEvent(1.0, m_periodicEventOffset) && m_componentMount.Rider != null && m_random.Float(0f, 1f) < m_stubbornProbability && (!m_isSaddled || m_componentEatPickableBehavior.Satiation <= 0f))
         {
             m_stubbornEndTime = m_subsystemGameInfo.TotalElapsedGameTime + (double)m_random.Float(60f, 120f);
         }
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Stubborn");
         }
     }, null);
     m_stateMachine.AddState("Stubborn", null, delegate
     {
         if (m_componentSteedBehavior.WasOrderIssued)
         {
             m_componentCreature.ComponentCreatureModel.HeadShakeOrder = m_random.Float(0.6f, 1f);
             m_componentCreature.ComponentCreatureSounds.PlayPainSound();
         }
     }, null);
     m_stateMachine.TransitionTo("Inactive");
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemPlayers   = base.Project.FindSubsystem <SubsystemPlayers>(throwOnError: true);
     m_subsystemTime      = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemUpdate    = base.Project.FindSubsystem <SubsystemUpdate>(throwOnError: true);
     m_subsystemGameInfo  = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemTimeOfDay = base.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true);
     m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_componentPlayer    = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
     m_sleepStartTime     = valuesDictionary.GetValue <double>("SleepStartTime");
     m_allowManualWakeUp  = valuesDictionary.GetValue <bool>("AllowManualWakeUp");
     if (m_sleepStartTime == 0.0)
     {
         m_sleepStartTime = null;
     }
     if (m_sleepStartTime.HasValue)
     {
         m_sleepFactor = 1f;
         m_minWetness  = float.MaxValue;
     }
     m_componentPlayer.ComponentHealth.Attacked += delegate
     {
         if (IsSleeping && m_componentPlayer.ComponentVitalStats.Sleep > 0.25f)
         {
             WakeUp();
         }
     };
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemGameInfo    = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_componentCreature    = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_milkRegenerationTime = valuesDictionary.GetValue <float>("MilkRegenerationTime");
     m_lastMilkingTime      = valuesDictionary.GetValue <double>("LastMilkingTime");
 }
Beispiel #8
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, IdToEntityMap idToEntityMap)
 {
     m_subsystemTime        = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemNoise       = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true);
     m_subsystemTerrain     = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemGameInfo    = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_componentCreature    = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPlayer      = base.Entity.FindComponent <ComponentPlayer>();
     m_componentLevel       = base.Entity.FindComponent <ComponentLevel>();
     m_componentClothing    = base.Entity.FindComponent <ComponentClothing>();
     m_componentMount       = base.Entity.FindComponent <ComponentMount>();
     m_componentRider       = base.Entity.FindComponent <ComponentRider>();
     IsCreativeFlyEnabled   = valuesDictionary.GetValue <bool>("IsCreativeFlyEnabled");
     AccelerationFactor     = valuesDictionary.GetValue <float>("AccelerationFactor");
     WalkSpeed              = valuesDictionary.GetValue <float>("WalkSpeed");
     LadderSpeed            = valuesDictionary.GetValue <float>("LadderSpeed");
     JumpSpeed              = valuesDictionary.GetValue <float>("JumpSpeed");
     CreativeFlySpeed       = valuesDictionary.GetValue <float>("CreativeFlySpeed");
     FlySpeed               = valuesDictionary.GetValue <float>("FlySpeed");
     SwimSpeed              = valuesDictionary.GetValue <float>("SwimSpeed");
     TurnSpeed              = valuesDictionary.GetValue <float>("TurnSpeed");
     LookSpeed              = valuesDictionary.GetValue <float>("LookSpeed");
     InAirWalkFactor        = valuesDictionary.GetValue <float>("InAirWalkFactor");
     m_walkSpeedWhenTurning = valuesDictionary.GetValue <float>("WalkSpeedWhenTurning");
     m_minFrictionFactor    = valuesDictionary.GetValue <float>("MinFrictionFactor");
     m_lookAutoLevelX       = valuesDictionary.GetValue <bool>("LookAutoLevelX");
     m_lookAutoLevelY       = valuesDictionary.GetValue <bool>("LookAutoLevelY");
     if (base.Entity.FindComponent <ComponentPlayer>() == null)
     {
         WalkSpeed *= m_random.Float(0.85f, 1f);
         FlySpeed  *= m_random.Float(0.85f, 1f);
         SwimSpeed *= m_random.Float(0.85f, 1f);
     }
 }
Beispiel #10
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            base.Load(valuesDictionary, idToEntityMap);
            m_subsystemGameInfo         = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemTime             = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
            m_subsystemAudio            = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_subsystemPickables        = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
            m_subsystemTerrain          = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            ComponentGui                = base.Entity.FindComponent <ComponentGui>(throwOnError: true);
            ComponentInput              = base.Entity.FindComponent <ComponentInput>(throwOnError: true);
            ComponentScreenOverlays     = base.Entity.FindComponent <ComponentScreenOverlays>(throwOnError: true);
            ComponentBlockHighlight     = base.Entity.FindComponent <ComponentBlockHighlight>(throwOnError: true);
            ComponentAimingSights       = base.Entity.FindComponent <ComponentAimingSights>(throwOnError: true);
            ComponentMiner              = base.Entity.FindComponent <ComponentMiner>(throwOnError: true);
            ComponentRider              = base.Entity.FindComponent <ComponentRider>(throwOnError: true);
            ComponentSleep              = base.Entity.FindComponent <ComponentSleep>(throwOnError: true);
            ComponentVitalStats         = base.Entity.FindComponent <ComponentVitalStats>(throwOnError: true);
            ComponentSickness           = base.Entity.FindComponent <ComponentSickness>(throwOnError: true);
            ComponentFlu                = base.Entity.FindComponent <ComponentFlu>(throwOnError: true);
            ComponentLevel              = base.Entity.FindComponent <ComponentLevel>(throwOnError: true);
            ComponentClothing           = base.Entity.FindComponent <ComponentClothing>(throwOnError: true);
            ComponentOuterClothingModel = base.Entity.FindComponent <ComponentOuterClothingModel>(throwOnError: true);
            int playerIndex = valuesDictionary.GetValue <int>("PlayerIndex");

            PlayerData = base.Project.FindSubsystem <SubsystemPlayers>(throwOnError: true).PlayersData.First((PlayerData d) => d.PlayerIndex == playerIndex);
        }
Beispiel #11
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemViews    = base.Project.FindSubsystem <SubsystemGameWidgets>(throwOnError: true);
     m_subsystemTerrain  = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     foreach (ValuesDictionary value11 in valuesDictionary.GetValue <ValuesDictionary>("Texts").Values)
     {
         Point3 value   = value11.GetValue <Point3>("Point");
         string value2  = value11.GetValue("Line1", string.Empty);
         string value3  = value11.GetValue("Line2", string.Empty);
         string value4  = value11.GetValue("Line3", string.Empty);
         string value5  = value11.GetValue("Line4", string.Empty);
         Color  value6  = value11.GetValue("Color1", Color.Black);
         Color  value7  = value11.GetValue("Color2", Color.Black);
         Color  value8  = value11.GetValue("Color3", Color.Black);
         Color  value9  = value11.GetValue("Color4", Color.Black);
         string value10 = value11.GetValue("Url", string.Empty);
         SetSignData(value, new string[4]
         {
             value2,
             value3,
             value4,
             value5
         }, new Color[4]
         {
             value6,
             value7,
             value8,
             value9
         }, value10);
     }
     CreateRenderTarget();
     Display.DeviceReset += Display_DeviceReset;
 }
 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);
     }
 }
Beispiel #13
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemTerrain       = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemBlockEntities = base.Project.FindSubsystem <SubsystemBlockEntities>(throwOnError: true);
     m_subsystemGameInfo      = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemAudio         = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
 }
Beispiel #14
0
        public override void Load(ValuesDictionary valuesDictionary)
        {
            SubsystemGameInfo subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);

            m_colors       = subsystemGameInfo.WorldSettings.Palette.Colors.ToArray();
            m_names        = subsystemGameInfo.WorldSettings.Palette.Names.ToArray();
            m_fabricColors = CreateFabricColors(m_colors);
        }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemAudio                   = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemGameInfo                = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemFireBlockBehavior       = base.Project.FindSubsystem <SubsystemFireBlockBehavior>(throwOnError: true);
     m_subsystemExplosivesBlockBehavior = base.Project.FindSubsystem <SubsystemExplosivesBlockBehavior>(throwOnError: true);
 }
Beispiel #16
0
 // Methods
 protected override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     this.m_subsystemGameInfo      = base.Project.FindSubsystem <SubsystemGameInfo>(true);
     this.m_subsystemEntityFactory = base.Project.FindSubsystem <SubsystemEntityFactory>(true);
     this.m_subsystemCreatureSpawn = base.Project.FindSubsystem <SubsystemCreatureSpawn>(true);
     this.m_subsystemGui           = base.Project.FindSubsystem <SubsystemGui>(true);
 }
Beispiel #17
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     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_lootDropped        = valuesDictionary.GetValue <bool>("LootDropped");
     m_lootList           = ParseLootList(valuesDictionary.GetValue <ValuesDictionary>("Loot"));
     m_lootOnFireList     = ParseLootList(valuesDictionary.GetValue <ValuesDictionary>("LootOnFire"));
 }
 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_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_componentPlayer   = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
     m_playIntro         = valuesDictionary.GetValue <bool>("PlayIntro");
     m_stateMachine.AddState("ShipView", ShipView_Enter, ShipView_Update, null);
 }
Beispiel #19
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");
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemGameInfo                          = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemSoundMaterials                    = base.Project.FindSubsystem <SubsystemSoundMaterials>(throwOnError: true);
     m_subsystemMovingBlocks                      = base.Project.FindSubsystem <SubsystemMovingBlocks>(throwOnError: true);
     m_subsystemMovingBlocks.Stopped             += MovingBlocksStopped;
     m_subsystemMovingBlocks.CollidedWithTerrain += MovingBlocksCollidedWithTerrain;
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemGameInfo     = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemItemsScanner = base.Project.FindSubsystem <SubsystemItemsScanner>(throwOnError: true);
     m_lastRotTime           = valuesDictionary.GetValue <double>("LastRotTime");
     m_rotStep = valuesDictionary.GetValue <int>("RotStep");
     m_subsystemItemsScanner.ItemsScanned += ItemsScanned;
     m_isRotEnabled = (m_subsystemGameInfo.WorldSettings.GameMode != 0 && m_subsystemGameInfo.WorldSettings.GameMode != GameMode.Adventure);
 }
Beispiel #22
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_enumerator        = m_saplings.Values.GetEnumerator();
     foreach (string value in valuesDictionary.GetValue <ValuesDictionary>("Saplings").Values)
     {
         AddSapling(LoadSaplingData(value));
     }
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemTime     = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemAudio    = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_componentPlayer   = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
     StrengthFactor      = 1f;
     SpeedFactor         = 1f;
     HungerFactor        = 1f;
     ResilienceFactor    = 1f;
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTime     = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemViews    = base.Project.FindSubsystem <SubsystemGameWidgets>(throwOnError: true);
     m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemSky      = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
     m_componentFrame    = base.Entity.FindComponent <ComponentFrame>(throwOnError: true);
     m_componentModel    = base.Entity.FindComponent <ComponentModel>(throwOnError: true);
     m_creationTime      = m_subsystemTime.GameTime;
     Heading             = valuesDictionary.GetValue <float>("Heading");
 }
Beispiel #25
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemGameInfo       = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_subsystemTimeOfDay      = base.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true);
            m_subsystemTerrain        = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            m_subsystemBlockBehaviors = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
            m_componentPlayer         = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
            ContainerWidget guiWidget = m_componentPlayer.GuiWidget;

            m_backButtonWidget        = guiWidget.Children.Find <ButtonWidget>("BackButton");
            m_inventoryButtonWidget   = guiWidget.Children.Find <ButtonWidget>("InventoryButton");
            m_clothingButtonWidget    = guiWidget.Children.Find <ButtonWidget>("ClothingButton");
            m_moreButtonWidget        = guiWidget.Children.Find <ButtonWidget>("MoreButton");
            m_moreContentsWidget      = guiWidget.Children.Find <Widget>("MoreContents");
            m_helpButtonWidget        = guiWidget.Children.Find <ButtonWidget>("HelpButton");
            m_photoButtonWidget       = guiWidget.Children.Find <ButtonWidget>("PhotoButton");
            m_lightningButtonWidget   = guiWidget.Children.Find <ButtonWidget>("LightningButton");
            m_timeOfDayButtonWidget   = guiWidget.Children.Find <ButtonWidget>("TimeOfDayButton");
            m_cameraButtonWidget      = guiWidget.Children.Find <ButtonWidget>("CameraButton");
            m_creativeFlyButtonWidget = guiWidget.Children.Find <ButtonWidget>("CreativeFlyButton");
            m_sneakButtonWidget       = guiWidget.Children.Find <ButtonWidget>("SneakButton");
            m_mountButtonWidget       = guiWidget.Children.Find <ButtonWidget>("MountButton");
            m_editItemButton          = guiWidget.Children.Find <ButtonWidget>("EditItemButton");
            MoveWidget                     = guiWidget.Children.Find <TouchInputWidget>("Move");
            MoveRoseWidget                 = guiWidget.Children.Find <MoveRoseWidget>("MoveRose");
            LookWidget                     = guiWidget.Children.Find <TouchInputWidget>("Look");
            ViewWidget                     = m_componentPlayer.ViewWidget;
            HealthBarWidget                = guiWidget.Children.Find <ValueBarWidget>("HealthBar");
            FoodBarWidget                  = guiWidget.Children.Find <ValueBarWidget>("FoodBar");
            TemperatureBarWidget           = guiWidget.Children.Find <ValueBarWidget>("TemperatureBar");
            LevelLabelWidget               = guiWidget.Children.Find <LabelWidget>("LevelLabel");
            m_modalPanelContainerWidget    = guiWidget.Children.Find <ContainerWidget>("ModalPanelContainer");
            ControlsContainerWidget        = guiWidget.Children.Find <ContainerWidget>("ControlsContainer");
            m_leftControlsContainerWidget  = guiWidget.Children.Find <ContainerWidget>("LeftControlsContainer");
            m_rightControlsContainerWidget = guiWidget.Children.Find <ContainerWidget>("RightControlsContainer");
            m_moveContainerWidget          = guiWidget.Children.Find <ContainerWidget>("MoveContainer");
            m_lookContainerWidget          = guiWidget.Children.Find <ContainerWidget>("LookContainer");
            m_moveRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("MoveRectangle");
            m_lookRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("LookRectangle");
            m_moveRectangleContainerWidget = guiWidget.Children.Find <ContainerWidget>("MoveRectangleContainer");
            m_lookRectangleContainerWidget = guiWidget.Children.Find <ContainerWidget>("LookRectangleContainer");
            m_moveRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("MoveRectangle");
            m_lookRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("LookRectangle");
            m_movePadContainerWidget       = guiWidget.Children.Find <ContainerWidget>("MovePadContainer");
            m_lookPadContainerWidget       = guiWidget.Children.Find <ContainerWidget>("LookPadContainer");
            m_moveButtonsContainerWidget   = guiWidget.Children.Find <ContainerWidget>("MoveButtonsContainer");
            ShortInventoryWidget           = guiWidget.Children.Find <ShortInventoryWidget>("ShortInventory");
            m_largeMessageWidget           = guiWidget.Children.Find <ContainerWidget>("LargeMessage");
            m_messageWidget                = guiWidget.Children.Find <MessageWidget>("Message");
            m_keyboardHelpMessageShown     = valuesDictionary.GetValue <bool>("KeyboardHelpMessageShown");
            m_gamepadHelpMessageShown      = valuesDictionary.GetValue <bool>("GamepadHelpMessageShown");
        }
Beispiel #26
0
        public override void Load(ValuesDictionary valuesDictionary)
        {
            base.Load(valuesDictionary);
            m_subsystemTime     = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
            m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            string value = valuesDictionary.GetValue <string>("LeavesToCheck");

            Point3[] array = HumanReadableConverter.ValuesListFromString <Point3>(';', value);
            foreach (Point3 item in array)
            {
                m_leavesToCheck.Add(item);
            }
        }
Beispiel #27
0
 public IEnumerable <ActiveExternalContentInfo> GetRateableItems()
 {
     if (GameManager.Project != null && UserManager.ActiveUser != null)
     {
         SubsystemGameInfo subsystemGameInfo = GameManager.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
         foreach (ActiveExternalContentInfo item in subsystemGameInfo.GetActiveExternalContent())
         {
             if (!CommunityContentManager.IsContentRated(item.Address, UserManager.ActiveUser.UniqueId))
             {
                 yield return(item);
             }
         }
     }
 }
Beispiel #28
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            ComponentFrame      = base.Entity.FindComponent <ComponentFrame>(throwOnError: true);
            ComponentCreature   = base.Entity.FindComponent <ComponentCreature>();
            AutoDespawn         = valuesDictionary.GetValue <bool>("AutoDespawn");
            double value  = valuesDictionary.GetValue <double>("SpawnTime");
            double value2 = valuesDictionary.GetValue <double>("DespawnTime");

            SpawnDuration   = 2f;
            DespawnDuration = 2f;
            SpawnTime       = ((value < 0.0) ? m_subsystemGameInfo.TotalElapsedGameTime : value);
            DespawnTime     = ((value2 >= 0.0) ? new double?(value2) : null);
        }
Beispiel #29
0
 public static void SaveProject(bool waitForCompletion, bool showErrorDialog)
 {
     if (m_project != null)
     {
         double      realTime    = Time.RealTime;
         ProjectData projectData = m_project.Save();
         m_saveCompleted.WaitOne();
         m_saveCompleted.Reset();
         SubsystemGameInfo subsystemGameInfo = m_project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
         string            projectFileName   = Storage.CombinePaths(subsystemGameInfo.DirectoryName, "Project.xml");
         Exception         e = default(Exception);
         Task.Run(delegate
         {
             try
             {
                 WorldsManager.MakeQuickWorldBackup(subsystemGameInfo.DirectoryName);
                 XElement xElement = new XElement("Project");
                 projectData.Save(xElement);
                 XmlUtils.SetAttributeValue(xElement, "Version", VersionsManager.SerializationVersion);
                 Storage.CreateDirectory(subsystemGameInfo.DirectoryName);
                 using (Stream stream = Storage.OpenFile(projectFileName, OpenFileMode.Create))
                 {
                     XmlUtils.SaveXmlToStream(xElement, stream, null, throwOnError: true);
                 }
             }
             catch (Exception ex)
             {
                 e = ex;
                 if (showErrorDialog)
                 {
                     Dispatcher.Dispatch(delegate
                     {
                         DialogsManager.ShowDialog(null, new MessageDialog("Error saving game", e.Message, LanguageControl.Get("Usual", "ok"), null, null));
                     });
                 }
             }
             finally
             {
                 m_saveCompleted.Set();
             }
         });
         if (waitForCompletion)
         {
             m_saveCompleted.WaitOne();
         }
         double realTime2 = Time.RealTime;
         Log.Verbose($"Saved project, {MathUtils.Round((realTime2 - realTime) * 1000.0)}ms");
     }
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_subsystemTime     = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemSky      = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
     m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentCreature.ComponentHealth.Attacked += delegate(ComponentCreature attacker)
     {
         if (DeathPhase == 0f && m_componentCreature.ComponentHealth.Health == 0f)
         {
             DeathCauseOffset = attacker.ComponentBody.BoundingBox.Center() - m_componentCreature.ComponentBody.BoundingBox.Center();
         }
     };
 }