Skip to content

Fix compatibility with ONI: Spaced Out version 496912 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 19 additions & 30 deletions ExtendedBridges/ExtendedBridges.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using STRINGS;
using TUNING;
using UnityEngine;
using Harmony;
using HarmonyLib;

namespace ExtendedBridges
{
Expand All @@ -16,12 +16,8 @@ class ModUtilExtended : KMonoBehaviour
// Add building to planning screen at specified position
public static void AddBuildingToPlanScreen(HashedString category, string building_id, int id = 0)
{
int num = TUNING.BUILDINGS.PLANORDER.FindIndex((PlanScreen.PlanInfo x) => x.category == category);
if (num < 0)
{ return; }

IList<string> list = TUNING.BUILDINGS.PLANORDER[num].data as IList<string>;
list.Insert(id, building_id);
// Use officially supported call to add to the build menu, which sadly doesn't support ordering after another building id.
ModUtil.AddBuildingToPlanScreen(category, building_id);
}

// Get list position of a building
Expand Down Expand Up @@ -95,37 +91,30 @@ private static void Prefix()
[HarmonyPatch(typeof(Db), "Initialize")]
internal class InsulatedPressureDoor_Db_Initialize
{
private static void Prefix(Db __instance)
public static void Postfix()
{
List<string> ls;
Tech tech;

ls = new List<string>(Database.Techs.TECH_GROUPING["ImprovedLiquidPiping"]);
ls.Add(ExtendedLiquidConduitBridgeConfig.ID);
Database.Techs.TECH_GROUPING["ImprovedLiquidPiping"] = ls.ToArray();
tech = Db.Get().Techs.TryGet("ImprovedLiquidPiping");
tech.unlockedItemIDs.Add(ExtendedLiquidConduitBridgeConfig.ID);

ls = new List<string>(Database.Techs.TECH_GROUPING["ImprovedGasPiping"]);
ls.Add(ExtendedGasConduitBridgeConfig.ID);
Database.Techs.TECH_GROUPING["ImprovedGasPiping"] = ls.ToArray();
tech = Db.Get().Techs.TryGet("ImprovedGasPiping");
tech.unlockedItemIDs.Add(ExtendedGasConduitBridgeConfig.ID);

ls = new List<string>(Database.Techs.TECH_GROUPING["SolidTransport"]);
ls.Insert(2, ExtendedSolidConduitBridgeConfig.ID);
Database.Techs.TECH_GROUPING["SolidTransport"] = ls.ToArray();
tech = Db.Get().Techs.TryGet("SolidTransport");
tech.unlockedItemIDs.Add(ExtendedSolidConduitBridgeConfig.ID);

ls = new List<string>(Database.Techs.TECH_GROUPING["AdvancedPowerRegulation"]);
ls.Add(ExtendedWireBridgeConfig.ID);
Database.Techs.TECH_GROUPING["AdvancedPowerRegulation"] = ls.ToArray();
tech = Db.Get().Techs.TryGet("AdvancedPowerRegulation");
tech.unlockedItemIDs.Add(ExtendedWireBridgeConfig.ID);

ls = new List<string>(Database.Techs.TECH_GROUPING["PrettyGoodConductors"]);
ls.Insert(2, ExtendedWireRefinedBridgeConfig.ID);
Database.Techs.TECH_GROUPING["PrettyGoodConductors"] = ls.ToArray();
tech = Db.Get().Techs.TryGet("PrettyGoodConductors");
tech.unlockedItemIDs.Add(ExtendedWireRefinedBridgeConfig.ID);

ls = new List<string>(Database.Techs.TECH_GROUPING["LogicCircuits"]);
ls.Add(ExtendedLogicWireBridgeConfig.ID);
Database.Techs.TECH_GROUPING["LogicCircuits"] = ls.ToArray();
tech = Db.Get().Techs.TryGet("LogicCircuits");
tech.unlockedItemIDs.Add(ExtendedLogicWireBridgeConfig.ID);

ls = new List<string>(Database.Techs.TECH_GROUPING["ParallelAutomation"]);
ls.Add(ExtendedLogicRibbonBridgeConfig.ID);
Database.Techs.TECH_GROUPING["ParallelAutomation"] = ls.ToArray();
tech = Db.Get().Techs.TryGet("ParallelAutomation");
tech.unlockedItemIDs.Add(ExtendedLogicRibbonBridgeConfig.ID);
}
}

Expand Down
4 changes: 3 additions & 1 deletion ExtendedBridges/ExtendedBridges.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ExtendedBridges</RootNamespace>
<AssemblyName>ExtendedBridges</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
Expand All @@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -29,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=1.2.0.1, Culture=neutral, processorArchitecture=MSIL">
Expand Down
Binary file modified ExtendedBridges/bin/Debug/ExtendedBridges.dll
Binary file not shown.
Binary file modified ExtendedBridges/bin/Debug/ExtendedBridges.pdb
Binary file not shown.
Binary file not shown.
Binary file added ExtendedBridges/bin/Release/ExtendedBridges.pdb
Binary file not shown.