Override vanilla materials?

Discussion in 'Programming' started by General_Cool, Nov 24, 2025 at 8:26 PM.

  1. General_Cool

    General_Cool
    Expand Collapse

    Joined:
    Jul 29, 2014
    Messages:
    18
    I am currently trying to make a lightbar mod using the concealed flashers mesh and flexbody, which has the option for different colors on vanilla cars (i.e. when selecting concealed flashers, you have the option between blue, red, amber, or blue/red). I am using the vanilla game color switcher function "$=$components.lightbarMaterials.flasher1" (and "$=$components.lightbarMaterials.flasher2"), which allows me to use the "flasher_colors.jbeam" file in vehicles/common/police_parts/ (in the Steam directory) to change light colors.

    In current state, it is functioning exactly as intended, but I want to create a new "main.materials.json" file for my mod to make a new emissive map for the lights that has more bloom. To accomplish this, I need to create a new jbeam that reuses the code found in "flasher_colors.jbeam" but instead points to my new emissives (i.e. instead of "policeparts_lights_blue_on" it points to "policeparts_lights_blue_on_brighter").

    The problem I am encountering is the jbeam for my lightbar is completely ignoring the new jbeam and still using the one from the Steam directory, and I suspect that is to do with the function I am using in the lightbar jbeam. Naming the new jbeam file "flasher_colors.jbeam" and renaming the folder it is in in my mod's common folder to "police_parts" causes texture loss on the rest of the police parts in the game (partition, radar, laptop, etc.) since the game then overrides the Steam directory. I need a way to name that folder and the jbeam something different but still have my lightbar use that instead of the vanilla game files.

    How can I modify the function "$=$components.lightbarMaterials.flasher1" to instead point to my mod's jbeam file? Is there a components jbeam file I need to create or add to my existing lightbar jbeam, do I need to rename "lightbarMaterials" to something else, etc.?

    P.S. Apologies if this is a very simple solution; I am new to jbeam and still trying to learn.

    EDIT: Problem solved! I changed the material name from "lightbarMaterials" to "lightbarMaterialsBright" and it fixed the issue. The game now uses my files for my lightbar and it's own files for the vanilla lightbar despite the two sharing assets.
     
    #1 General_Cool, Nov 24, 2025 at 8:26 PM
    Last edited: Nov 24, 2025 at 10:00 PM
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice