Jump to content

Map Icons Z Ordering and MiniMapEntity:SetPriority()

Recommended Posts

I have made a simple mod in which I added map icons to existing prefabs.
These icons appear, but they hide the player icon on the map.

After looking around, I found that MiniMapEntity has a function called SetPriority which seems to control the Z ordering of layers.
I've tried setting it to various numbers, to no effect.
What's more, I used the in-game console, placed my mouse cursor over an instance of one of these prefabs and then executed the command:


Nothing changed.
I tried various values, of course.
If I did the same on an instance of some other random prefab (specifically one of the pig houses in Hamlet), changing the priority value like this did put its icon over or under the player's icon, but it didn't work on the ones I changed.
In case it matters, the prefabs I changed were of the pig merchants (this mod is for showing icons for the merchants so it would be easier to find the ones you want to trade with).

Any idea what I'm doing wrong here and how I can make the icons appear under the player icon?

This is the entirety of my short modmain.lua file:

Assets =

local TRADERS = {

for i, trader in ipairs(TRADERS) do
	table.insert(Assets, Asset("IMAGE", "minimap/" .. trader .. "_icon.tex"))
	table.insert(Assets, Asset("ATLAS", "minimap/" .. trader .. "_icon.xml"))
	AddMinimapAtlas("minimap/" .. trader .. "_icon.xml")
	AddPrefabPostInit(trader, function(inst)
		local minimap = inst.MiniMapEntity or inst.entity:AddMiniMapEntity()
		minimap:SetIcon(trader .. "_icon.tex")

Thanks in advance.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

  • Create New...