diff --git a/entities/entities/q_crafting_station/init.lua b/entities/entities/q_crafting_station/init.lua index b30f4de..6387de5 100644 --- a/entities/entities/q_crafting_station/init.lua +++ b/entities/entities/q_crafting_station/init.lua @@ -25,9 +25,11 @@ function ENT:Initialize() end function ENT:Use( activator, caller ) - if( activator:IsPlayer() ) then - - end + -- if( activator:IsPlayer() ) then + -- if( activator.isloaded ) then + -- Quantum.Net.OpenMenu( activator, "crafting" ) + -- end + -- end end function ENT:InitializeStation( stationid, pos, ang ) diff --git a/entities/weapons/quantum_hands/shared.lua b/entities/weapons/quantum_hands/shared.lua index e14f494..033eca5 100644 --- a/entities/weapons/quantum_hands/shared.lua +++ b/entities/weapons/quantum_hands/shared.lua @@ -14,7 +14,7 @@ if CLIENT then SWEP.DrawCrosshair = false function SWEP:DrawHUD() - if( self:GetOwner():IsSuperAdmin() ) then + if( self:GetOwner():IsSuperAdmin() && !Quantum.Client.IsInMenu ) then surface.SetTextPos( 10, 10 ) surface.SetTextColor( Color( 200, 200, 200, 200 ) ) surface.SetFont( "Default" ) @@ -31,13 +31,13 @@ if CLIENT then local cubeMat = Material( "vgui/white" ) hook.Add( "PostDrawOpaqueRenderables", "Quantum_Client_DeveloperHands_HitPos", function() - if( LocalPlayer():IsSuperAdmin() ) then + if( LocalPlayer():IsSuperAdmin() && !Quantum.Client.IsInMenu ) then if( LocalPlayer():GetActiveWeapon():GetClass() == "quantum_hands" ) then local trace = LocalPlayer():GetEyeTrace() local angle = trace.HitNormal:Angle() render.SetMaterial( cubeMat ) - render.DrawBox( trace.HitPos, Angle( 0, 0, 0), Vector( 0, 0, 0 ), Vector( 2, 2, 2 ), Color( 255, 255, 255 ) ) + render.DrawBox( trace.HitPos, Angle( 0, 0, 0), Vector( 0, 0, 0 ), Vector( 2, 2, 2 ), Color( 255, 25, 25, 100 ) ) render.DrawLine( trace.HitPos, trace.HitPos + 12 * angle:Forward(), Color( 255, 0, 0 ), true ) render.DrawLine( trace.HitPos, trace.HitPos + 12 * -angle:Right(), Color( 0, 255, 0 ), true ) diff --git a/gamemode/engine/derma/menus/menu_crafting.lua b/gamemode/engine/derma/menus/menu_crafting.lua index 0aea160..dce0496 100644 --- a/gamemode/engine/derma/menus/menu_crafting.lua +++ b/gamemode/engine/derma/menus/menu_crafting.lua @@ -21,8 +21,12 @@ local itemWidth, itemHeight = 65 * resScale, 65 * resScale function menu.open( dt ) local station + local stationEnt if( dt != nil ) then - station = dt.cont.station + if( dt.cont != nil ) then + station = dt.cont.station + stationEnt = dt.cont.stationEnt + end end local items = Quantum.Client.Inventory @@ -34,10 +38,11 @@ function menu.open( dt ) return end - if( !f ) then + if( !Quantum.Client.CurStationMenu ) then Quantum.Client.IsInMenu = true local f = vgui.Create( "DFrame" ) + Quantum.Client.CurStationMenu = f f:SetSize( sw, sh ) f.w, f.h = f:GetSize() f:SetTitle( "" ) @@ -51,6 +56,7 @@ function menu.open( dt ) end function f:OnClose() Quantum.Client.IsInMenu = false + Quantum.Client.CurStationMenu = nil Quantum.Client.Cam.Stop() end @@ -65,6 +71,14 @@ function menu.open( dt ) end end + function f:Think() + if( IsValid( stationEnt ) ) then + if( LocalPlayer():GetPos():Distance( stationEnt:GetPos() ) >= 100 ) then -- clientside security sucks but works in this case :P + self:Close() + end + end + end + Quantum.Client.CurMenu = f end diff --git a/gamemode/engine/lib/server/sv_networking.lua b/gamemode/engine/lib/server/sv_networking.lua index 7e3c2dc..26c283a 100644 --- a/gamemode/engine/lib/server/sv_networking.lua +++ b/gamemode/engine/lib/server/sv_networking.lua @@ -25,9 +25,13 @@ local function checkCacheTable( ply, cache_id, dt ) id = cache_id, cache = datatable } - if( ply.cache[cache_id] ~= nil && table.Count( ply.cache[cache_id] ) == 1 ) then + if( ply.cache[cache_id] ~= nil && table.Count( ply.cache[cache_id] ) >= 1 ) then Quantum.Debug( "Success! Created cache '" .. tostring(cache_id) .. "' for " .. tostring(ply) .. "." ) - if( ply.cache[id].count == nil ) then ply.cache[id].count = 1 else ply.cache[id].count = ply.cache[id].count + 1 end -- keep count + if( ply.cache[cache_id].count == nil ) then + ply.cache[cache_id].count = 1 + else + ply.cache[cache_id].count = ply.cache[cache_id].count + 1 -- keep count + end else Quantum.Error( "Failed. Creation of cache '" .. tostring(cache_id) .. "' for " .. tostring(ply) .. " failed to validate or did not get created." ) ply.cache[cache_id] = nil -- remove the cache since it is "broken" @@ -41,6 +45,7 @@ local function CacheDatatableMethod( id, datatable, ply ) ply.cache[id] = checkCacheTable( ply, id, datatable ) -- check caching tables etc Quantum.Debug( "(" .. tostring(ply) .. " | " .. tostring(id) .. ") Removing known data in cache from datatable..." ) if( ply.cache[id] ~= nil ) then + PrintTable(ply.cache[id]) if( ply.cache[id].count > 1 ) then -- dont want to filter out data if this is the first time. for k, v in pairs( datatable ) do -- loop through the datatable for k2, v2 in pairs( table.GetKeys( ply.cache[id].cache ) ) do -- check each key with each key from the record cache diff --git a/gamemode/engine/lib/sh_station.lua b/gamemode/engine/lib/sh_station.lua index 6a2c606..f3e9223 100644 --- a/gamemode/engine/lib/sh_station.lua +++ b/gamemode/engine/lib/sh_station.lua @@ -63,4 +63,16 @@ if SERVER then end Quantum.Server.Station.RemoveAll() -- remove all stations on lua refresh + + hook.Add( "KeyRelease", "Quantum_Station_KeyRelease", function( pl, key ) + if( pl.isloaded ) then + if( key == IN_USE ) then + local ent = pl:GetEyeTraceNoCursor().Entity + if( ent:GetClass() == "q_crafting_station" ) then + pl:SetLocalVelocity( Vector( 0, 0, 0 ) ) + Quantum.Net.OpenMenu( pl, "crafting", { stationEnt = ent, station = ent.stationid } ) + end + end + end + end) end \ No newline at end of file diff --git a/gamemode/settings/sv_crafting_stations_locations.lua b/gamemode/settings/sv_crafting_stations_locations.lua index 6a7f645..4a54839 100644 --- a/gamemode/settings/sv_crafting_stations_locations.lua +++ b/gamemode/settings/sv_crafting_stations_locations.lua @@ -8,4 +8,9 @@ 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 ) }) \ No newline at end of file