Skip to content

Fixed issue where the custom logo wasnt showing in the game#15

Open
jlcd wants to merge 1 commit intoArrow-kb:mainfrom
jlcd:main
Open

Fixed issue where the custom logo wasnt showing in the game#15
jlcd wants to merge 1 commit intoArrow-kb:mainfrom
jlcd:main

Conversation

@jlcd
Copy link

@jlcd jlcd commented Sep 11, 2025

Problem

Custom logos were visible in the shop and could be positioned correctly, but disappeared when vehicles were purchased and spawned in the game world. The game logs showed two critical errors:

  • 'getChildAt': Argument 1 has wrong type. Expected: Int. Actual: Nil
  • 'link': Argument 1 has wrong type. Expected: Int. Actual: Nil

Root Cause Analysis

  1. Stream corruption: BuyVehicleData.lua line 108 incorrectly used streamWriteStream() instead of streamWriteString() for parent path data
  2. Unsafe parent node traversal: Vehicle.lua attempted to parse parent paths without proper validation, leading to nil values being passed to getChildAt() and link()
  3. Missing error handling: Failed logo attachments caused crashes instead of graceful degradation

Changes Made

src/shop/BuyVehicleData.lua

  • Line 108: Fixed streamWriteStream(streamId, logo.parent or "0|")streamWriteString(streamId, logo.parent or "0|")
    • This was corrupting parent path data during network transmission between shop and vehicle spawning

src/vehicles/Vehicle.lua

  • Enhanced parent path parsing in setCustomLogoData():

    • Added validation for empty path segments
    • Added tonumber() result validation before calling getChildAt()
    • Added null checks for parent nodes during traversal
    • Added informative debug logging for troubleshooting
  • Improved error handling:

    • Gracefully handle cases where parent nodes cannot be found
    • Properly clean up resources (delete unused nodes) on failure
    • Mark failed logos for removal instead of crashing
    • Continue processing remaining logos even if some fail
  • Restructured control flow:

    • Moved logo processing logic inside proper conditional blocks
    • Eliminated unsafe goto usage
    • Ensured all code paths properly handle success/failure scenarios

Testing

These changes resolve the nil reference errors and ensure custom logos properly transfer from shop configuration to spawned vehicles. The mod now handles edge cases gracefully and provides useful debug information when issues occur.

Files Changed

  • src/shop/BuyVehicleData.lua
  • src/vehicles/Vehicle.lua

Working example

(awful placement, but, you can get the idea lol)
image

Ready to be used mod .zip:

FS25_CustomLogos.zip

Fixes #9
Fixes #11
Fixes #13
Fixes #14

@jlcd jlcd mentioned this pull request Sep 11, 2025
@newportbreak-lab
Copy link

this mod doest work wen i put mod on vehicle and buy nothing shows up on the vehicle

@jlcd
Copy link
Author

jlcd commented Sep 17, 2025

this mod doest work wen i put mod on vehicle and buy nothing shows up on the vehicle

Use the .zip I added at the end of the first message: FS25_CustomLogos.zip
It's fixed there... waiting on @Arrow-kb to approve the PR and update it wherever it was available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LUA Fehler Not working at all Error, not showing logos not working

2 participants