Jump to content

Recommended Posts

When my friends play as the guest of my server with my custom character mod.

 

He said that he could use custom character's mod item.

 

However, he said that this item did not emit light.

 

I means.. the host of server only could see this light.

 

So I relocated a code - [ if not TheWorld.ismastersim then return inst end ], but, my friends could not come to my server after I relocated.

 

Please give me advice on this problem.

 

Here is my mod Item code.

 

 

 

 

 

 

 

 

 

local assets=

{

Asset("ANIM", "anim/spiderball.zip"),

  Asset("ATLAS", "images/inventoryimages/spiderball.xml"),

  Asset("IMAGE", "images/inventoryimages/spiderball.tex")

}

 

 

 

local function fn()

local inst = CreateEntity()

inst.entity:AddTransform()

inst.entity:AddAnimState()

 

 

 

 

    inst.entity:AddNetwork()

    MakeInventoryPhysics(inst)

 

    if not TheWorld.ismastersim then

        return inst

    end

 

    inst.AnimState:SetBank("bulb")

    inst.AnimState:SetBuild("spiderball")

    inst.AnimState:PlayAnimation("idle")

 

 

 

    inst:AddComponent("stackable")

    inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM

 

    inst:AddComponent("tradable")

    inst:AddComponent("inspectable")

 

    

    MakeSmallPropagator(inst) 

 

 

    inst:AddComponent("inventoryitem")

    inst.components.inventoryitem.atlasname = "images/inventoryimages/spiderball.xml"

 

 

    inst:AddComponent("edible")

    inst.components.edible.healthvalue = TUNING.HEALING_TINY

    inst.components.edible.hungervalue = 0

  

 

 

    local light = inst.entity:AddLight()

    light:SetFalloff(0.7)

    light:SetIntensity(.5)

    light:SetRadius(1.0)

    light:SetColour(237/255, 237/255, 209/255)

    light:Enable(true)

    inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )

    inst.components.inventoryitem:SetOnDroppedFn(function() inst.Light:Enable(true) end)

    inst.components.inventoryitem:SetOnPickupFn(function() inst.Light:Enable(false) end)

 

 

    inst:AddComponent("fuel")

    inst.components.fuel.fuelvalue = TUNING.TINY_FUEL

 

 

 

return inst

end

 

 

return Prefab( "common/inventory/spiderball", fn, assets ) 

Edited by Conker446

I'm not sure how the networking works for lighting, but you could probably use the one that thermal stones (heatrock) use:

    inst._light = SpawnPrefab("heatrocklight")

There are numerous other parts of the heatrock prefab that interact with it, though, so it will probably take more than just that.

Edited by rezecib

I'm not sure how the networking works for lighting, but you could probably use the one that thermal stones (heatrock) use:

    inst._light = SpawnPrefab("heatrocklight")

There are numerous other parts of the heatrock prefab that interact with it, though, so it will probably take more than just that.

 

You always give me a great solution. Thank you! I'll try that!

Edited by Conker446

@Conker446, I'm also going to release my ports of Webber and Wigfrid on the workshop pretty soon, I'm just trying to fix a few last bugs (ghosts are losing their hair... o_O). So that will help you get the Webber features into your mod :) 

@Conker446, I'm also going to release my ports of Webber and Wigfrid on the workshop pretty soon, I'm just trying to fix a few last bugs (ghosts are losing their hair... o_O). So that will help you get the Webber features into your mod :-)

 

 

It is honor to hear that, sir!!

 

You must be a great programmer on this field, am I right?

 

I always appreciate for your help!

 

I want to put your name as my mod contributer!

 

Anyway, there is another good news for me.

 

I've got a message from Peter A when I was active on Steam.

 

He said that my character would be fine if I continue to keep my direction on this mod!

 

How cool they are?!

Edited by Conker446

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
×
  • Create New...