Cities: Skylines

Cities: Skylines

[DISCONTINUED - SEE DESCRIPTION FOR LINK TO A REPLACEMENT] Specialised Industry Fix [BUGFIX for Vanilla]
69 Comments
steevm  [author] 1 Nov, 2018 @ 1:54pm 
I've updated the description of this mod to include a link to the replacement. I haven't tried it myself, but I trust it works better than this version... ;)

Thanks @Vectorial1024
Vectorial1024 1 Nov, 2018 @ 7:43am 
Thanks for the permission!
And here it is: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1553517176
(Gotta include your screenshots later}
steevm  [author] 1 Nov, 2018 @ 7:04am 
Sure, why not? They're not particularly amazing though :D
Vectorial1024 31 Oct, 2018 @ 6:49am 
While I prepare the page for the updated mod, may I use the screenshots shown in this page up there?
padichat 30 Oct, 2018 @ 12:11pm 
Thanks to both of you ! But I can not believe there's still this buh while they updated industries. Maybe they did not get any bug reports.
steevm  [author] 30 Oct, 2018 @ 11:19am 
Cool, let me know when you have uploaded it I'll add a link to the top of the page here. You never know if there are other players who might come back after a 3 year absence and be looking to update their old mods...
Vectorial1024 30 Oct, 2018 @ 10:56am 
Good news, guys. :steamhappy: :steamhappy:
With the detailed documentation provided above (it is already sufficient to locate and fix the bug!), I am able to update this mod to the latest v1.11 Industries DLC update. The update I made is pretty stable too.
I'll be posting the update in the near future for all to use after I clean up my code and etc.
skylineslee 17 Aug, 2018 @ 7:44pm 
Ah OK I've found the part with the error from the randomizer line. Now I'll just follow the tutorials a bit more to get a quick fix hopefully! Thanks for your very detailed write up. Really got me started with modding haha.
skylineslee 17 Aug, 2018 @ 7:36pm 
I'm looking at SimulationStepActive in the code now. It looks like much has changed in there since your post. Let me try to understand if the bug still exists there. Thanks a lot for all your help!
steevm  [author] 17 Aug, 2018 @ 7:23pm 
I actually just hacked a version of the Rush Hour mod, because there was a very similar bug in rush hour with commercial buildings that was caused by the same issue with the integer arithmetic. So I just did exactly the same thing for the industrial resource buildings as I'd done for the commercial buildings. Which was essentially just do whatever PropaneDragon had done, and he answered a bunch of questions I had. This meant I never had an incentive to actually *understand* how the code worked. I just wanted to fix the bug...
steevm  [author] 17 Aug, 2018 @ 7:20pm 
If you can figure out how the redirects work, the actual code you need to change is just the couple of lines. I just can't remember how it all worked and no motivation to figure it out again. Basically you'll need to modify a couple of the AI classes and redirect the necessary calls. Because of how the class structure changed, this is non-trivial with my code base. Starting from scratch might actually be better.
skylineslee 17 Aug, 2018 @ 6:46pm 
@steevm thanks for letting me know. I'm following the tutorials on modding and hope to see how far I can get in an attempt to recreate this. :)
steevm  [author] 17 Aug, 2018 @ 3:16pm 
It won't compile for 1.6 because CO reworked all the base classes the mod modifies. So it simply isn't compatible any more.
skylineslee 17 Aug, 2018 @ 9:57am 
I really hope someone makes an update for this. Will greatly appreciate it.

What does this broken version break in 1.6?
steevm  [author] 27 Oct, 2017 @ 7:24am 
@Uguu: to be fair to Gilbert, the description of what my mod did is now buried beneath a load of technical information, so it might be easy to assume it does something else if you miss the explanation at the end.
steevm  [author] 27 Oct, 2017 @ 7:22am 
The CSL Service Reserve mod is a completely different kettle of fish. It is for service vehicles.

My mod fixed an issue with industries, not services. From the original description (before updates borked everything):

This mod fixes an issue in the base game where industries that produce natural resources (e.g. farms, forestry) will randomly toggle state form "Operating" to "Not Operating". You probably haven't noticed that you are suffering from this bug, but if you watch small (low worker) specialised industrial buildings, you'll notice some of them randomly flickering on and off despite having workers, power, water etc. Now you can put an end to it!
UguuDoki 27 Oct, 2017 @ 5:46am 
you said you found another mod that fixes "the" issue, then you didn't know if it fixes industry, so what was "the" issue? if in the first place "the" issue of yours was about services why came to ask here? sorry if i fail in logic.
GilbertRoyAlva 27 Oct, 2017 @ 5:29am 
This is the mod where I use to fix non operating services: I don't know if this also fixes industry but it fixes my problem: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=529979180
UguuDoki 27 Oct, 2017 @ 5:15am 
meanwhile, though not expecting anything positive, i've subscribe to thread.
steevm  [author] 27 Oct, 2017 @ 1:48am 
D'you want to tell me which mod, so I can link to it?
GilbertRoyAlva 26 Oct, 2017 @ 8:15pm 
Never mind I found another mod that fixes the issue. tnx anyway.
steevm  [author] 24 Oct, 2017 @ 10:40am 
When CO stop releasing DLC, I'll look at updating the mod again. Until then, sorry, but I don't have the time and patience. You'll have to take it up with CO and either get them to fix this bug, or get them to stop breaking everything with every money-grab.

Everything CO (or anyone else) needs to know to fix the bug is documented above.
GilbertRoyAlva 24 Oct, 2017 @ 9:09am 
any help for Green Cities update?
steevm  [author] 10 May, 2017 @ 12:03pm 
Yeah, an experienced modder could probably implement this quite quickly. As you can see, it's really just a couple of lines of code.vI think all the info necessary to implement the fix (if you know how to create a mod) is in the description - so feel free to point any friendly modders in the right direction.

I think hardly anyone has noticed this bug, as it's is pretty esoteric (see also https://steamhost.cn/steamcommunity_com/app/255710/discussions/0/365163686040191036/) . Hence no official fixes for it. You could always post on the Paradox forums and hope that CO implement a fix. They would also be the only ones in a position to know what the intended behaviour was; maybe there is a reason that they didn't cap minimum production at 1 but at 0.
chill_eule 10 May, 2017 @ 7:27am 
i still have issues with the specialised industry...!

sorry to hear that steevm!
would it be possible that you get in touch with one of the longtime hardcore modders, like bloodypenguin, samsamTS, thale5 or boformer ,to pass the torch? for some of these guys it would be an easy job to do, i think.
i really would like to help, but my understanding of this matter tends towards zero.
i just still can't comprehend the ignorance from colossal order in this matter, for what is clearly a bug. or why no one, except you, tried to fix this.
Memphis bell 5 May, 2017 @ 9:02am 
FYI they may have fixed the industry issue, I could be wrong, I just started playing and I havent had the issue so far, started at 0, my pop is at 10k and no issues so far.
steevm  [author] 5 May, 2017 @ 4:04am 
Here's the deal:

I'm currently not playing Skylines because I got tired of the endless cycle of DLC invariably breaking half the mods I have installed, which means endless troubleshooting, disabling mods, waiting for updates etc. etc. Seeing as it takes me about 10 minutes to load my save game, it's no fun when it borks after 8 minutes and you need to repeat the process. I'm sure a lot of you have been in the same boat.

If someone wants to either have the source code or implement their own fix, I can help with that.

The fix in an of itself is really simply, and I have updated the description with a bit more info in case someone takes it upon themselves to create a fix for the latest version of Skylines.
Memphis bell 30 Apr, 2017 @ 10:44pm 
Is the mod still being worked on?
chill_eule 25 Apr, 2017 @ 11:31pm 
i wonder why CO never adressed that issui themself.... instead some modder is doing their bugfixing and now they even screwed his work.
keep it up steevm! i hope you find a new solution for this very annoying bug.
steevm  [author] 3 Dec, 2016 @ 9:31am 
So I have taken a look at the code, I can get the initial error to disappear easily and the mod to display correctly in the list of mods. But CO have completely redone all the code relating to buildings because of how disasters are handled. This means the code I have will no longer work it might be an awful amount of effort to fix.

I will take another look at the code, but I couldn't fix it in a couple of hours. This is also why I'm no longer playing Skylines myself. I'm waiting until they've stopped releasing DLC and the game is stable. Then mods will no longer break and things will be a lot better,
Gwar 2 Dec, 2016 @ 2:55am 
Last patch broke a lot of mods, even the simple Mod Achievement Enabler isn't working anymore . Meanwhile I've noticed without your mod my cities export is reduced about -20%
...so at least it's a relief for traffic at the cargo hub.
steevm  [author] 30 Nov, 2016 @ 4:54pm 
I've taken a "quick" look (starting Skylines alone takes about 5 minutes) and yes there is something up. The message is displayed at the start of the game and the mod isn't showing up in the list of mods. It's not the only mod I have with this problem.

I can only assume the mod interface has changed, which means that you'll have to unsub the mod to avoid the error message until I can figure out what I have to do.

I'm hoping it's an easy fix, but because I'm very busy with work right now (website relaunch), it'll take some time until I can do more investigating.
Gwar 30 Nov, 2016 @ 9:10am 
I get the error when I'm subscribed to the mod, it's not even activated. In content menu instead of the mod name only it's number 662386761 is listed. When I'm unsubscribed everything works fine again.
steevm  [author] 30 Nov, 2016 @ 4:31am 
And you don't get the error when the mod is disabled? If so, I'll take a quick look tonight.
Gwar 30 Nov, 2016 @ 4:17am 
It seems to be broken. When subbed I get this popup message in main menu:
A Mod caused an error [ModException]

Details:
System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetExportedTypes () [0x00000] in <filename unknown>:0
at ColossalFramework.Plugins.PluginManager+PluginInfo.GetInstances[IUserMod] () [0x00000] in <filename unknown>:0
at EntryData.GenerateData () [0x00000] in <filename unknown>:0
steevm  [author] 29 Nov, 2016 @ 3:00pm 
Ah, I didn't realise there had been an update. Steam must have updated it in the background without me noticing while I was working.

Let me know if there's anything weird going on, but from reading the patch notes I can't see what they would have broken in this mod. As posted elsewhere, it's a couple of lines of code that only affect resource-producing industries, so the scope for breaking changes is thankfully limited. I really feel for the other mod authors who need to redo half the code with each update.
jpcosta92 29 Nov, 2016 @ 2:47pm 
@steevm: I'm still trying to figure out what other mods work after the update, I'll post here if I find any problems.
By the way, it has been working fine all this time, a very useful mod. Thanks!
steevm  [author] 29 Nov, 2016 @ 2:33pm 
Note that this issue is directly linked to the number of employees a building has, so it doesn't affect buildings above a certain number of employees. That might also be why a lot of people seem to experience issues with toggling industries and the realistic population mod, that can drastically change the number of employees.
steevm  [author] 29 Nov, 2016 @ 2:30pm 
AFAIK it still works - I updated it a couple of months ago and it "worked". I'd think someone would have twigged if it was broked since then.

Can't tell you whether the base game still has this issue as I haven't played for months and always had it enabled when playing. But if you check out your small resource industries, you will probably stumble across one that is toggling its status if the problem still persists. It was pretty rampant in my game.
jpcosta92 29 Nov, 2016 @ 2:13pm 
Does anyone know if this mod is still necessary or even if it is working?
steevm  [author] 21 Oct, 2016 @ 7:17am 
If you are interested at all in the technical side of things and want to understand more about the two bugs (Rush Hour commercial buildings and vanilla industrial buildings), here is the thread that was the genesis of this fix:
https://steamhost.cn/steamcommunity_com/app/255710/discussions/0/365163686040191036/

It's quite long, but I did edit the first post with a sort of summary.
steevm  [author] 21 Oct, 2016 @ 7:13am 
AFAIK - having not played Skylines for ages due to how long it takes to start up - the bug is still there in vanilla.

There is no fix in Rush Hour, as Rush Hour isn't the cause of the bug. I only used the Rush Hour code as a basis for my fix, because I downloaded the Rush Hour source code to investiage a similar bug that affected commercial buildings (not industry) in the Rush Hour code. The cause of both errors was due to a similar issue, but this fix only addresses the issues with industrial buildings. It has nothing to do with Rush Hour apart from that reusing the skeleton source code probably saved me hours of work.

AFAIK, the bug in Rush Hour with commerical buildings shutting down was fixed a long time ago.
myidisnotthis 20 Oct, 2016 @ 10:30pm 
Thanks, I just find out the switching problem when testing the realistic pop and consumption mod.

Has this bug officailly fixed yet? Or Rush Hour has incorporated this fix?
UguuDoki 12 Sep, 2016 @ 2:41pm 
Good communication. Thanks!
steevm  [author] 12 Sep, 2016 @ 8:45am 
So, it took longer than expected, but I removed the debug message. Had a bit of a snafu with Visual Studio and file paths being all over the place, and not remembering which project was the most recent. Note to self: make notes to self.

I have only tested the mod in so far as I checked that it doesn't crash the game, so if there is anything weird happening with industries, let me know.
steevm  [author] 1 Sep, 2016 @ 8:32am 
I since looked at the code and realised that this was a debug message I added when I updated the mod, and it probably shouldn't have been left in when I'd finished debugging. At least it means that the update works :) I hope to have time to update the mod on the weekend. I had a quick look and realised that I'd forgotten how everything is set up since I last touched the code half a year ago.
76561198040825666 1 Sep, 2016 @ 8:08am 
Ok, thanks for the quick answer. And yes, sorry I forgot to mention it, I do have the Realistic Population mod installed, and Citizen Lifecycle Rebalance.
steevm  [author] 31 Aug, 2016 @ 1:35am 
Hmm, I just checked my own log file, and you are right, it's probably overkill to write this stuff to the log file all the time. I'll see if I can remove the log entries and update the mod.
steevm  [author] 31 Aug, 2016 @ 1:29am 
The log messages aren't necessary per se, I just left a couple in to make sure that if there were buildings that would have shut down, it gets logged somewhere. I actually had a lot more log messages at some point, as it's the only way to debug the code. Is this the only thing that is making your log file so large?

Also, have you by any chance got other mods installed that may mess around with the production rate of buildings (e.g. realistic population or similar)? I ask because this might be creating conditions where the buildings are much more likely to shut down.
76561198040825666 30 Aug, 2016 @ 2:50pm 
Thank you for this fix, it's great. I've used it for a while now.
But recently I happened to look at the output_log.txt file after a game and I thought it was unusually large (20MB), and it is full of lines like this:
"Industry Fix: Extraction rate was zero despite having 2 workers! This can shut down the building! Setting to 1instead"
Seems like it's from this mod. Isn't causing any problems but is it necessary?