Jump to content

Custom Light Source not showing with caves.


Recommended Posts

So I've been working on my mod: http://steamcommunity.com/sharedfiles/filedetails/?id=600703996

And I've ran into a problem that I'm not sure how to fix, or if it's on Klei's end. Basically the character's "aura sphere" item gives off a small amount of light when equipped, but when you add caves to a server the light no longer shows up. Charlie doesn't attack and I don't have darkness sanity loss, as if I'm in the light, but I can't see or interact with anything. It's worth noting it all works fine when caves are not enabled.

Reproducing the problem: Start a server with caves. Then equip aura sphere, it gives off no light.

My coding knowledge is pretty abysmal so I'm not sure if I just need to change something for caves. Just curious if anyone knows a work around or if it's just something I need to wait to get fixed.

Link to comment
Share on other sites

I remember my friend Ren had problems with that, remember, This happens because all lights has his separated fire prefab, the most basic example it's the Morning Star, that weapon has 2 prefabs, the first it's the item, and the another one it's the light prefab of that weapon. If you don't use that the item will show for you, but not for the other people still it has his properties of protect you from charlie. The yellow amulet has that bug, I already reported, but Klei didn't fixed ;_;

Well then, about the aura sphere, when you equip it, instead of this

    inst.Light:Enable(true)
    inst.Light:SetIntensity(.75)
    inst.Light:SetColour(0/255, 150/255, 255/255)
    inst.Light:SetFalloff(1)
    inst.Light:SetRadius(1)

You can put this.

    inst.fire = SpawnPrefab("auraspherelight")
    local follower = inst.fire.entity:AddFollower()
    follower:FollowSymbol(owner.GUID, "swap_object", 0, -110, 1) --This one I don't know how to explain,

and when you unequip, instead of this

inst.Light:Enable(false)

You can put this.

    inst.fire:Remove()
    inst.fire = nil

This spawns and light called, by your desicion, I named auraspherelight

local function fn()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddLight()
    inst.entity:AddNetwork()

    inst.Light:SetIntensity(.75)
    inst.Light:SetColour(0/255, 150/255, 255/255)
    inst.Light:SetFalloff(1)
    inst.Light:SetRadius(1)
    inst.Light:Enable(true)

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst.persists = false

    return inst
end

return Prefab("auraspherelight", fn, nil, prefabs)

Sorry, I don't know how to put this in the code form D:

Edited by Neutral_Steve
Link to comment
Share on other sites

Thanks for the reply I'll definitely give this a shot.

Edit: Man I feel dumb, I could have figured this out so easily if I just looked at the morning star, thanks for the help though, it works.

Edited by Ech
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...