Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions lua/wire/tool_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,6 @@
surface.CreateFont("GmodToolScreen"..size, fonttab)
end

local iconparams = {
["$vertexcolor"] = 1,
["$vertexalpha"] = 1,
["$ignorez"] = 1 -- This is essential, since the base Gmod screen_bg has ignorez, otherwise it'll draw overtop of us
}
local txBackground = surface.GetTextureID("models/weapons/v_toolgun/wirescreen_bg")
function WireToolObj:DrawToolScreen(width, height)
surface.SetTexture(txBackground)
Expand All @@ -298,7 +293,7 @@
else
for size=60,20,-2 do
surface.SetFont("GmodToolScreen"..size)
local x,y = surface.GetTextSize(text)

Check warning on line 296 in lua/wire/tool_loader.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: y
if x <= (width - 16) then
self.ScreenFont = "GmodToolScreen"..size
break
Expand All @@ -318,10 +313,28 @@
surface.SetTextPos(x, y)
surface.DrawText(text)

iconparams[ "$basetexture" ] = "spawnicons/"..self:GetModel():sub(1,-5)
local mat = CreateMaterial(self:GetModel() .. "_DImage", "UnlitGeneric", iconparams )
surface.SetMaterial(mat)
surface.DrawTexturedRect( 128 - 32, 150, 64, 64)
local model = ClientsideModel(self:GetModel())
model:SetNoDraw(true)
model:SetIK(false)

local params = PositionSpawnIcon(model, vector_origin, true)

cam.Start3D(params.origin, params.angles, params.fov, 128 - 32, 150, 64, 64, params.znear, params.zfar)
render.SuppressEngineLighting(true)
render.SetLightingOrigin(vector_origin)
render.SetColorModulation(1, 1, 1)

render.ResetModelLighting(0.2, 0.2, 0.2)
render.SetModelLighting(BOX_TOP, 1, 1, 1)
render.SetModelLighting(BOX_FRONT, 1, 1, 1)

render.ClearDepth(true)
model:DrawModel()

render.SuppressEngineLighting(false)
cam.End3D()

model:Remove()

local on = self:GetOwner():GetInfo( "wire_tool_weldworld" )~="0" and not self:GetOwner():KeyDown(IN_WALK)
draw.DrawText("World Weld: "..(on and "On" or "Off"),
Expand Down
Loading