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) { 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, 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) { base.Load(valuesDictionary); m_subsystemBodies = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true); m_subsystemAudio = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true); m_subsystemNoise = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true); }
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) { m_subsystemTime = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true); m_subsystemSky = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true); m_subsystemBodies = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true); m_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true); m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true); m_dayRange = valuesDictionary.GetValue <float>("DayRange"); m_nightRange = valuesDictionary.GetValue <float>("NightRange"); m_stateMachine.AddState("Inactive", delegate { m_importanceLevel = 0f; m_target = null; }, delegate { if (IsActive) { m_stateMachine.TransitionTo("Move"); } m_target = FindTarget(out float targetScore); if (m_target != null) { Vector3.Distance(m_target.ComponentBody.Position, m_componentCreature.ComponentBody.Position); SetImportanceLevel(targetScore); } else { m_importanceLevel = 0f; } }, null);
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_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true); m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true); m_stareRange = valuesDictionary.GetValue <float>("StareRange"); m_stateMachine.AddState("Inactive", delegate { m_importanceLevel = 0f; }, delegate { if (m_subsystemTime.GameTime > m_stareEndTime + 8.0 && m_random.Float(0f, 1f) < 1f * m_subsystemTime.GameTimeDelta) { m_target = FindTarget(); if (m_target != null) { float probability = (m_target.Entity.FindComponent <ComponentPlayer>() != null) ? 1f : 0.25f; if (m_random.Bool(probability)) { m_importanceLevel = m_random.Float(3f, 5f); } } } if (IsActive) { m_stateMachine.TransitionTo("Stare"); } }, null); m_stateMachine.AddState("Stare", delegate { m_stareEndTime = m_subsystemTime.GameTime + (double)m_random.Float(6f, 12f); if (m_target != null) { Vector3 position = m_componentCreature.ComponentBody.Position; Vector3 v = Vector3.Normalize(m_target.ComponentBody.Position - position); m_componentPathfinding.SetDestination(position + 1.1f * v, m_random.Float(0.3f, 0.4f), 1f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null); if (m_random.Float(0f, 1f) < 0.5f) { m_componentCreature.ComponentCreatureSounds.PlayIdleSound(skipIfRecentlyPlayed: false); } } }, delegate { if (!IsActive || m_target == null || m_componentPathfinding.IsStuck || m_subsystemTime.GameTime > m_stareEndTime) { m_stateMachine.TransitionTo("Inactive"); } else if (m_random.Float(0f, 1f) < 1f * m_subsystemTime.GameTimeDelta && ScoreTarget(m_target) <= 0f) { m_stateMachine.TransitionTo("Inactive"); } else { m_componentCreature.ComponentCreatureModel.LookAtOrder = m_target.ComponentCreatureModel.EyePosition; } }, null); m_stateMachine.TransitionTo("Inactive"); }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { m_subsystemBodies = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true); m_subsystemTerrain = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true); m_subsystemAudio = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true); m_subsystemTime = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true); m_subsystemNoise = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true); m_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true); m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true); m_componentCreature.ComponentBody.CollidedWithBody += delegate { if (m_stateMachine.CurrentState != "RunningAway") { m_stateMachine.TransitionTo("DangerDetected"); } }; m_stateMachine.AddState("LookingForDanger", null, delegate { if (ScanForDanger()) { m_stateMachine.TransitionTo("DangerDetected"); } }, null); m_stateMachine.AddState("DangerDetected", delegate { m_importanceLevel = ((m_componentCreature.ComponentHealth.Health < 0.33f) ? 300 : 100); m_nextUpdateTime = 0.0; }, delegate { if (IsActive) { m_stateMachine.TransitionTo("RunningAway"); m_nextUpdateTime = 0.0; } }, null); m_stateMachine.AddState("RunningAway", delegate { m_componentPathfinding.SetDestination(FindSafePlace(), 1f, 1f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null); m_subsystemAudio.PlayRandomSound("Audio/Creatures/Wings", 0.8f, m_random.Float(-0.1f, 0.2f), m_componentCreature.ComponentBody.Position, 3f, autoDelay: true); m_componentCreature.ComponentCreatureSounds.PlayPainSound(); m_subsystemNoise.MakeNoise(m_componentCreature.ComponentBody, 0.25f, 6f); }, delegate { if (!IsActive || !m_componentPathfinding.Destination.HasValue || m_componentPathfinding.IsStuck) { m_stateMachine.TransitionTo("LookingForDanger"); } else if (ScoreSafePlace(m_componentCreature.ComponentBody.Position, m_componentPathfinding.Destination.Value, null) < 4f) { m_componentPathfinding.SetDestination(FindSafePlace(), 1f, 0.5f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null); } }, delegate { m_importanceLevel = 0f; }); m_stateMachine.TransitionTo("LookingForDanger"); }
public MotionDetectorElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace) : base(subsystemElectricity, cellFace) { m_subsystemBodies = subsystemElectricity.Project.FindSubsystem <SubsystemBodies>(throwOnError: true); m_center = new Vector3(cellFace.X, cellFace.Y, cellFace.Z) + new Vector3(0.5f) - 0.25f * m_direction; m_direction = CellFace.FaceToVector3(cellFace.Face); Vector3 vector = Vector3.One - new Vector3(MathUtils.Abs(m_direction.X), MathUtils.Abs(m_direction.Y), MathUtils.Abs(m_direction.Z)); Vector3 vector2 = m_center - 8f * vector; Vector3 vector3 = m_center + 8f * (vector + m_direction); m_corner1 = new Vector2(vector2.X, vector2.Z); m_corner2 = new Vector2(vector3.X, vector3.Z); }
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); }
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_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true); m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true); m_componentMount = base.Entity.FindComponent <ComponentMount>(throwOnError: true); m_isEnabled = base.Entity.ValuesDictionary.DatabaseObject.Name.EndsWith("_Saddled"); m_stateMachine.AddState("Inactive", null, delegate { if (IsActive) { m_stateMachine.TransitionTo("Wait"); } }, null); m_stateMachine.AddState("Wait", delegate { ComponentRider componentRider = FindNearbyRider(6f); if (componentRider != null) { m_componentPathfinding.SetDestination(componentRider.ComponentCreature.ComponentBody.Position, m_random.Float(0.2f, 0.3f), 3.25f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null); if (m_random.Float(0f, 1f) < 0.5f) { m_componentCreature.ComponentCreatureSounds.PlayIdleSound(skipIfRecentlyPlayed: true); } } }, delegate { if (m_componentMount.Rider != null) { m_stateMachine.TransitionTo("Steed"); } m_componentCreature.ComponentCreatureModel.LookRandomOrder = true; }, null); m_stateMachine.AddState("Steed", delegate { m_componentPathfinding.Stop(); m_speed = 0f; m_speedLevel = 1; }, delegate { ProcessRidingOrders(); }, null); m_stateMachine.TransitionTo("Inactive"); }
public static void Load(Project Project) { if (LoadedProject) { return; } SubsystemGameInfo = Project.FindSubsystem <SubsystemGameInfo>(true); SubsystemAudio = Project.FindSubsystem <SubsystemAudio>(true); SubsystemBodies = Project.FindSubsystem <SubsystemBodies>(true); SubsystemTime = Project.FindSubsystem <SubsystemTime>(true); SubsystemItemsScanner = Project.FindSubsystem <SubsystemItemsScanner>(true); SubsystemMovingBlocks = Project.FindSubsystem <SubsystemMovingBlocks>(true); SubsystemBlockEntities = Project.FindSubsystem <SubsystemBlockEntities>(true); SubsystemExplosions = Project.FindSubsystem <SubsystemExplosions>(true); SubsystemCollapsingBlockBehavior = Project.FindSubsystem <SubsystemCollapsingBlockBehavior>(true); SubsystemPickables = Project.FindSubsystem <SubsystemPickables>(true); SubsystemProjectiles = Project.FindSubsystem <SubsystemProjectiles>(true); Terrain = (SubsystemTerrain = Project.FindSubsystem <SubsystemTerrain>(true)).Terrain; LoadedProject = true; }
public override void Load(ValuesDictionary valuesDictionary) { m_subsystemTimeOfDay = base.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true); m_subsystemTime = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true); m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true); m_subsystemTerrain = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true); m_subsystemWeather = base.Project.FindSubsystem <SubsystemWeather>(throwOnError: true); m_subsystemAudio = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true); m_subsystemBodies = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true); m_subsystemFluidBlockBehavior = base.Project.FindSubsystem <SubsystemFluidBlockBehavior>(throwOnError: true); m_sunTexture = ContentManager.Get <Texture2D>("Textures/Sun"); m_glowTexture = ContentManager.Get <Texture2D>("Textures/SkyGlow"); m_cloudsTexture = ContentManager.Get <Texture2D>("Textures/Clouds"); for (int i = 0; i < 8; i++) { m_moonTextures[i] = ContentManager.Get <Texture2D>("Textures/Moon" + (i + 1).ToString(CultureInfo.InvariantCulture)); } UpdateLightAndViewParameters(); Display.DeviceReset += Display_DeviceReset; }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { 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_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true); m_subsystemTime = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true); m_subsystemAudio = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true); m_subsystemSoundMaterials = base.Project.FindSubsystem <SubsystemSoundMaterials>(throwOnError: true); m_subsystemBlockBehaviors = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true); ComponentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true); ComponentPlayer = base.Entity.FindComponent <ComponentPlayer>(); if (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative && ComponentPlayer != null) { Inventory = base.Entity.FindComponent <ComponentCreativeInventory>(); } else { Inventory = base.Entity.FindComponent <ComponentInventory>(); } AttackPower = valuesDictionary.GetValue <float>("AttackPower"); }
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_subsystemSky = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true); m_subsystemBodies = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true); m_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true); m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true); m_dayRange = valuesDictionary.GetValue <float>("DayRange"); m_nightRange = valuesDictionary.GetValue <float>("NightRange"); m_minRange = valuesDictionary.GetValue <float>("MinRange"); m_stateMachine.AddState("Inactive", delegate { m_importanceLevel = 0f; m_target = null; }, delegate { if (IsActive) { m_stateMachine.TransitionTo("Move"); } if (m_subsystemGameInfo.WorldSettings.GameMode > GameMode.Harmless) { m_target = FindTarget(); if (m_target != null) { ComponentPlayer componentPlayer = m_target.Entity.FindComponent <ComponentPlayer>(); if (componentPlayer != null && componentPlayer.ComponentSleep.IsSleeping) { m_importanceLevel = 5f; } else if (m_random.Float(0f, 1f) < 0.05f * m_dt) { m_importanceLevel = m_random.Float(1f, 4f); } } else { m_importanceLevel = 0f; } } }, null); m_stateMachine.AddState("Move", delegate { if (m_target != null) { m_componentPathfinding.SetDestination(m_target.ComponentBody.Position, m_random.Float(0.5f, 0.7f), m_minRange, 500, useRandomMovements: true, ignoreHeightDifference: true, raycastDestination: false, null); } }, delegate { if (!IsActive) { m_stateMachine.TransitionTo("Inactive"); } else if (m_target == null || m_componentPathfinding.IsStuck || !m_componentPathfinding.Destination.HasValue || ScoreTarget(m_target) <= 0f) { m_importanceLevel = 0f; } if (m_random.Float(0f, 1f) < 0.1f * m_dt) { m_componentCreature.ComponentCreatureSounds.PlayIdleSound(skipIfRecentlyPlayed: true); } m_componentCreature.ComponentCreatureModel.LookRandomOrder = true; }, null); m_stateMachine.TransitionTo("Inactive"); }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { flatBatch = primitivesRenderer.FlatBatch(); componentPlayer = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true); subsystemTerrain = base.Entity.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true); subsystemPlantBlock = base.Entity.Project.FindSubsystem <SubsystemPlantBlockBehavior>(throwOnError: true); creatureSpawn = Project.FindSubsystem <SubsystemCreatureSpawn>(); modelsRenderer = base.Entity.Project.FindSubsystem <SubsystemModelsRenderer>(); subsystemBodies = Project.FindSubsystem <SubsystemBodies>(); jeiBehavior = base.Entity.Project.FindSubsystem <SubsystemXjJeiBehavior>(); jump.Texture = TextureAtlasManager.GetSubtexture("JEITextures/JEI_Jump").Texture; jumpcanvas.Children.Add(touch); jumpcanvas.Children.Add(jump); jumpcanvas.DesiredSize = SubsystemXjJeiBehavior.jumpsize; jump.DesiredSize = SubsystemXjJeiBehavior.jumpsize; jumpcanvas.IsVisible = SubsystemXjJeiBehavior.showjump; messageInfo.setPlayer(componentPlayer); if (componentPlayer != null) { msginfobtn.NormalSubtexture = new Subtexture(ContentManager.Get <Texture2D>("JEITextures/JEI_MSG"), Vector2.Zero, Vector2.One); msginfobtn.ClickedSubtexture = new Subtexture(ContentManager.Get <Texture2D>("JEITextures/JEI_MSG_P"), Vector2.Zero, Vector2.One); componentPlayer.GuiWidget.Children.Find <CanvasWidget>("ControlsContainer").Children.Add(infoDialog); componentPlayer.GuiWidget.Children.Find <CanvasWidget>("ControlsContainer").Children.Add(messageInfo); componentPlayer.GuiWidget.Children.Find <CanvasWidget>("ControlsContainer").Children.Add(moreInfo); componentPlayer.GuiWidget.Children.Find <StackPanelWidget>("RightControlsContainer").Children.Add(msginfobtn); componentPlayer.GuiWidget.Children.Find <CanvasWidget>("ControlsContainer").Children.Add(jumpcanvas); } int num = 0; try { List <string> namelist = new List <string>(); Dictionary <string, List <string> > depancys = new Dictionary <string, List <string> >(); List <uint> verList = new List <uint>(); foreach (ModInfo modInfo in ModsManager.LoadedMods) { if (!namelist.Contains(modInfo.Name)) { if (!string.IsNullOrEmpty(modInfo.Dependency)) { string[] mm = modInfo.Dependency.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); List <string> mlist = new List <string>(); if (mm.Length == 1) { mlist.Add(modInfo.Dependency); } else { foreach (string mmsa in mm) { mlist.Add(mmsa); } } depancys.Add(modInfo.Name, mlist); } namelist.Add(modInfo.Name); verList.Add(modInfo.Version); } } messageInfo.addMessage("[color=yellow]欢迎使用[/color][color=red]SCCRF合成书[/color][color=yellow]模组![/color]"); messageInfo.addMessage($"[color=green]<SCCRF>:[/color]使用一根[color=red]木棍[/color]开始你的[color=green]合成之旅[/color]"); messageInfo.addMessage($"[color=green]<SCCRF>:[/color]电脑端按下[color=red]TAB[/color]快捷打开[color=green]消息框[/color]"); messageInfo.addMessage($"[color=green]<SCCRF>:[/color]电脑端按下[color=red]B[/color]快捷打开[color=green]合成谱[/color]"); messageInfo.addMessage($"[color=green]<SCCRF>:[/color]输入[color=red]/help[/color]使用[color=green]命令[/color]帮助"); messageInfo.addMessage($"[color=green]并且您已安装([/color][color=red]{namelist.Count}[/color][color=green])个模组[/color]"); foreach (string modInfo in namelist) { messageInfo.addMessage($"[color=blue]{num+1}.[/color] {modInfo.Replace('[','{').Replace(']','}')} [color=yellow]{parseVersion(verList[num])}[/color]"); num++; } num = 0; foreach (KeyValuePair <string, List <string> > kkop in depancys) { foreach (string huap in kkop.Value) { if (!namelist.Contains(huap)) { if (huap == "zh-cn" && namelist.Contains("NewBlocks_SC")) { continue; } messageInfo.addMessage($"[color=yellow]<警告>[/color]:使用[color=blue]{kkop.Key}[/color]需要安装依赖MOD [color=green]{huap}[/color]"); } } ++num; } messageInfo.IsVisible = false; } catch (Exception e) { messageInfo.addMessage(e.ToString()); } infoDialog.IsVisible = false; base.Load(valuesDictionary, idToEntityMap); }
public override void Load(ValuesDictionary valuesDictionary) { m_subsystemBodies = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true); }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true); m_subsystemPlayers = base.Project.FindSubsystem <SubsystemPlayers>(throwOnError: true); m_subsystemSky = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true); m_subsystemBodies = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true); m_subsystemTime = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true); m_subsystemNoise = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true); m_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true); m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true); m_componentMiner = base.Entity.FindComponent <ComponentMiner>(throwOnError: true); m_componentFeedBehavior = base.Entity.FindComponent <ComponentRandomFeedBehavior>(); m_componentCreatureModel = base.Entity.FindComponent <ComponentCreatureModel>(throwOnError: true); m_dayChaseRange = valuesDictionary.GetValue <float>("DayChaseRange"); m_nightChaseRange = valuesDictionary.GetValue <float>("NightChaseRange"); m_dayChaseTime = valuesDictionary.GetValue <float>("DayChaseTime"); m_nightChaseTime = valuesDictionary.GetValue <float>("NightChaseTime"); m_autoChaseMask = valuesDictionary.GetValue <CreatureCategory>("AutoChaseMask"); m_chaseNonPlayerProbability = valuesDictionary.GetValue <float>("ChaseNonPlayerProbability"); m_chaseWhenAttackedProbability = valuesDictionary.GetValue <float>("ChaseWhenAttackedProbability"); m_chaseOnTouchProbability = valuesDictionary.GetValue <float>("ChaseOnTouchProbability"); m_componentCreature.ComponentHealth.Attacked += delegate(ComponentCreature attacker) { if (m_random.Float(0f, 1f) < m_chaseWhenAttackedProbability) { if (m_chaseWhenAttackedProbability >= 1f) { Attack(attacker, 30f, 60f, isPersistent: true); } else { Attack(attacker, 7f, 7f, isPersistent: false); } } }; m_componentCreature.ComponentBody.CollidedWithBody += delegate(ComponentBody body) { if (m_target == null && m_autoChaseSuppressionTime <= 0f && m_random.Float(0f, 1f) < m_chaseOnTouchProbability) { ComponentCreature componentCreature2 = body.Entity.FindComponent <ComponentCreature>(); if (componentCreature2 != null) { bool flag2 = m_subsystemPlayers.IsPlayer(body.Entity); bool flag3 = (componentCreature2.Category & m_autoChaseMask) != 0; if ((flag2 && m_subsystemGameInfo.WorldSettings.GameMode > GameMode.Harmless) || (!flag2 && flag3)) { Attack(componentCreature2, 7f, 7f, isPersistent: false); } } } if (m_target != null && body == m_target.ComponentBody && body.StandingOnBody == m_componentCreature.ComponentBody) { m_componentCreature.ComponentLocomotion.JumpOrder = 1f; } }; m_stateMachine.AddState("LookingForTarget", delegate { m_importanceLevel = 0f; m_target = null; }, delegate { if (IsActive) { m_stateMachine.TransitionTo("Chasing"); } else if (m_autoChaseSuppressionTime <= 0f && (m_target == null || ScoreTarget(m_target) <= 0f) && m_componentCreature.ComponentHealth.Health > 0.4f) { m_range = ((m_subsystemSky.SkyLightIntensity < 0.2f) ? m_nightChaseRange : m_dayChaseRange); ComponentCreature componentCreature = FindTarget(); if (componentCreature != null) { m_targetInRangeTime += m_dt; } else { m_targetInRangeTime = 0f; } if (m_targetInRangeTime > 3f) { bool flag = m_subsystemSky.SkyLightIntensity >= 0.1f; float maxRange = flag ? (m_dayChaseRange + 6f) : (m_nightChaseRange + 6f); float maxChaseTime = flag ? (m_dayChaseTime * m_random.Float(0.75f, 1f)) : (m_nightChaseTime * m_random.Float(0.75f, 1f)); Attack(componentCreature, maxRange, maxChaseTime, (!flag) ? true : false); } } }, null); m_stateMachine.AddState("RandomMoving", delegate { m_componentPathfinding.SetDestination(m_componentCreature.ComponentBody.Position + new Vector3(6f * m_random.Float(-1f, 1f), 0f, 6f * m_random.Float(-1f, 1f)), 1f, 1f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null); }, delegate { if (m_componentPathfinding.IsStuck || !m_componentPathfinding.Destination.HasValue) { m_stateMachine.TransitionTo("Chasing"); } if (!IsActive) { m_stateMachine.TransitionTo("LookingForTarget"); } }, delegate { m_componentPathfinding.Stop(); }); m_stateMachine.AddState("Chasing", delegate { m_subsystemNoise.MakeNoise(m_componentCreature.ComponentBody, 0.25f, 6f); m_componentCreature.ComponentCreatureSounds.PlayIdleSound(skipIfRecentlyPlayed: false); m_nextUpdateTime = 0.0; }, delegate { if (!IsActive) { m_stateMachine.TransitionTo("LookingForTarget"); } else if (m_chaseTime <= 0f) { m_autoChaseSuppressionTime = m_random.Float(10f, 60f); m_importanceLevel = 0f; } else if (m_target == null) { m_importanceLevel = 0f; } else if (m_target.ComponentHealth.Health <= 0f) { if (m_componentFeedBehavior != null) { m_subsystemTime.QueueGameTimeDelayedExecution(m_subsystemTime.GameTime + (double)m_random.Float(1f, 3f), delegate { if (m_target != null) { m_componentFeedBehavior.Feed(m_target.ComponentBody.Position); } }); } m_importanceLevel = 0f; } else if (!m_isPersistent && m_componentPathfinding.IsStuck) { m_importanceLevel = 0f; } else if (m_isPersistent && m_componentPathfinding.IsStuck) { m_stateMachine.TransitionTo("RandomMoving"); } else { if (ScoreTarget(m_target) <= 0f) { m_targetUnsuitableTime += m_dt; } else { m_targetUnsuitableTime = 0f; } if (m_targetUnsuitableTime > 3f) { m_importanceLevel = 0f; } else { int maxPathfindingPositions = 0; if (m_isPersistent) { maxPathfindingPositions = (m_subsystemTime.FixedTimeStep.HasValue ? 1500 : 500); } BoundingBox boundingBox = m_componentCreature.ComponentBody.BoundingBox; BoundingBox boundingBox2 = m_target.ComponentBody.BoundingBox; Vector3 v = 0.5f * (boundingBox.Min + boundingBox.Max); Vector3 vector = 0.5f * (boundingBox2.Min + boundingBox2.Max); float num = Vector3.Distance(v, vector); float num2 = (num < 4f) ? 0.2f : 0f; m_componentPathfinding.SetDestination(vector + num2 * num * m_target.ComponentBody.Velocity, 1f, 1.5f, maxPathfindingPositions, useRandomMovements: true, ignoreHeightDifference: false, raycastDestination: true, m_target.ComponentBody); if (m_random.Float(0f, 1f) < 0.33f * m_dt) { m_componentCreature.ComponentCreatureSounds.PlayAttackSound(); } } } }, null); m_stateMachine.TransitionTo("LookingForTarget"); }