Closed gormster closed 3 years ago
Looks good - I'll have a play with it and see how it goes.
Sorry, just remembered I never got back to this - the code as provided doesn't work for several reasons, and I'm looking at alternative ways to provide the same functionality.
Oh whoops! Yeah I know it doesn’t - I actually cloned the repo and got it… sort of working. But like, very sort of. It behaves quite oddly when there’s zoning on one side already, like roads running next to cliffs.
I should probably fork the repo and push the changes up… but honestly they’re so jank it’s probably not worth. This was my first attempt at modding C:S and also my first time using C# in years and years.
Playing around with it, though, it seems like it might almost be easier to give users the ability to just straight up move the zoning blocks around with the mouse. The game doesn’t seem to particularly care where they are relative to their attached road. But I don’t really have a clue how you do UI stuff in this game.
On 12 Aug 2021, at 10:14 am, algernon-A @.***> wrote:
Sorry, just remembered I never got back to this - the code as provided doesn't work for several reasons, and I'm looking at alternative ways to provide the same functionality.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/algernon-A/ZoningAdjuster/issues/7#issuecomment-897246610, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABFEXUIRUVUYCEKCZH5LADT4MG73ANCNFSM5AXDGACQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.
Eventually, I had to patch code elsewhere to make up for the game's inconsistency - interestingly, the left/right zone block allocation is consistent for curves, but not for straight roads.
Functionality is implemented in 16cc3c83f0ee13729a65c1335068dd366d6ffab0 if you want to check it out - toggled when clicking with the Alt key held down, as initial playtesting showed an unqualified mouse click was confusing and caused unnecessary (UX) delays to basic operaitons.
The basic concept is still yours, though, so thanks!
Implemented in 16cc3c83f0ee13729a65c1335068dd366d6ffab0
Quite often, the simplest option for fixing zoning issues would be to simply disable zoning on one side of the road. I noticed in
CreateZoneBlocks.cs
you're creating the left and right sides individually - why not have right click remove zoning from both sides, then left, then right, cyclically?You could do this even without messing with those complicated
CreateXBlock
functions by callingRemoveZoneBlock
right after creating it. It's probably not terribly efficient… but a minimal implementation could look something like thisUnfortunately I don't have an environment set up to build C:S mods from source (the built-in compiler is broken on macOS lol) so I can't actually test that code or file a PR. But it should work?
(edit: actually I don't think it will work because the segment isn't passed by reference so we don't get the new values for m_block*. but that should be a pretty easy fix.)
(edit edit: pretty sure that's fixed it. not exactly efficient with my use of code, but it's more didactic this way.)