private void PopulateAll() { foreach (var recipe in _prototypeManager.EnumeratePrototypes <ConstructionPrototype>()) { _recipes.Add(GetItem(recipe, _recipes)); } }
protected override void Startup() { base.Startup(); _reactions = _prototypeManager.EnumeratePrototypes <ReactionPrototype>(); _audioSystem = _entitySystemManager.GetEntitySystem <AudioSystem>(); }
private void CheckReactions() { foreach (var reaction in _prototypeManager.EnumeratePrototypes <ReactionPrototype>()) { foreach (var reactant in reaction.Reactants.Keys) { if (!_prototypeManager.HasIndex <ReagentPrototype>(reactant)) { Logger.ErrorS( "chem", "Reaction {reaction} has unknown reactant {reagent}.", reaction.ID, reactant); } } foreach (var product in reaction.Products.Keys) { if (!_prototypeManager.HasIndex <ReagentPrototype>(product)) { Logger.ErrorS( "chem", "Reaction {reaction} has unknown product {product}.", reaction.ID, product); } } } }
private void PopulateList() { foreach (var gear in _prototypeManager.EnumeratePrototypes <StartingGearPrototype>()) { OutfitList.Add(GetItem(gear, OutfitList)); } }
public CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) { var types = _prototypeManager.EnumeratePrototypes <DamageTypePrototype>() .Select(p => new CompletionOption(p.ID)); var groups = _prototypeManager.EnumeratePrototypes <DamageGroupPrototype>() .Select(p => new CompletionOption(p.ID)); return(CompletionResult.FromHintOptions(types.Concat(groups).OrderBy(p => p.Value), Loc.GetString("damage-command-arg-type"))); } if (args.Length == 2) { return(CompletionResult.FromHint(Loc.GetString("damage-command-arg-quantity"))); } if (args.Length == 3) { // if type.Name is good enough for cvars, <bool> doesn't need localizing. return(CompletionResult.FromHint("<bool>")); } if (args.Length == 4) { return(CompletionResult.FromHint(Loc.GetString("damage-command-arg-target"))); } return(CompletionResult.Empty); }
public void Initialize() { foreach (var prototype in PrototypeManager.EnumeratePrototypes <PrototypeTileDefinition>().OrderBy(p => p.FutureID)) { prototype.Register(this); } }
/// <summary> /// Initialize a damageable component /// </summary> private void DamageableInit(EntityUid uid, DamageableComponent component, ComponentInit _) { if (component.DamageContainerID != null && _prototypeManager.TryIndex <DamageContainerPrototype>(component.DamageContainerID, out var damageContainerPrototype)) { // Initialize damage dictionary, using the types and groups from the damage // container prototype foreach (var type in damageContainerPrototype.SupportedTypes) { component.Damage.DamageDict.TryAdd(type, FixedPoint2.Zero); } foreach (var groupID in damageContainerPrototype.SupportedGroups) { var group = _prototypeManager.Index <DamageGroupPrototype>(groupID); foreach (var type in group.DamageTypes) { component.Damage.DamageDict.TryAdd(type, FixedPoint2.Zero); } } } else { // No DamageContainerPrototype was given. So we will allow the container to support all damage types foreach (var type in _prototypeManager.EnumeratePrototypes <DamageTypePrototype>()) { component.Damage.DamageDict.TryAdd(type.ID, FixedPoint2.Zero); } } component.DamagePerGroup = component.Damage.GetDamagePerGroup(_prototypeManager); component.TotalDamage = component.Damage.Total; }
private void InitList() { // sort data in price descending order _uplinks = _prototypeManager.EnumeratePrototypes <UplinkStoreListingPrototype>() .Where(item => item.CanSurplus).ToArray(); Array.Sort(_uplinks, (a, b) => b.Price - a.Price); }
public override void Initialize() { base.Initialize(); _gasReactions = _protoMan.EnumeratePrototypes <GasReactionPrototype>().ToArray(); Array.Sort(_gasReactions, (a, b) => b.Priority.CompareTo(a.Priority)); _mapManager.MapCreated += OnMapCreated; _mapManager.TileChanged += OnTileChanged; Array.Resize(ref _gasSpecificHeats, MathHelper.NextMultipleOf(Atmospherics.TotalNumberOfGases, 4)); for (var i = 0; i < GasPrototypes.Length; i++) { _gasSpecificHeats[i] = GasPrototypes[i].SpecificHeat; } // Required for airtight components. SubscribeLocalEvent <RotateEvent>(RotateEvent); SubscribeLocalEvent <AirtightComponent, SnapGridPositionChangedEvent>(HandleSnapGridMove); _cfg.OnValueChanged(CCVars.SpaceWind, OnSpaceWindChanged, true); _cfg.OnValueChanged(CCVars.MonstermosEqualization, OnMonstermosEqualizationChanged, true); _cfg.OnValueChanged(CCVars.Superconduction, OnSuperconductionChanged, true); _cfg.OnValueChanged(CCVars.AtmosMaxProcessTime, OnAtmosMaxProcessTimeChanged, true); _cfg.OnValueChanged(CCVars.AtmosTickRate, OnAtmosTickRateChanged, true); _cfg.OnValueChanged(CCVars.ExcitedGroupsSpaceIsAllConsuming, OnExcitedGroupsSpaceIsAllConsumingChanged, true); }
public PaletteColorPicker() { RobustXamlLoader.Load(this); IoCManager.InjectDependencies(this); _tex = _resourceCache.GetResource <TextureResource>("/Textures/Interface/Nano/button.svg.96dpi.png"); var i = 0; foreach (var palette in _prototypeManager.EnumeratePrototypes <ColorPalettePrototype>()) { Palettes.AddItem(palette.Name); Palettes.SetItemMetadata(i, palette); // ew i += 1; } Palettes.OnItemSelected += args => { Palettes.SelectId(args.Id); SetupList(); }; Palettes.Select(0); SetupList(); }
public GraphicsTab() { IoCManager.InjectDependencies(this); RobustXamlLoader.Load(this); VSyncCheckBox.OnToggled += OnCheckBoxToggled; FullscreenCheckBox.OnToggled += OnCheckBoxToggled; LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-very-low")); LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-low")); LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-medium")); LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-high")); LightingPresetOption.OnItemSelected += OnLightingQualityChanged; UIScaleOption.AddItem(Loc.GetString("ui-options-scale-auto", ("scale", UserInterfaceManager.DefaultUIScale))); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-75")); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-100")); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-125")); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-150")); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-175")); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-200")); UIScaleOption.OnItemSelected += OnUIScaleChanged; foreach (var gear in _prototypeManager.EnumeratePrototypes <HudThemePrototype>()) { HudThemeOption.AddItem(Loc.GetString(gear.Name)); } HudThemeOption.OnItemSelected += OnHudThemeChanged; ViewportStretchCheckBox.OnToggled += _ => { UpdateViewportScale(); UpdateApplyButton(); }; ViewportScaleSlider.OnValueChanged += _ => { UpdateApplyButton(); UpdateViewportScale(); }; ShowHeldItemCheckBox.OnToggled += OnCheckBoxToggled; IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled; ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled; ApplyButton.OnPressed += OnApplyButtonPressed; VSyncCheckBox.Pressed = _cfg.GetCVar(CVars.DisplayVSync); FullscreenCheckBox.Pressed = ConfigIsFullscreen; LightingPresetOption.SelectId(GetConfigLightingQuality()); UIScaleOption.SelectId(GetConfigUIScalePreset(ConfigUIScale)); HudThemeOption.SelectId(_cfg.GetCVar(CCVars.HudTheme)); ViewportScaleSlider.Value = _cfg.GetCVar(CCVars.ViewportFixedScaleFactor); ViewportStretchCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportStretch); IntegerScalingCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportSnapToleranceMargin) != 0; ViewportLowResCheckBox.Pressed = !_cfg.GetCVar(CCVars.ViewportScaleRender); ShowHeldItemCheckBox.Pressed = _cfg.GetCVar(CCVars.HudHeldItemShow); UpdateViewportScale(); UpdateApplyButton(); }
public override void Initialize() { base.Initialize(); _audioSystem = EntitySystem.Get <AudioSystem>(); _chemistrySystem = _entitySystemManager.GetEntitySystem <ChemistrySystem>(); _reactions = _prototypeManager.EnumeratePrototypes <ReactionPrototype>(); }
public override void Initialize() { base.Initialize(); _gasReactions = _protoMan.EnumeratePrototypes <GasReactionPrototype>().ToArray(); Array.Sort(_gasReactions, (a, b) => b.Priority.CompareTo(a.Priority)); _spaceAtmos = new SpaceGridAtmosphereComponent(); _spaceAtmos.Initialize(); IoCManager.InjectDependencies(_spaceAtmos); _mapManager.TileChanged += OnTileChanged; Array.Resize(ref _gasSpecificHeats, MathHelper.NextMultipleOf(Atmospherics.TotalNumberOfGases, 4)); for (var i = 0; i < GasPrototypes.Length; i++) { _gasSpecificHeats[i] = GasPrototypes[i].SpecificHeat; } // Required for airtight components. EntityManager.EventBus.SubscribeEvent <RotateEvent>(EventSource.Local, this, RotateEvent); _cfg.OnValueChanged(CCVars.SpaceWind, OnSpaceWindChanged, true); _cfg.OnValueChanged(CCVars.MonstermosEqualization, OnMonstermosEqualizationChanged, true); _cfg.OnValueChanged(CCVars.AtmosMaxProcessTime, OnAtmosMaxProcessTimeChanged, true); _cfg.OnValueChanged(CCVars.AtmosTickRate, OnAtmosTickRateChanged, true); _cfg.OnValueChanged(CCVars.ExcitedGroupsSpaceIsAllConsuming, OnExcitedGroupsSpaceIsAllConsumingChanged, true); }
public override void Startup() { base.Startup(); // TODO: "safe random" for chems. Right now this includes admin chemicals. var allReagents = _prototypeManager.EnumeratePrototypes <ReagentPrototype>() .Where(x => !x.Abstract) .Select(x => x.ID).ToList(); // This is gross, but not much can be done until event refactor, which needs Dynamic. var sound = new SoundPathSpecifier("/Audio/Effects/extinguish.ogg"); foreach (var(_, transform) in _entityManager.EntityQuery <GasVentPumpComponent, TransformComponent>()) { var solution = new Solution(); if (_random.Prob(0.05f)) { solution.AddReagent(_random.Pick(allReagents), 100); } else { solution.AddReagent(_random.Pick(SafeishVentChemicals), 100); } FoamAreaReactionEffect.SpawnFoam("Foam", transform.Coordinates, solution, _random.Next(2, 6), 20, 1, 1, sound, _entityManager); } }
private void _initTileDefinitions() { // Register space first because I'm a hard coding hack. var spaceDef = _prototypeManager.Index <ContentTileDefinition>("space"); _tileDefinitionManager.Register(spaceDef); var prototypeList = new List <ContentTileDefinition>(); foreach (var tileDef in _prototypeManager.EnumeratePrototypes <ContentTileDefinition>()) { if (tileDef.ID == "space") { continue; } prototypeList.Add(tileDef); } // Sort ordinal to ensure it's consistent client and server. // So that tile IDs match up. prototypeList.Sort((a, b) => string.Compare(a.ID, b.ID, StringComparison.Ordinal)); foreach (var tileDef in prototypeList) { _tileDefinitionManager.Register(tileDef); } _tileDefinitionManager.Initialize(); }
private void OnCrayonInit(EntityUid uid, CrayonComponent component, ComponentInit args) { component.Charges = component.Capacity; // Get the first one from the catalog and set it as default var decal = _prototypeManager.EnumeratePrototypes<DecalPrototype>().FirstOrDefault(x => x.Tags.Contains("crayon")); component.SelectedState = decal?.ID ?? string.Empty; Dirty(component); }
protected override void Initialize() { base.Initialize(); if (UserInterface != null) { UserInterface.OnReceiveMessage += UserInterfaceOnReceiveMessage; } Charges = Capacity; // Get the first one from the catalog and set it as default var decals = _prototypeManager.EnumeratePrototypes <CrayonDecalPrototype>().FirstOrDefault(); if (decals != null) { SelectedState = decals.Decals.First(); } Dirty(); }
public override void Initialize() { base.Initialize(); foreach (var seed in _prototypeManager.EnumeratePrototypes <Seed>()) { AddSeedToDatabase(seed); } }
public override void Initialize() { base.Initialize(); _gasReactions = _protoMan.EnumeratePrototypes <GasReactionPrototype>().ToArray(); Array.Sort(_gasReactions, (a, b) => b.Priority.CompareTo(a.Priority)); _mapManager.TileChanged += OnTileChanged; }
protected override void LoadPrototypes() { base.LoadPrototypes(); AlertOrder = _prototypeManager.EnumeratePrototypes <AlertOrderPrototype>().FirstOrDefault(); if (AlertOrder == null) { Logger.ErrorS("alert", "no alertOrder prototype found, alerts will be in random order"); } }
/// <summary> /// Handles building the reaction cache. /// </summary> private void InitializeReactionCache() { _reactions = new Dictionary <string, List <ReactionPrototype> >(); var reactions = _prototypeManager.EnumeratePrototypes <ReactionPrototype>(); foreach (var reaction in reactions) { CacheReaction(reaction); } }
private void PopulateDatabase() { _nextUid = 0; _seeds.Clear(); foreach (var seed in _prototypeManager.EnumeratePrototypes <Seed>()) { AddSeedToDatabase(seed); } }
public void Populate() { var prototypes = _prototypeManager.EnumeratePrototypes <DecalPrototype>(); _decals = new Dictionary <string, Texture>(); foreach (var decalPrototype in prototypes) { _decals.Add(decalPrototype.ID, decalPrototype.Sprite.Frame0()); } RefreshList(); }
private void InitializeGases() { _gasReactions = _protoMan.EnumeratePrototypes <GasReactionPrototype>().ToArray(); Array.Sort(_gasReactions, (a, b) => b.Priority.CompareTo(a.Priority)); Array.Resize(ref _gasSpecificHeats, MathHelper.NextMultipleOf(Atmospherics.TotalNumberOfGases, 4)); for (var i = 0; i < GasPrototypes.Length; i++) { _gasSpecificHeats[i] = GasPrototypes[i].SpecificHeat; } }
private void BuildEntityList(string searchStr = null) { PrototypeList.DisposeAllChildren(); SelectedButton = null; searchStr = searchStr?.ToLowerInvariant(); var prototypes = new List <EntityPrototype>(); foreach (var prototype in prototypeManager.EnumeratePrototypes <EntityPrototype>()) { if (prototype.Abstract) { continue; } if (searchStr != null && !_doesPrototypeMatchSearch(prototype, searchStr)) { continue; } prototypes.Add(prototype); } prototypes.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.Ordinal)); foreach (var prototype in prototypes) { var button = new EntitySpawnButton() { Prototype = prototype, }; var container = button.GetChild("HBoxContainer"); button.ActualButton.OnToggled += OnItemButtonToggled; container.GetChild <Label>("Label").Text = prototype.Name; var tex = IconComponent.GetPrototypeIcon(prototype); var rect = container.GetChild("TextureWrap").GetChild <TextureRect>("TextureRect"); if (tex != null) { rect.Texture = tex.Default; // Ok I can't find a way to make this TextureRect scale down sanely so let's do this. var scale = (float)TARGET_ICON_HEIGHT / tex.Default.Height; rect.Scale = new Vector2(scale, scale); } else { rect.Dispose(); } PrototypeList.AddChild(button); } }
public override void Initialize() { base.Initialize(); _gasReactions = _protoMan.EnumeratePrototypes <GasReactionPrototype>().ToArray(); Array.Sort(_gasReactions, (a, b) => b.Priority.CompareTo(a.Priority)); _spaceAtmos = new SpaceGridAtmosphereComponent(); _spaceAtmos.Initialize(); IoCManager.InjectDependencies(_spaceAtmos); _mapManager.TileChanged += OnTileChanged; }
private void OnMapInit(EntityUid uid, BarSignComponent component, MapInitEvent args) { if (component.CurrentSign != null) { return; } var prototypes = _prototypeManager.EnumeratePrototypes <BarSignPrototype>().Where(p => !p.Hidden) .ToList(); var prototype = _random.Pick(prototypes); component.CurrentSign = prototype.ID; }
public void Initialize() { _listings = new List <UplinkListingData>(); foreach (var item in _prototypeManager.EnumeratePrototypes <UplinkStoreListingPrototype>()) { var newListing = new UplinkListingData(item.ListingName, item.ItemId, item.Price, item.Category, item.Description); RegisterUplinkListing(newListing); } _accounts = new List <UplinkAccount>(); }
public void Initialize() { _typeToAlert = new Dictionary <AlertType, AlertPrototype>(); foreach (var alert in _prototypeManager.EnumeratePrototypes <AlertPrototype>()) { if (!_typeToAlert.TryAdd(alert.AlertType, alert)) { Logger.ErrorS("alert", "Found alert with duplicate alertType {0} - all alerts must have" + " a unique alerttype, this one will be skipped", alert.AlertType); } } }
/// <inheritdoc /> public override void Initialize() { base.Initialize(); foreach (var prototype in _prototypeManager.EnumeratePrototypes <ConstructionPrototype>()) { _craftRecipes.Add(prototype.Result, prototype); } SubscribeNetworkEvent <TryStartStructureConstructionMessage>(HandleStartStructureConstruction); SubscribeNetworkEvent <TryStartItemConstructionMessage>(HandleStartItemConstruction); SubscribeLocalEvent <AfterInteractMessage>(HandleToolInteraction); }