diff --git a/gamemode/engine/core/client/cl_fonts.lua b/gamemode/engine/core/client/cl_fonts.lua index 6ff6736..4a72d9d 100644 --- a/gamemode/engine/core/client/cl_fonts.lua +++ b/gamemode/engine/core/client/cl_fonts.lua @@ -67,6 +67,12 @@ surface.CreateFont( "q_header_s", { antialias = true }) +surface.CreateFont( "q_header_vs", { + font = "Constantia Bold Italic", + size = 35 * Quantum.Client.ResolutionScale, + antialias = true +}) + surface.CreateFont( "q_title", { font = "Cambria Bold", size = 60 * Quantum.Client.ResolutionScale, diff --git a/gamemode/engine/derma/lib/cl_menu_iteminfo.lua b/gamemode/engine/derma/lib/cl_menu_iteminfo.lua index e7c3057..1fadce2 100644 --- a/gamemode/engine/derma/lib/cl_menu_iteminfo.lua +++ b/gamemode/engine/derma/lib/cl_menu_iteminfo.lua @@ -367,7 +367,7 @@ function iteminfo.giveoptions( p, page ) end -function iteminfo.givetooltip( p, page ) +function iteminfo.givetooltip( p, page, addW ) local item = p:GetParent().item local parWidth, parHeight = p:GetParent():GetSize() @@ -492,10 +492,15 @@ function iteminfo.givetooltip( p, page ) p.ItemTooltipPanel = tooltip -- set the tooltip + local addToW = 0 + if( addW ) then + addToW = tooltip.w + end + p.Think = function( self ) self.ItemTooltipPanel:SetVisible( self:IsHovered() ) if( self:IsHovered() ) then - self.ItemTooltipPanel:SetPos( gui.MouseX() - tooltip.w/2, gui.MouseY() - ( tooltip.h + padding ) ) + self.ItemTooltipPanel:SetPos( gui.MouseX() - tooltip.w/2 + addToW, gui.MouseY() - ( tooltip.h + padding ) ) end end diff --git a/gamemode/engine/derma/lib/cl_menu_theme.lua b/gamemode/engine/derma/lib/cl_menu_theme.lua index 9fd7a49..208a465 100644 --- a/gamemode/engine/derma/lib/cl_menu_theme.lua +++ b/gamemode/engine/derma/lib/cl_menu_theme.lua @@ -75,14 +75,16 @@ function theme.button( b, color ) draw.RoundedBox( 4, padding_s/2, padding_s/2, w - padding_s, h - padding_s, clr ) -- inner end -function theme.sharpbutton( b, inClr ) +function theme.sharpbutton( b, inClr, borderAlpha, hoverBorderAlpha ) + borderAlpha = borderAlpha || 255 + hoverBorderAlpha = hoverBorderAlpha || borderAlpha local w, h = b:GetSize() inClr = inClr || Color( 235, 64, 52, 255 ) if( !b:IsHovered() ) then - surface.SetDrawColor( 205, 205, 205, 255 ) + surface.SetDrawColor( 205, 205, 205, borderAlpha ) else - surface.SetDrawColor( 116, 185, 255, 255 ) + surface.SetDrawColor( 116, 185, 255, hoverBorderAlpha ) end surface.DrawOutlinedRect( 0, 0, w, h ) diff --git a/gamemode/engine/derma/menus/menu_crafting.lua b/gamemode/engine/derma/menus/menu_crafting.lua index 18b8de8..d2efb37 100644 --- a/gamemode/engine/derma/menus/menu_crafting.lua +++ b/gamemode/engine/derma/menus/menu_crafting.lua @@ -40,7 +40,7 @@ local function createItemAmountLabel( icon, item ) return icon.amountpanel end -local function createItemPanel( x, y, scale, parent, frame ) +local function createItemPanel( x, y, scale, parent, frame, addW ) local p = vgui.Create( "DPanel", parent ) p:SetSize( itemWidth * scale, itemHeight * scale ) p.w, p.h = p:GetSize() @@ -67,7 +67,7 @@ local function createItemPanel( x, y, scale, parent, frame ) p.icon.tooltip:Remove() -- remove the old end - p.icon.tooltip = iteminfo.givetooltip( p.icon, frame ) -- create a new + p.icon.tooltip = iteminfo.givetooltip( p.icon, frame, addW ) -- create a new p.icon.tooltip:CreateInfo() p.icon:SetVisible( true ) @@ -120,20 +120,29 @@ function menu.open( dt ) if( !Quantum.Client.CurStationMenu ) then Quantum.Client.IsInMenu = true + local back = vgui.Create( "DPanel" ) + back:SetSize( sw, sh ) + back.Paint = function( self ) + theme.renderblur( self, 20, 20 ) + end + local f = vgui.Create( "DFrame" ) Quantum.Client.CurStationMenu = f - f:SetSize( sw, sh ) + f:SetSize( 1100 * resScale, 800 * resScale ) f.w, f.h = f:GetSize() + f:SetPos( sw/2 - f.w/2, sh/2 - f.h/2 ) + f:SetTitle( "" ) f:SetDraggable( false ) f:ShowCloseButton( false ) f:MakePopup() f.Paint = function( self, w, h ) - surface.SetDrawColor( 0, 0, 0, 40 ) + surface.SetDrawColor( 0, 0, 0, 120 ) surface.DrawRect( 0, 0, w, h ) theme.renderblur( self, 10, 10 ) end function f:OnClose() + back:Remove() Quantum.Client.IsInMenu = false Quantum.Client.CurStationMenu = nil Quantum.Client.Cam.Stop() @@ -162,7 +171,7 @@ function menu.open( dt ) -- Title -- local bar = vgui.Create( "DPanel", f ) - bar:SetSize( f.w, padding*5 ) + bar:SetSize( f.w, padding*4 ) bar.w, bar.h = bar:GetSize() bar:SetPos( 0, 0 ) bar.Paint = function( self ) theme.blurpanel( self ) end @@ -171,7 +180,7 @@ function menu.open( dt ) -- Inventory title -- title = vgui.Create( "DLabel", bar ) title:SetText( stationTbl.name || "ERROR name=nil" ) - title:SetFont( "q_header_s" ) + title:SetFont( "q_header_vs" ) title:SetTextColor( Color( 255, 255, 255, 255 ) ) title.Paint = function( self ) theme.pagetext( self ) @@ -184,7 +193,7 @@ function menu.open( dt ) ---- recipe list ---- local list = vgui.Create( "DPanel", f ) - list:SetSize( 400 * resScale, f.h - bar.h ) + list:SetSize( f.w/4.2, f.h - bar.h ) list.w, list.h = list:GetSize() list:SetPos( 0, bar.h ) list.Paint = function( self ) @@ -193,6 +202,7 @@ function menu.open( dt ) local scroll = vgui.Create( "DScrollPanel", list ) scroll:SetSize( list.w, list.h ) + scroll.w, scroll.h = scroll:GetSize() local vbar = scroll:GetVBar() function vbar:Paint() theme.borderpanel( vbar, Color( 200, 200, 200, 200 ) ) end @@ -217,17 +227,50 @@ function menu.open( dt ) theme.blurpanel( self, Color( 255, 255, 255, 1 ) ) end - local items = { - "test", - "test2", - "potatoe", - "bomb" - } - for i=1, 10 do ---- ADD CRAFT SELECT PANELS HERE - local p = createItemPanel( 200, 200*(i-1), 1.25, scroll, f ) - p.SetItem( table.Random( items ) ) - end + local resBars = {} + local selectedBar + for i, resID in pairs( recipes ) do + resBars[resID] = vgui.Create( "DPanel", scroll ) + resBars[resID].resTbl = Quantum.Recipe.Get( resID ) + resBars[resID].resItemTbl = Quantum.Item.Get( resID ) + + resBars[resID]:SetSize( scroll.w, 30 * resScale ) + resBars[resID].w, resBars[resID].h = resBars[resID]:GetSize() + + resBars[resID]:SetPos( 0, resBars[resID].h * (i-1) + padding*i ) + resBars[resID].x, resBars[resID].y = resBars[resID]:GetPos() + + resBars[resID].Paint = function( self, w, h ) + surface.SetDrawColor( 255, 255, 255, 1 ) + surface.DrawRect( 0, 0, w, h ) + end + resBars[resID].txt_panel = vgui.Create( "DLabel", resBars[resID] ) + resBars[resID].txt_panel:SetText( resBars[resID].resTbl.name ) + resBars[resID].txt_panel:SetFont( "q_text" ) + resBars[resID].txt_panel:SetTextColor( theme.color.setalpha(resBars[resID].resItemTbl.rarity.color, 200) ) + + resBars[resID].txt_panel:SizeToContents() + resBars[resID].txt_panel.w, resBars[resID].txt_panel.h = resBars[resID].txt_panel:GetSize() + + resBars[resID].txt_panel:SetPos( padding, resBars[resID].h/2 - resBars[resID].txt_panel.h/2 ) + + local overlay = vgui.Create( "DButton", resBars[resID] ) + overlay:SetText("") + overlay:SetSize( resBars[resID].w, resBars[resID].h ) + overlay:SetPos( 0, 0 ) + overlay.Paint = function( self, w, h ) + theme.sharpbutton( self, Color( 0, 0, 0, 0 ), 10, 80 ) + end + + overlay.DoClick = function( self ) + selectedBar = resBars[resID] + end + overlay.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end + end + if( #resBars > 0 ) then + selectedBar = resBars[1] + end end end diff --git a/gamemode/engine/derma/menus/menu_main.lua b/gamemode/engine/derma/menus/menu_main.lua index 0689ffb..25ee08d 100644 --- a/gamemode/engine/derma/menus/menu_main.lua +++ b/gamemode/engine/derma/menus/menu_main.lua @@ -80,7 +80,7 @@ function main.open(dt) local padding_s = 4 * resScale local buttonWidth = 255 * resScale - local buttonColor = Color( 20, 20, 20, 100 ) + local buttonColor = Color( 20, 20, 20, 180 ) local buttonTextColor = Color( 255, 255, 255, 255 ) local buttonFont = "q_button2" diff --git a/gamemode/engine/lib/sh_items.lua b/gamemode/engine/lib/sh_items.lua index 7f10d30..d77f4f4 100644 --- a/gamemode/engine/lib/sh_items.lua +++ b/gamemode/engine/lib/sh_items.lua @@ -59,6 +59,6 @@ if SERVER then end function Quantum.Server.Item.SpawnItemAtPlayer( pl, itemid, amount ) -- Quantum.Server.Item.SpawnItemAtPlayer( Entity(1), "potatoe", 1 ) - Quantum.Server.Item.SpawnItem( pl:GetPos() + ( pl:GetForward() * 40 ) + Vector( 0, 0, 40 ), itemid, amount ) + Quantum.Server.Item.SpawnItem( pl:GetPos() + ( pl:GetForward() * 40 ) + Vector( 0, 0, 40 ), itemid, amount ) -- Quantum.Server.Item.SpawnItemAtPlayer( Entity(1), "jetpack", 1 ) end end \ No newline at end of file diff --git a/gamemode/engine/lib/sh_recipe.lua b/gamemode/engine/lib/sh_recipe.lua index 3a22542..cb5c53b 100644 --- a/gamemode/engine/lib/sh_recipe.lua +++ b/gamemode/engine/lib/sh_recipe.lua @@ -25,8 +25,15 @@ function Quantum.Recipe.Add( itemid, station, tbl ) Quantum.Recipes[ itemid ].delay = math.Clamp( Quantum.Recipes[ itemid ].delay, Quantum.MinCraftDelay, Quantum.MaxCraftDelay ) -- add the recipe to the stations recipe list -- - if( returnTbl.station != nil ) then + if( station != nil ) then + if( Quantum.Stations[ returnTbl.station ].recipes == nil ) then + Quantum.Stations[ returnTbl.station ].recipes = {} + end table.insert( Quantum.Stations[ returnTbl.station ].recipes, itemid ) + else + if SERVER then + Quantum.Error( "Recipe '" .. itemid .. "' does not have a station! You will not be able to craft this item!" ) + end end return returnTbl diff --git a/gamemode/engine/lib/sh_station.lua b/gamemode/engine/lib/sh_station.lua index 5235a2c..169485c 100644 --- a/gamemode/engine/lib/sh_station.lua +++ b/gamemode/engine/lib/sh_station.lua @@ -15,7 +15,7 @@ function Quantum.Station.Add( id, tbl ) stationid = id, name = tbl.name || "Crafting Station", -- name of the station model = tbl.model || "models/props_phx/facepunch_barrel.mdl", - recipes = tbl.recipes || {} + recipes = tbl.recipes } Quantum.Stations[ id ] = returnTbl diff --git a/gamemode/init.lua b/gamemode/init.lua index ba39ee5..84a6d14 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -21,7 +21,8 @@ if SERVER then AddCSLuaFile( "shared.lua" ) -- Content -- - local path = "gamemodes/" .. GM.FolderName .. "/gamemode/content/materials/quantum/server_banner.png" + local folname = GM.FolderName + local path = "gamemodes/" .. folname .. "/gamemode/content/materials/quantum/server_banner.png" resource.AddSingleFile( path ) resource.AddSingleFile( "materials/quantum/mic_icon48.png" ) -- add the mic icon @@ -120,17 +121,7 @@ if SERVER then include( "settings/sh_recipes.lua" ) end - local function loadStations() - include( "settings/sv_crafting_stations_locations.lua" ) - end - hook.Add( "PostGamemodeLoaded", "Quantum_Init_Stations_Load", function() - Quantum.Debug( "Spawning crafting stations..." ) - loadStations() - end) - local function loadPlugins() - - local fol = GM.FolderName .. "/plugins/" local pluginFiles = file.Find( fol .. "plugin_*.lua", "LUA" ) @@ -148,6 +139,7 @@ if SERVER then end end + function Quantum.Server.Load() -- Add all of the base files loadCoreFiles() @@ -159,9 +151,34 @@ if SERVER then -- Plugins loadPlugins() + + Quantum.Server.Loaded = true + end + + local function loadStations( luaRefresh ) + print( luaRefresh, Quantum.Server.Loaded, Quantum.Server.LoadedStations ) + local basepath = "gamemodes/" .. folname .. "/gamemode/settings/" + print( basepath ) + + if( !luaRefresh ) then + include( basepath .. "sv_crafting_stations_locations.lua" ) + elseif( luaRefresh && Quantum.Server.Loaded && Quantum.Server.LoadedStations ) then + include( basepath .. "sv_crafting_stations_locations.lua" ) + end + end + + hook.Add( "PlayerInitialSpawn", "Quantum_Init_Stations_Load", function() + Quantum.Debug( "Spawning crafting stations..." ) + + if( #player.GetAll() == 1 ) then -- spawn the stations when the first player joins + loadStations() + Quantum.Server.LoadedStations = true + end + end) Quantum.Server.Load() - loadStations() + loadStations( true ) + MsgC( "\n" ) end diff --git a/gamemode/settings/sh_items.lua b/gamemode/settings/sh_items.lua index b4315e1..b95882d 100644 --- a/gamemode/settings/sh_items.lua +++ b/gamemode/settings/sh_items.lua @@ -43,4 +43,17 @@ Quantum.Item.Create( "potatoe", { rarity = Quantum.Rarity.Legendary, equipslot = Quantum.EquipSlots.Head, consumeeffect = "eat_potatoe" +} ) + +-- weapon_gta_sa_jetpack.lua + +Quantum.Item.Create( "jetpack", { + name = "Jetpack", + desc = "A jet engine strapped onto your back? Sounds fun!", + model = "models/sa_jetpack.mdl", + stack = 1, + soulbound = false, + rarity = Quantum.Rarity.Legendary, + equipslot = Quantum.EquipSlots.Weapon, + equipgive = "weapon_gta_sa_jetpack" } ) \ No newline at end of file diff --git a/gamemode/settings/sh_recipes.lua b/gamemode/settings/sh_recipes.lua index e695d21..f352f50 100644 --- a/gamemode/settings/sh_recipes.lua +++ b/gamemode/settings/sh_recipes.lua @@ -6,7 +6,7 @@ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -Quantum.Recipe.Add( "potatoe", nil, { --Quantum.Server.Crafting.MakeItem( Entity(1), "potatoe" ) +Quantum.Recipe.Add( "potatoe", "barrel", { --Quantum.Server.Crafting.MakeItem( Entity(1), "potatoe" ) name = "Legendary Potatoe Recipe", amount = 1, delay = 5, @@ -15,3 +15,12 @@ Quantum.Recipe.Add( "potatoe", nil, { --Quantum.Server.Crafting.MakeItem( Entity { item = "test", amount = 2 } } }) + +Quantum.Recipe.Add( "test", "barrel", { + name = "Test Recipe", + amount = 2, + delay = 5, + recipe = { + { item = "potatoe", amount = 1 } + } +}) diff --git a/gamemode/settings/sv_crafting_stations_locations.lua b/gamemode/settings/sv_crafting_stations_locations.lua index 4a54839..5560d48 100644 --- a/gamemode/settings/sv_crafting_stations_locations.lua +++ b/gamemode/settings/sv_crafting_stations_locations.lua @@ -6,11 +6,6 @@ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ Quantum.Server.Station.Create( "barrel", { - pos = Vector( 10, 0, 0 ), - ang = Angle( 0, 0, 0 ) -}) - -Quantum.Server.Station.Create( "barrel", { - pos = Vector( 11972.8359375, 8478.060546875, 8.03125 ), - ang = Angle( 0, -166.42593383789, 0 ) + pos = Vector( 747.13494873047, 10483.685546875, 7168.0317382813 ), + ang = Angle( 0, -118.23150634766, 0 ) }) \ No newline at end of file