Fix mechanic not being persistent#5306
Conversation
|
I'm guessing this might be related: #4810 |
|
@impaktor I've tested DonateToCranks and GoodsTrader and they are persistent. However, there is an intermittent problem with onCreateBB being rerun on bulletin boards that are already existing, described in #5305, and I think this is what's failing here. It's an intermittent issue so it may take some time to trigger it. At the time of #4810, #5305 would have behaved differently and I haven't seen onCreateBB being triggered on those earlier builds, but I think the core issue would have been the same/same-ish. |
|
This PR is ready for review. For the other/similar issues mentioned above I believe they need more troubleshooting and most, if not all, depend on other issues. |
|
Looking at the code, doesn't look like it will be persistent, i.e. same mechanic on same station always? I think that was the intention with the old code. Or are you using the |
|
Thanks! Right, I don't actually know how to fly around in this game and it looks like I actually have to do that now. Will try it... :) For the code I guess I have to go: local onCreateBB = function (station)
local rand = Rand.New(station.seed + seedbump)
local n = rand:Integer(1,#flavours)
- local mechanic = Character.New()
+ local mechanic = Character.New({seed=rand:Integer()}) |
The 'Breakdown Servicing' character changes face in between chats. This is because
Character.New()is called from theonChatfunction and somehow doing it with a persistent seed doesn't give persistent result. I don't know why that doesn't work. Instead I simplified the code a bit by generating the character ononCreateBB.