Code:
--
-- Add a tree node for each category
--
for CategoryName, v in SortedPairs( Categorised ) do
-- Add a node to the tree
local node = tree:AddNode( CategoryName, "icon16/bricks.png" );
-- When we click on the node - populate it using this function
node.DoPopulate = function( self )
-- If we've already populated it - forget it.
if ( self.PropPanel ) then return end
-- Create the container panel
self.PropPanel = vgui.Create( "ContentContainer", pnlContent )
self.PropPanel:SetVisible( false )
self.PropPanel:SetTriggerSpawnlistChange( false )
for k, ent in SortedPairsByMemberValue( v, "PrintName" ) do
if not ent then return end //Zeile 46
local Icon = spawnmenu.CreateContentIcon( ent.ScriptedEntityType or "entity", self.PropPanel,
{
nicename = ent.PrintName or ent.ClassName,
spawnname = ent.ClassName,
material = "materials/spawnicons/"..ent.Model,
admin = ent.AdminOnly || ( !ent.Spawnable && ent.AdminSpawnable )
})
Icon.DoClick = function ()
LocalPlayer():ConCommand("buy_entity "..ent.ClassName)
end
local Tooltip = Format( "Name: %s\nPrice: %s", ent.PrintName, ent.Price )
Icon:SetTooltip( Tooltip )
end
end
-- If we click on the node populate it and switch to it.
Hm muss das so wenn ja geht das nicht.
gibt es ürgendwo vernüftige fils für basewars?