Skip to content

Option to set prop instance as non-active #6

@sway2020

Description

@sway2020

(I am not familiar with how EML does prop rendering so I can be totally wrong on this. I am just reading some code on Github and guessing)

In the original game code, other mods can use a simple harmony prefix to set active=false for PropInstance.RenderInstance(), and functionally disable the illumination map texture for a specific PropInfo. My vehicle prop conversion mods use this approach to bypass the loading time issue in Elektrix' original mod. I am wondering if there is a way to do this with EML. This will probably also be useful in the future when you implement the "vehicle prop conversion on the fly" feature into Prop Anarchy

if (info.m_illuminationOffRange.x < 1000f || info.m_illuminationBlinkType != LightEffect.BlinkType.None) {
randomizer = new Randomizer(id.Index);
illumRange = info.m_illuminationOffRange.x + randomizer.Int32(100000u) * 1E-05f * (info.m_illuminationOffRange.y - info.m_illuminationOffRange.x);
objectIndex.z = EMath.SmoothStep(illumRange + 0.01f, illumRange - 0.01f, lightSystem.DayLightIntensity);
if (info.m_illuminationBlinkType != LightEffect.BlinkType.None) {
blinkVector = LightEffect.GetBlinkVector(info.m_illuminationBlinkType);
illumStep = illumRange * 3.71f + simulationTimer / blinkVector.w;
illumStep = (illumStep - (int)illumStep) * blinkVector.w;
objectIndex.z *= 1f - EMath.SmoothStep(blinkVector.x, blinkVector.y, illumStep) * EMath.SmoothStep(blinkVector.w, blinkVector.z, illumStep);
}
} else {
objectIndex.z = 1f;
}
}

Original game code:

if (!active && !info.m_alwaysActive)
    {
        objectIndex.z = 0f;
    }
    else if (info.m_illuminationOffRange.x < 1000f || info.m_illuminationBlinkType != 0)
    {
        LightSystem lightSystem = Singleton<RenderManager>.instance.lightSystem;
        Randomizer randomizer = new Randomizer(id.Index);
        num = info.m_illuminationOffRange.x + (float)randomizer.Int32(100000u) * 1E-05f * (info.m_illuminationOffRange.y - info.m_illuminationOffRange.x);
        objectIndex.z = MathUtils.SmoothStep(num + 0.01f, num - 0.01f, lightSystem.DayLightIntensity);
        if (info.m_illuminationBlinkType != 0)
        {
            Vector4 blinkVector = LightEffect.GetBlinkVector(info.m_illuminationBlinkType);
            float num2 = num * 3.71f + Singleton<SimulationManager>.instance.m_simulationTimer / blinkVector.w;
            num2 = (num2 - Mathf.Floor(num2)) * blinkVector.w;
            float num3 = MathUtils.SmoothStep(blinkVector.x, blinkVector.y, num2);
            float num4 = MathUtils.SmoothStep(blinkVector.w, blinkVector.z, num2);
            objectIndex.z *= 1f - num3 * num4;
        }
    }
    else
    {
        objectIndex.z = 1f;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions