public BulkChangeTool() { numObjectLayers = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.NumLayers), ObjectLayer.NumLayers); pickupableLayer = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.Pickupables), ObjectLayer.Pickupables); }
/// <summary> /// Creates this building. /// </summary> /// <returns>The building instance to be registered.</returns> internal static PBuilding CreateBuilding() { return(ThermalInterfacePlate = new PBuilding(ID, ThermalPlateStrings.BUILDINGS. PREFABS.THERMALINTERFACEPLATE.NAME) { AddAfter = "ExteriorWall", AlwaysOperational = true, Animation = "thermalPlate_kanim", AudioCategory = "Metal", Category = "Utilities", ConstructionTime = 30.0f, Description = null, EffectText = null, Entombs = false, Floods = false, Height = 1, HP = 30, Ingredients = { new BuildIngredient(TUNING.MATERIALS.REFINED_METALS, tier: 3) }, ObjectLayer = PGameUtils.GetObjectLayer(nameof(ObjectLayer.Backwall), ObjectLayer.Backwall), Placement = BuildLocationRule.NotInTiles, SceneLayer = Grid.SceneLayer.Backwall, SubCategory = "temperature", Tech = "Suits", Width = 1 }); }
public ThermalInterfacePlate() { backwallLayer = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.Backwall), ObjectLayer.Backwall); numObjectLayers = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.NumLayers), ObjectLayer.NumLayers); transferCache = new List <GameObject>(); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefabTag) { ThermalInterfacePlate?.ConfigureBuildingTemplate(go); go.AddOrGet <AnimTileable>().objectLayer = PGameUtils.GetObjectLayer( nameof(ObjectLayer.Backwall), ObjectLayer.Backwall); go.AddComponent <ZoneTile>(); BuildingConfigManager.Instance.IgnoreDefaultKComponent(typeof(RequiresFoundation), prefabTag); }
public Instance(AirlockDoor door) : base(door) { minionLayer = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.Minion), ObjectLayer.Minion); pickupableLayer = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer. Pickupables), ObjectLayer.Pickupables); pressureSamples = 0; totalPressure = 0.0f; }
public override void OnLoad(Harmony harmony) { base.OnLoad(harmony); numObjectLayers = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.NumLayers), ObjectLayer.NumLayers); PUtil.InitLibrary(); lastChecked.Reset(); new PPatchManager(harmony).RegisterPatchClass(typeof(BuildStraightUpPatches)); new PVersionCheck().Register(this, new SteamVersionChecker()); }
public override void OnLoad(Harmony harmony) { base.OnLoad(harmony); BUILDING_LAYER = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.Building), ObjectLayer.Building); PUtil.InitLibrary(); new PBuildingManager().Register(AirlockDoorConfig.CreateBuilding()); new PLocalization().Register(); new PVersionCheck().Register(this, new SteamVersionChecker()); }
/// <summary> /// Creates a new building. All buildings thus created must be registered using /// PBuilding.Register and have an appropriate IBuildingConfig class. /// /// Building should be created in OnLoad or a post-load patch (not in static /// initializers) to give the localization framework time to patch the LocString /// containing the building name and description. /// </summary> /// <param name="id">The building ID.</param> /// <param name="name">The building name.</param> public PBuilding(string id, string name) { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException(nameof(id)); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } AddAfter = null; AlwaysOperational = false; Animation = ""; AudioCategory = "Metal"; AudioSize = "medium"; Breaks = true; Category = DEFAULT_CATEGORY; ConstructionTime = 10.0f; Decor = TUNING.BUILDINGS.DECOR.NONE; DefaultPriority = null; Description = "Default Building Description"; EffectText = "Default Building Effect"; Entombs = true; ExhaustHeatGeneration = 0.0f; Floods = true; HeatGeneration = 0.0f; Height = 1; Ingredients = new List <BuildIngredient>(4); IndustrialMachine = false; InputConduits = new List <ConduitConnection>(4); HP = 100; ID = id; LogicIO = new List <LogicPorts.Port>(4); Name = name; Noise = TUNING.NOISE_POLLUTION.NONE; ObjectLayer = PGameUtils.GetObjectLayer(nameof(ObjectLayer.Building), ObjectLayer. Building); OutputConduits = new List <ConduitConnection>(4); OverheatTemperature = null; Placement = BuildLocationRule.OnFloor; PowerInput = null; PowerOutput = null; RotateMode = PermittedRotations.Unrotatable; SceneLayer = Grid.SceneLayer.Building; // Hard coded strings in base game, no const to reference SubCategory = "default"; Tech = null; ViewMode = OverlayModes.None.ID; Width = 1; addedPlan = false; addedStrings = false; addedTech = false; }
public override BuildingDef CreateBuildingDef() { LocString.CreateLocStringKeys(typeof(AirlockDoorStrings.BUILDING)); LocString.CreateLocStringKeys(typeof(AirlockDoorStrings.BUILDINGS)); var def = AirlockDoorTemplate?.CreateDef(); def.ForegroundLayer = Grid.SceneLayer.TileMain; def.IsFoundation = true; def.PreventIdleTraversalPastBuilding = true; // /5 multiplier to thermal conductivity def.ThermalConductivity = 0.2f; def.TileLayer = PGameUtils.GetObjectLayer(nameof(ObjectLayer.FoundationTile), ObjectLayer.FoundationTile); return(def); }
internal FilteredDestroyTool() { Color color; modes = new List <DestroyFilter>(12) { new DestroyFilter("Elements", SandboxToolsStrings.DESTROY_ELEMENTS, DestroyElement), new DestroyFilter("Items", SandboxToolsStrings.DESTROY_ITEMS, DestroyItems), new DestroyFilter("Creatures", SandboxToolsStrings.DESTROY_CREATURES, DestroyCreatures), new DestroyFilter("Plants", SandboxToolsStrings.DESTROY_PLANTS, DestroyPlants), new DestroyFilter("Buildings", SandboxToolsStrings.DESTROY_BUILDINGS), new DestroyFilter("BackWall", SandboxToolsStrings.DESTROY_DRYWALL), new DestroyFilter("LiquidPipes", SandboxToolsStrings.DESTROY_LPIPES), new DestroyFilter("GasPipes", SandboxToolsStrings.DESTROY_GPIPES), new DestroyFilter("Wires", SandboxToolsStrings.DESTROY_POWER), new DestroyFilter("Logic", SandboxToolsStrings.DESTROY_AUTO), new DestroyFilter("SolidConduits", SandboxToolsStrings.DESTROY_SHIPPING) }; // "All" checkbox to destroy everything if (!SandboxToolsPatches.AdvancedFilterEnabled) { modes.Insert(0, new DestroyFilter("All", SandboxToolsStrings.DESTROY_ALL, DestroyAll)); } pendingCells = new HashSet <int>(); try { // Take from stock tool if possible color = RECENTLY_AFFECTED.Get(SandboxDestroyerTool.instance); } catch (System.Exception e) { #if DEBUG PUtil.LogExcWarn(e); #endif // Use default color = new Color(1f, 1f, 1f, 0.1f); } // Read value at runtime if possible numObjectLayers = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.NumLayers), ObjectLayer.NumLayers); pickupLayer = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.Pickupables), ObjectLayer.Pickupables); pendingHighlightColor = color; }
/// <summary> /// Creates this building. /// </summary> /// <returns>The building instance to be registered.</returns> internal static PBuilding CreateBuilding() { return(TileTempSensor = new PBuilding(ID, TileTempSensorStrings.BUILDINGS.PREFABS.TILETEMPSENSOR.NAME) { AddAfter = LogicTemperatureSensorConfig.ID, Animation = "thermo_tile_kanim", AudioCategory = "Metal", AudioSize = "small", Category = "Automation", ConstructionTime = 30.0f, Decor = TUNING.BUILDINGS.DECOR.BONUS.TIER0, Description = null, EffectText = null, Entombs = false, Floods = false, Height = 1, HP = 100, Ingredients = { new BuildIngredient(TUNING.MATERIALS.REFINED_METALS, tier: 2) }, IsSolidTile = true, LogicIO = { LogicPorts.Port.OutputPort(LogicSwitch.PORT_ID, new CellOffset(0, 0), STRINGS.BUILDINGS.PREFABS.LOGICTEMPERATURESENSOR.LOGIC_PORT, STRINGS.BUILDINGS.PREFABS.LOGICTEMPERATURESENSOR.LOGIC_PORT_ACTIVE, STRINGS.BUILDINGS.PREFABS.LOGICTEMPERATURESENSOR.LOGIC_PORT_INACTIVE, true) }, ObjectLayer = PGameUtils.GetObjectLayer(nameof(ObjectLayer.Backwall), ObjectLayer.Backwall), Placement = BuildLocationRule.Tile, SceneLayer = Grid.SceneLayer.TileMain, SubCategory = "sensors", Tech = "HVAC", ViewMode = OverlayModes.Logic.ID, Width = 1 }); }
#pragma warning restore IDE0044 #pragma warning restore CS0649 public SinkCheckpoint() : base() { buildingLayer = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.Building), ObjectLayer.Building); }
/// <summary> /// Applies decor values from the database. /// </summary> internal static void ApplyDatabase(DecorReimaginedOptions options) { DecorDbEntry[] entries = null; try { // Read in database from the embedded config json using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream( "ReimaginationTeam.DecorRework.buildings.json")) { var jr = new JsonTextReader(new StreamReader(stream)); entries = new JsonSerializer { MaxDepth = 2 }.Deserialize <DecorDbEntry[]>(jr); jr.Close(); } } catch (JsonException e) { // Error when loading decor PUtil.LogExcWarn(e); } catch (IOException e) { // Error when loading decor PUtil.LogExcWarn(e); } if (entries != null) { var editDecor = DictionaryPool <string, DecorDbEntry, DecorDbEntry> .Allocate(); var tileLayer = PGameUtils.GetObjectLayer(nameof(ObjectLayer.FoundationTile), ObjectLayer.FoundationTile); string id; // Add to dictionary, way faster foreach (var entry in entries) { if (!string.IsNullOrEmpty(id = entry.id) && !editDecor.ContainsKey(id)) { editDecor.Add(id, entry); } } foreach (var def in Assets.BuildingDefs) { // If PreserveTileDecor is set to true, ignore foundation tile decor mods if (editDecor.TryGetValue(id = def.PrefabID, out DecorDbEntry entry) && (def.TileLayer != tileLayer || !options.PreserveTileDecor)) { float decor = entry.decor; int radius = entry.radius; var provider = def.BuildingComplete.GetComponent <DecorProvider>(); // For reference, these do not alter the BuildingComplete def.BaseDecor = decor; def.BaseDecorRadius = radius; // Actual decor provider if (provider != null) { PUtil.LogDebug("Patched: {0} Decor: {1:F1} Radius: {2:D}".F(id, decor, radius)); provider.baseDecor = decor; provider.baseRadius = radius; } } } editDecor.Recycle(); } // Patch in the debris decor var baseOreTemplate = typeof(EntityTemplates).GetFieldSafe("baseOreTemplate", true)?.GetValue(null) as GameObject; DecorProvider component; if (baseOreTemplate != null && (component = baseOreTemplate. GetComponent <DecorProvider>()) != null) { int radius = Math.Max(1, options.DebrisRadius); component.baseDecor = options.DebrisDecor; component.baseRadius = radius; PUtil.LogDebug("Debris: {0:F1} radius {1:D}".F(options.DebrisDecor, radius)); } // Patch the suits PUtil.LogDebug("Snazzy Suit: {0:D} Warm/Cool Vest: {1:D}".F(options. SnazzySuitDecor, options.VestDecor)); ClothingWearer.ClothingInfo.FANCY_CLOTHING.decorMod = options.SnazzySuitDecor; ClothingWearer.ClothingInfo.COOL_CLOTHING.decorMod = options.VestDecor; ClothingWearer.ClothingInfo.WARM_CLOTHING.decorMod = options.VestDecor; }
public AirlockDoorTransitionLayer(Navigator navigator) : base(navigator) { buildingLayer = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.Building), ObjectLayer.Building); doors = new Dictionary <AirlockDoor, DoorRequestType>(4); }