public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { base.Load(valuesDictionary, idToEntityMap); m_fireTimeRemaining = valuesDictionary.GetValue("FireTimeRemaining", 0f); HeatLevel = valuesDictionary.GetValue("HeatLevel", 0f); m_speed = valuesDictionary.GetValue("Speed", 1f); }
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; }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { subsystemTimeOfDay = Project.FindSubsystem <SubsystemTimeOfDay>(); subsystemBlockEntities = Project.FindSubsystem <SubsystemBlockEntities>(); subsystemViews = Project.FindSubsystem <SubsystemViews>(); quantity = valuesDictionary.GetValue <int>("Quantity"); maxquantity = valuesDictionary.GetValue <int>("MaxQuantity"); mode = valuesDictionary.GetValue <int>("Mode"); int value = valuesDictionary.GetValue <int>("SlotsCount"); for (int i = 0; i < value; i++) { m_slots.Add(new Slot()); } ValuesDictionary value2 = valuesDictionary.GetValue <ValuesDictionary>("Slots"); for (int j = 0; j < m_slots.Count; j++) { ValuesDictionary value3 = value2.GetValue <ValuesDictionary>("Slot" + j.ToString(CultureInfo.InvariantCulture), null); if (value3 != null) { Slot slot = m_slots[j]; slot.Value = value3.GetValue <int>("Contents"); slot.Count = value3.GetValue <int>("Count"); } } }
public override void Load(ValuesDictionary valuesDictionary) { m_subsystemTime = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true); m_subsystemProjectiles = base.Project.FindSubsystem <SubsystemProjectiles>(throwOnError: true); m_subsystemAudio = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true); base.Load(valuesDictionary); }
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, IdToEntityMap idToEntityMap) { m_activeSlotIndex = valuesDictionary.GetValue <int>("ActiveSlotIndex"); OpenSlotsCount = valuesDictionary.GetValue <int>("OpenSlotsCount"); CategoryIndex = valuesDictionary.GetValue <int>("CategoryIndex"); PageIndex = valuesDictionary.GetValue <int>("PageIndex"); for (int i = 0; i < OpenSlotsCount; i++) { m_slots.Add(0); } foreach (Block item in BlocksManager.Blocks.OrderBy((Block b) => b.DisplayOrder)) { foreach (int creativeValue in item.GetCreativeValues()) { m_slots.Add(creativeValue); } } ValuesDictionary value = valuesDictionary.GetValue <ValuesDictionary>("Slots", null); if (value == null) { return; } for (int j = 0; j < OpenSlotsCount; j++) { ValuesDictionary value2 = value.GetValue <ValuesDictionary>("Slot" + j.ToString(CultureInfo.InvariantCulture), null); if (value2 != null) { m_slots[j] = value2.GetValue <int>("Contents"); } } }
public static async Task <IIndexedDict[]> GetSchema(AsyncExprCtx ctx, QueryTemplate qt) { var conn = (IDbConn)await ctx.GetValue(qt.connName); var schema = (System.Data.DataTable) await conn.ExecCmd(new SqlCommandData() { Kind = CommandKind.GetSchema, SqlText = qt.queryTemplateText.Replace("{0}", string.Empty), ConvertMultiResultsToLists = qt.arrayResults }, ctx.Cancellation); int nCols = schema.Columns.Count; var key2ndx = new Dictionary <string, int>(nCols, StringComparer.OrdinalIgnoreCase); for (int i = 0; i < nCols; i++) { key2ndx[schema.Columns[i].ColumnName] = i; } int nRows = schema.Rows.Count; var res = new IIndexedDict[nRows]; for (int i = 0; i < nRows; i++) { res[i] = ValuesDictionary.New(schema.Rows[i].ItemArray, key2ndx); } return(res); // todo }
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) { base.Load(valuesDictionary); m_subsystemTerrain = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true); m_subsystemParticles = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true); m_subsystemAudio = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true); }
public override void Save(ValuesDictionary valuesDictionary) { base.Save(valuesDictionary); string value = HumanReadableConverter.ValuesListToString(';', m_leavesToCheck.ToArray()); valuesDictionary.SetValue("LeavesToCheck", value); }
public override void Load(ValuesDictionary valuesDictionary) { m_blockBehaviorsByContents = new SubsystemBlockBehavior[BlocksManager.Blocks.Length][]; Dictionary <int, List <SubsystemBlockBehavior> > dictionary = new Dictionary <int, List <SubsystemBlockBehavior> >(); for (int i = 0; i < m_blockBehaviorsByContents.Length; i++) { dictionary[i] = new List <SubsystemBlockBehavior>(); string[] array = BlocksManager.Blocks[i].Behaviors.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string text in array) { SubsystemBlockBehavior item = base.Project.FindSubsystem <SubsystemBlockBehavior>(text.Trim(), throwOnError: true); dictionary[i].Add(item); } } foreach (SubsystemBlockBehavior item2 in base.Project.FindSubsystems <SubsystemBlockBehavior>()) { m_blockBehaviors.Add(item2); int[] handledBlocks = item2.HandledBlocks; foreach (int key in handledBlocks) { dictionary[key].Add(item2); } } for (int k = 0; k < m_blockBehaviorsByContents.Length; k++) { m_blockBehaviorsByContents[k] = dictionary[k].ToArray(); } }
public override void Load(ValuesDictionary valuesDictionary) { m_subsystemTerrain = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true); m_subsystemAudio = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true); m_impactsSoundsValuesDictionary = valuesDictionary.GetValue <ValuesDictionary>("ImpactSounds"); m_footstepSoundsValuesDictionary = valuesDictionary.GetValue <ValuesDictionary>("FootstepSounds"); }
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 WorldPalette(ValuesDictionary valuesDictionary) { string[] array = valuesDictionary.GetValue("Colors", new string(';', 15)).Split(';'); if (array.Length != 16) { throw new InvalidOperationException("Invalid colors."); } Colors = array.Select((string s, int i) => (!string.IsNullOrEmpty(s)) ? HumanReadableConverter.ConvertFromString <Color>(s) : DefaultColors[i]).ToArray(); string[] array2 = valuesDictionary.GetValue("Names", new string(';', 15)).Split(';'); if (array2.Length != 16) { throw new InvalidOperationException("Invalid color names."); } Names = array2.Select((string s, int i) => (!string.IsNullOrEmpty(s)) ? s : LanguageControl.Get(GetType().Name, i)).ToArray(); string[] names = Names; int num = 0; while (true) { if (num < names.Length) { if (!VerifyColorName(names[num])) { break; } num++; continue; } return; } throw new InvalidOperationException("Invalid color name."); }
public override void Save(ValuesDictionary valuesDictionary) { base.Save(valuesDictionary); string value = HumanReadableConverter.ValuesListToString(';', m_magnets.ToArray()); valuesDictionary.SetValue("Magnets", value); }
public override void Load(ValuesDictionary valuesDictionary) { base.Load(valuesDictionary); SubsystemTime = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true); SubsystemAudio = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true); SubsystemAmbientSounds = base.Project.FindSubsystem <SubsystemAmbientSounds>(throwOnError: true); }
public override void Load(ValuesDictionary valuesDictionary) { foreach (IDrawable item in base.Project.FindSubsystems <IDrawable>()) { AddDrawable(item); } }
public override void OnBlockAdded(int value, int oldValue, int x, int y, int z) { string name; switch (Terrain.ExtractContents(value)) { case BlastFurnaceBlock.Index: name = "BlastFurnace"; break; case CovenBlock.Index: name = "CokeOven"; break; case HearthFurnaceBlock.Index: name = "HearthFurnace"; break; case TankBlock.Index: if (TankBlock.GetType(value) == TankBlock.Type.FractionatingTower) { name = "FractionalTower"; break; } return; default: return; } var vd = new ValuesDictionary(); vd.PopulateFromDatabaseObject(Project.GameDatabase.Database.FindDatabaseObject(name, Project.GameDatabase.EntityTemplateType, true)); vd.GetValue <ValuesDictionary>("BlockEntity").SetValue("Coordinates", new Point3(x, y, z)); Project.AddEntity(Project.CreateEntity(vd)); }
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 static bool CompareValueDictionaries(ValuesDictionary d1, ValuesDictionary d2) { if (d1.Count != d2.Count) { return(false); } foreach (KeyValuePair <string, object> item in d1) { object value = d2.GetValue <object>(item.Key, null); ValuesDictionary valuesDictionary = value as ValuesDictionary; if (valuesDictionary != null) { ValuesDictionary valuesDictionary2 = item.Value as ValuesDictionary; if (valuesDictionary2 == null || !CompareValueDictionaries(valuesDictionary, valuesDictionary2)) { return(false); } } else if (!object.Equals(value, item.Value)) { return(false); } } return(true); }
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, 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_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); } }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { m_subsystemFurnitureBlockBehavior = base.Project.FindSubsystem <SubsystemFurnitureBlockBehavior>(throwOnError: true); string furnitureSetName = valuesDictionary.GetValue <string>("FurnitureSet"); FurnitureSet = m_subsystemFurnitureBlockBehavior.FurnitureSets.FirstOrDefault((FurnitureSet f) => f.Name == furnitureSetName); }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { base.Load(valuesDictionary, idToEntityMap); m_furnaceSize = SlotsCount - 2; m_fireTimeRemaining = valuesDictionary.GetValue("FireTimeRemaining", 0f); HeatLevel = valuesDictionary.GetValue("HeatLevel", 0f); }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { m_subsystemBodies = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true); m_subsystemTerrain = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true); ComponentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true); m_riderOffset = valuesDictionary.GetValue <Vector3>("RiderOffset"); }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { base.Load(valuesDictionary, idToEntityMap); m_walkAnimationSpeed = valuesDictionary.GetValue <float>("WalkAnimationSpeed"); m_walkLegsAngle = valuesDictionary.GetValue <float>("WalkLegsAngle"); m_walkBobHeight = valuesDictionary.GetValue <float>("WalkBobHeight"); }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { m_subsystemTime = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true); m_subsystemBodies = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true); m_subsystemTerrain = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true); m_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: 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); } }
/// <summary> /// Default constructor, creates an ExpressionParser object /// </summary> public ExpressionParser() { // Cache for values and expressions htbl = new ValuesDictionary(); cachedExpressions = new ExpressionDictionary(); // Add all valid operators. DefaultOperators operators = new DefaultOperators(); ops = new Dictionary<string, Operator>(); foreach (Operator op in operators.Operators) { string symbol = op.Symbol; if(symbol.Length > maxoplength) { maxoplength = symbol.Length; } ops.Add(symbol, op); } // Constants spconst = new Dictionary<string, double>(); spconst.Add( "euler", Math.E ); spconst.Add( "pi" , Math.PI ); spconst.Add( "nan" , double.NaN ); spconst.Add( "infinity" , double.PositiveInfinity ); spconst.Add( "true" , 1D ); spconst.Add( "false", 0D ); treeParser = new TreeParser(ops, spconst); treeParser.ImplicitMultiplication = true; treeParser.RequireParentheses = true; Culture = CultureInfo.InvariantCulture; }