-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid mixing up truckfiles when filename isn't unique. #3171
base: master
Are you sure you want to change the base?
Avoid mixing up truckfiles when filename isn't unique. #3171
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate files spawn OK now, however trying to load a savegame with them always crashes.
Indeed, the savegames only record the filename. Same goes for:
I'll try the following solution: in any text field which expects filename, user can also put |
Very good point, I'll strip the names from the log messages. EDIT: done. |
Fixes RigsOfRods#3166 Problem: When spawning an actor, the cache entry was always looked up via truckfile name, even if it was already known from the Selector UI. This potentially caused mixups. Fix: Use the entry provided by Selector UI.
…r.truck" Problem: in many scenarios, the game select an actor by truckfile name alone: * savegames * preselected truck in RoR.cfg * preloaded trucks on terrain (.tobj) * Multiplayer spawn notifications Solution: introduce an optional "Bundle-qualified" syntax, i.e. "mybundle.zip:myactor.truck" (in case of ZIP archive) or "mysubdir:myproject.truck" (in case of subdir) and use it in all the above cases. Because it's optional, it doesn't need a version bump in savegame format or RoRnet protocol. Note that 'bundle' is RoR jargon for a ZIP archive or directory under /mods. Codechanges: * CacheSystem: completely eliminated helpers `CheckResourceLoaded()` which searched across all resource groups, potentially introducing mixups. Extended `FindEntryByFilename()` to support the new Bundle-qualified syntax. * TerrainObjectManager: don't check preselected trucks immediatelly, it will be done on spawn anyway. * Savegame: always use the Bundle-qualified syntax. * Actor: in multiplayer, always use the Bundle-qualified syntax when announcing spawn.
17c7abd
to
bb2cbbb
Compare
Works as intended. |
This is a bundle-qualified format, where 'bundle' is ZIP/subdir in modcache. See RigsOfRods/rigs-of-rods#3171 Code changes: - RoR_client: new function `getTruckFilenameFromStreamName()` with commentary. Existing `getTruckInfo()` extended to use it. - services_start: just renamed the banlist-scanning function for clarity
Fixes #3166
Problem1: When spawning an actor, the cache entry was always looked up via truckfile name, even if it was already known from the Selector UI. This potentially caused mixups.
Fix2: Use the entry provided by Selector UI.
Problem2: in many scenarios, the game selects an actor by truckfile name alone:
Fix2: introduce an optional "Bundle-qualified" syntax, i.e. "mybundle.zip:myactor.truck" (in case of ZIP archive) or "mysubdir:myproject.truck" (in case of subdir) and use it in all the above cases. Because it's optional, it doesn't need a version bump in savegame format or RoRnet protocol. Note that 'bundle' is RoR jargon for a ZIP archive or directory under /mods.
Testing
Use the attached mods and spawn them using console commands:
dafsemiMixupTest_hangar.zip
dafsemiMixupTest_transred.zip
This uses just filename - it will spawn the first one in your 'mods.cache' JSON file.
This uses explicit bundle name, so it will spawn the Transred variant.
This uses explicit bundle name and demonstrates case-insensitive lookup - it will spawn the Hangar variant.