skairunner / sky-oni-mods

Code for Sky's mods for the game Oxygen Not Included.
MIT License
18 stars 25 forks source link

This is how to update AdvancedStart mod for DLC #84

Closed schirkan closed 2 years ago

schirkan commented 2 years ago

I updated the AdvancedStart mod to make it dlc compatible. Testet successfully with latest version (514967), DLC enabled and default AdvancedStart.json-config.

Unfortunately I could not get the complete solution build on my machine. So here are my changes:

AdvancedStartPatch.cs

Fix using for new version of PLib (4.8.1)

using PeterHan.PLib.Core;

Make the class non static and fix OnLoad function

namespace AdvancedStart
{
    public class AdvancedStartPatch : KMod.UserMod2
    {
        public override void OnLoad(Harmony harmony)
        {
            base.OnLoad(harmony);
            PUtil.InitLibrary(false);
            var options = new POptions();
            options.RegisterOptions(this, typeof(AdvancedStartOptions));
        }

Add missing argument of type string

[HarmonyPatch(typeof(MinionStartingStats), MethodType.Constructor, typeof(bool), typeof(string), typeof(string))]
        public static class MinionStartingStats_Constructor

AdvancedStartOptions.cs

Get baseDir with alternative method

        public AdvancedStartConfig GetProfile()
        {
            var baseDir = new FileInfo(POptions.GetConfigFilePath(typeof (AdvancedStartConfig))).DirectoryName;

mod_info.yaml

Make it DLC compatible

supportedContent: VANILLA_ID, EXPANSION1_ID
minimumSupportedBuild: 514967
APIVersion: 2
version: "1.2.0"

Add new file mod.yaml

Add Description

title: "Advanced Start"
description: "Allows you to start the game with additional items, technologies, skill points and increased attributes."
staticID: "AdvancedStart"

SpaceStart.json

Due to the new tech tree of the DLC there are some techs missing in the SpaceStart config. This is the list of all techs available in base game AND the DLC (according to the tech database)

FarmingTech
FineDining
FoodRepurposing
FinerDining
Agriculture
Ranching
AnimalControl
ImprovedOxygen
GasPiping
ImprovedGasPiping
SpaceGas
PressureManagement
DirectedAirStreams
LiquidFiltering
MedicineI
MedicineII
MedicineIII
MedicineIV
LiquidPiping
ImprovedLiquidPiping
PrecisionPlumbing
SanitationSciences
FlowRedirection
LiquidDistribution
AdvancedSanitation
AdvancedFiltration
Distillation
Catalytics
PowerRegulation
AdvancedPowerRegulation
PrettyGoodConductors
PrettyGoodConductors
RenewableEnergy
Combustion
ImprovedCombustion
InteriorDecor
Artistry
Clothing
Acoustics
SpacePower
NuclearRefinement
FineArt
EnvironmentalAppreciation
Luxury
RefractiveDecor
GlassFurnishings
Screens
RenaissanceArt
Plastics
ValveMiniaturization
HydrocarbonPropulsion
BetterHydroCarbonPropulsion
CryoFuelPropulsion
Suits
Jobs
AdvancedResearch
SpaceProgram
CrashPlan
DurableLifeSupport
NuclearResearch
AdvancedNuclearResearch
NuclearStorage
NuclearPropulsion
NotificationSystems
ArtificialFriends
BasicRefinement
RefinedObjects
Smelting
HighTempForging
HighPressureForging
RadiationProtection
TemperatureModulation
HVAC
LiquidTemperature
LogicControl
GenericSensors
LogicCircuits
ParallelAutomation
DupeTrafficControl
Multiplexing
SkyDetectors
TravelTubes
SmartStorage
SolidManagement
HighVelocityTransport
Jetpacks
SolidTransport
Monuments
SolidSpace
RoboticTools
PortableGasses

These items seem to be exclusive to the base game (I could not get them activated)

AdvancedResourceExtraction
BasicRocketry
CargoI
CargoII
CargoIII
EnginesI
EnginesII
EnginesIII

These items are exclusive to the DLC (according to the tech database)

Bioengineering
SpaceCombustion
HighVelocityDestruction
GasDistribution
AdvancedScanners
skairunner commented 2 years ago

Hi, thanks for the comment. I've applied most of the code changes on my local repo, but there is one issue: I'm not sure it's possible to have a single SpaceStart json that works for both vanilla and DLC, given the different techs. Maybe I should make two separate jsons, one called SpaceStartDlc and ther othe SpaceStartVanilla. I could also try to implement some filtering to simply ignore techs that dont exist in the current version of the game. Hmm.

schirkan commented 2 years ago

Hi! I had the same thoughts and tried option two. Adding "try+catch" around tech activation works great.

Maybe the "Advanced Start" needs adjustments too, because some buildings were moved in the tech tree.

skairunner commented 2 years ago

Updated. Thanks for the proposal!