Jump to content

Recommended Posts

For example using this mod disables sounds of mobs if you are not the host.

Any way to fix this?

Here is the code:

function AddMap(prefab)
        table.insert(Assets, Asset("IMAGE", "images/" .. prefab .. ".tex"))
        table.insert(Assets, Asset("ATLAS", "images/" .. prefab .. ".xml"))
        AddMinimapAtlas("images/" .. prefab .. ".xml")
        AddPrefabPostInit(prefab, function(inst)
            inst.entity:AddMiniMapEntity()
            inst.MiniMapEntity:SetIcon(prefab .. ".tex")
        end)
end

 

Quote

Thanks, works almost perfectly. Some non-mobs icons now missing. But this works perfectly for mobs, so I've just made two functions: one for mobs and second for non-mobs

Edited by h4uja2

@DarkXero, do you know why adding a MinimapEntity component to an entity only on client (or only on the server) affects SoundEmitter? Is there some hidden network synchonization issue? Does this apply to other components as well, e.g. Light)?

2 hours ago, Maris said:

Probably you should check if MiniMapEntity already exists before adding another one.

Yes, but I tested it with beefalo only. They didn't have sounds. And they don't start with a MiniMapEntity already.

8 hours ago, Muche said:

do you know why adding a MinimapEntity component to an entity only on client (or only on the server) affects SoundEmitter? Is there some hidden network synchonization issue?

No, and yes.

Despite what it looks like, MiniMapEntity has some networking. Make a server, enter it, and input something like:

Remote: c_find("multiplayer_portal").MiniMapEntity:SetIcon("glommer.png")

You will see that the change propagates to your client minimap.

8 hours ago, Muche said:

Does this apply to other components as well, e.g. Light)?

Light doesn't have any networking that breaks sounds, as far as I know.

Which is why you can have lights on your side, but still get hit by Charlie in the server.

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...