Features having a minimap icon.

Features having a minimap icon.

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Features having a minimap icon.

Post by smoth »

So how doable is this for a lua nub like me?
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Features having a minimap icon.

Post by CarRepairer »

I'd suggest making them as gaia units.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Features having a minimap icon.

Post by zwzsg »

I suggest directly drawing whatever on the minimap. Exemple from kp_geoshighlight.lua

Code: Select all

-- Draw Mini Map Geos Highlight
local function MiniMapDrawGeosEmplacement()
	gl.PushMatrix()
	gl.LoadIdentity()
	gl.Translate(0,1,0)
	gl.Scale(1/Game.mapSizeX,-1/Game.mapSizeZ,1)
	for _,geo in ipairs(GeoSpots) do
		gl.PolygonMode(GL.FRONT_AND_BACK, GL.FILL) -- default
		gl.Rect(geo.x+32,geo.z+32,geo.x-32,geo.z-32)
		-- because rectangles disappear when smaller than one pixel, also draw a point
		gl.PointSize(1.0) -- default
		gl.BeginEnd(GL.POINTS,function()gl.Vertex(geo.x,geo.z)end)
	end
	gl.PopMatrix()
end

function widget:DrawInMiniMap(sx, sz)
		if GeoMiniMapDrawList==nil then
			GeoMiniMapDrawList=gl.CreateList(MiniMapDrawGeosEmplacement)
		end
		gl.Color(0.15,0.5,0.2,1)
		gl.CallList(GeoMiniMapDrawList)
		gl.Color(1,1,1,1)
end
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Features having a minimap icon.

Post by smoth »

CarRepairer wrote:I'd suggest making them as gaia units.
There is a limit to how many units gaia can have
features are more efficient

thank you z, I will try it out.
Post Reply

Return to “Lua Scripts”