MaFi-Games / Captain-of-industry-modding

Official modding resource for video game Captain of Industry.
https://www.captain-of-industry.com
MIT License
41 stars 40 forks source link

Crash when trying to add research #6

Open NotoriousPyro opened 2 years ago

NotoriousPyro commented 2 years ago

Hi,

I tried to make my own "Zippers" by copying the Example mod and got to a certain point where my "machines" will appear in game, however when I try to add research for them, I get a cryptic error: image

The source code to reproduce it is at https://github.com/NotoriousPyro/UnpoweredBalancers

Simply uncomment the line that adds the research in https://github.com/NotoriousPyro/UnpoweredBalancers/blob/main/UnpoweredBalancers.cs

NotoriousPyro commented 2 years ago
I 08:49:53,075 S------ ~Mai: Started logging to file
I 08:49:53,154 S------ ~Mai: Started logging to graylog
I 08:49:53,155 S------ ~Mai: Unity logging registered
I 08:49:53,155 S------ ~Mai: Staring game (standalone) ...
I 08:49:53,169 S------ ~Mai: UTC now: 2022/09/20 08:49:53
G 08:49:53,169 S------ ~Mai: Version: 0.4.12b (Early Access)
I 08:49:53,170 S------ ~Mai: Current culture: en-GB
I 08:49:53,171 S------ ~Mai: Platform: 2
I 08:49:53,355 S------ ~Mai: Steam client connected
I 08:49:53,380 S------ ~Mai: Default language 'English'
I 08:49:53,910 S------ ~Mai: VSync set to 0
I 08:49:53,910 S------ ~Mai: Target FPS set to 120
I 08:49:53,913 S------ ~Mai: Loaded 3 core mods:
  CoreMod (Mafi.Core.CoreMod)
  BaseMod (Mafi.Base.BaseMod)
  UnityMod (Mafi.Unity.UnityMod)
I 08:49:53,914 S------ ~Mai: Loading mods from 'F:\Steam\steamapps\common\Captain of Industry\DLCs'.
I 08:49:53,917 S------ ~Mai: Loading mods from 'F:\Steam\steamapps\common\Captain of Industry\DLCs\Mafi.Supporter\Mafi.Supporter.dll'.
I 08:49:53,922 S------ ~Mai: Mods type 'Mafi.Supporter.SupporterMod' registered (with asset bundles).
I 08:49:53,924 S------ ~Mai: Loaded 1 DLCs:
  Mafi.Supporter (Mafi.Supporter.SupporterMod)
I 08:49:53,925 S------ ~Mai: Loading mods from 'F:\OneDrive\Documents\Captain of Industry\Mods'.
I 08:49:53,925 S------ ~Mai: No asset bundles found at 'F:\OneDrive\Documents\Captain of Industry\Mods\UnpoweredBalancers\AssetBundles'
I 08:49:53,925 S------ ~Mai: Loading mods from 'F:\OneDrive\Documents\Captain of Industry\Mods\UnpoweredBalancers\UnpoweredBalancers.dll'.
I 08:49:53,928 S------ ~Mai: Mods type 'UnpoweredBalancers.UnpoweredBalancers' registered (no asset bundles).
I 08:49:53,929 S------ ~Mai: Closing graylog logging.
I 08:49:53,932 S------ ~Mai: Loaded 1 extra mods
    UnpoweredBalancers (UnpoweredBalancers.UnpoweredBalancers)
I 08:49:55,304 S------ ~Mai: Game was initialized in 1 steps and took 0.465 seconds to complete.
I 08:49:58,080 S------ ~Mai: Scene clean step
I 08:49:58,091 S------ ~Mai: Scene clean done
I 08:49:58,093 S------ ~Mai: Total memory: 5 MB, GC collected 8 MB in 1.7258 ms.
I 08:49:58,142 S------ ~Mai: Configs instantiated: GameDifficultyConfig, StaticIslandMapProviderConfig, IslandMapDifficultyConfig, RandomSeedConfig, TerrainGeneratorConfig, IslandMapGeneratorConfig, CoreModConfig, MaintenanceConfig, BaseModConfig, StartingFactoryConfig, UnityModConfig
I 08:49:58,166 S------ ~Mai: UnpoweredBalancers: constructed
I 08:50:00,852 S------ ~Mai: [2760 ms] Instantiated mods.
I 08:50:00,918 S------ ~Mai: Registered 164 products from assembly 'Mafi.Base'.
I 08:50:01,534 S------ ~Mai: UnpoweredBalancers: registering prototypes
X 08:50:01,536 S------ ~Mai: Exception during game initialization.
 ---> GameBuilderException: An exception was thrown while registering mod 'UnpoweredBalancers mod' (UnpoweredBalancers.UnpoweredBalancers)
  at Mafi.Core.Game.GameBuilder.RegisterModsPrototypesOrThrow (Mafi.Collections.ImmutableCollections.ImmutableArray`1[T] mods, Mafi.Core.Mods.ProtoRegistrator protoRegistrator)  
  at Mafi.Core.Game.GameBuilder.registerProtos (Mafi.Collections.ImmutableCollections.ImmutableArray`1[T] mods, Mafi.Collections.ImmutableCollections.ImmutableArray`1[T] configs, System.Action`2[T1,T2] protosDbRegFnBeforeMods, System.Action`2[T1,T2] protosDbRegFnAfterMods) [0x0001a]  
  at Mafi.Core.Game.GameBuilder+<BuildNewGameTimeSliced>d__1.MoveNext ()  
  at Mafi.Unity.GamePlayScene+<buildNewGame>d__13.MoveNext () [0x0007a]  
  at Mafi.Unity.GamePlayScene+<Initialize>d__12.MoveNext () [0x000a5]  
  at Mafi.Unity.Main.Update () [0x000f1]  
 ---> DataRegistrationException: ProtoBuilderException thrown on registration of data 'UnpoweredBalancers.UnpoweredBalancersResearchData'.
  at Mafi.Core.Mods.ProtoRegistrator.RegisterData (Mafi.Core.Mods.IModData dataClass) [0x0002b]  
  at Mafi.Core.Mods.ProtoRegistrator.RegisterDataWithInterface[TData] ()  
  at UnpoweredBalancers.UnpoweredBalancers.RegisterPrototypes (Mafi.Core.Mods.ProtoRegistrator registrator)  
  at Mafi.Core.Game.GameBuilder.RegisterModsPrototypesOrThrow (Mafi.Collections.ImmutableCollections.ImmutableArray`1[T] mods, Mafi.Core.Mods.ProtoRegistrator protoRegistrator) [0x0001e]  
 ---> ProtoBuilderException: Value 'Difficulty not provided!' of proto 'ResearchUnlockUnpoweredBalancers' was not set.
  at Mafi.Core.Prototypes.ProtoBuilderState`1[TState].ValueOrThrow[T] (System.Nullable`1[T] value, System.String name)  
  at Mafi.Core.Research.ResearchNodeProtoBuilder+State.BuildAndAdd ()  
  at UnpoweredBalancers.UnpoweredBalancersResearchData.RegisterData (Mafi.Core.Mods.ProtoRegistrator registrator)  
  at Mafi.Core.Mods.ProtoRegistrator.RegisterData (Mafi.Core.Mods.IModData dataClass)  
A 08:50:01,546 S------ ~Mai: Option<Mafi.Unity.MainMenu.LoadingScreen> has value 'Mafi.Unity.MainMenu.LoadingScreen' but expected to be None.
  at Mafi.Unity.Main.showLoadingScreen ()  
  at Mafi.Unity.Main.startScene (Mafi.Unity.IGameScene scene, System.Boolean displayLoadingScreen)  
  at Mafi.Unity.Main.GoToMainMenu (Mafi.Unity.MainMenu.MainMenuArgs args)  
  at Mafi.Unity.Main.Update ()  
  at Mafi.Unity.GameMainMb.Update ()  
A 08:50:01,548 S------ ~Mai: No resolver!
ASSERT: Value of Mafi.DependencyResolver is null but expected != null.
  at Mafi.Unity.GamePlayScene.GetResolver ()  
  at Mafi.Unity.Main.terminateCurrentScene ()  
  at Mafi.Unity.Main.startScene (Mafi.Unity.IGameScene scene, System.Boolean displayLoadingScreen)  
  at Mafi.Unity.Main.GoToMainMenu (Mafi.Unity.MainMenu.MainMenuArgs args)  
  at Mafi.Unity.Main.Update ()  
  at Mafi.Unity.GameMainMb.Update ()  
W 08:50:01,551 S------ ~Mai: No game runner, already terminated?
  at Mafi.Unity.GamePlayScene.Terminate ()  
  at Mafi.Unity.Main.terminateCurrentScene ()  
  at Mafi.Unity.Main.startScene (Mafi.Unity.IGameScene scene, System.Boolean displayLoadingScreen)  
  at Mafi.Unity.Main.GoToMainMenu (Mafi.Unity.MainMenu.MainMenuArgs args)  
  at Mafi.Unity.Main.Update ()  
  at Mafi.Unity.GameMainMb.Update ()  
W 08:50:01,551 S------ ~Mai: No resolver, already terminated?
  at Mafi.Unity.GamePlayScene.Terminate ()  
  at Mafi.Unity.Main.terminateCurrentScene ()  
  at Mafi.Unity.Main.startScene (Mafi.Unity.IGameScene scene, System.Boolean displayLoadingScreen)  
  at Mafi.Unity.Main.GoToMainMenu (Mafi.Unity.MainMenu.MainMenuArgs args)  
  at Mafi.Unity.Main.Update ()  
  at Mafi.Unity.GameMainMb.Update ()  
I 08:50:01,555 S------ ~Mai: Scene clean step
I 08:50:01,588 S------ ~Mai: Scene clean done
I 08:50:01,590 S------ ~Mai: Total memory: 9 MB, GC collected 17 MB in 2.5614 ms.
I 08:50:01,707 S------ ~Mai: Game was initialized in 1 steps and took 0.154 seconds to complete.
I 08:50:30,056 S------ ~Mai: Requesting game quit.
I 08:50:30,074 S------ ~Mai: Closing file logging