mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
65 lines
1.2 KiB
Lua
65 lines
1.2 KiB
Lua
--[[
|
|
| This file was obtained through the combined efforts
|
|
| of Madbluntz & Plymouth Antiquarian Society.
|
|
|
|
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
|
| Maloy, DrPepper10 @ RIP, Atle!
|
|
|
|
|
| Visit for more: https://plymouth.thetwilightzone.ru/
|
|
--]]
|
|
|
|
|
|
--
|
|
-- This works - but I'm not certain that it's the way to go about it.
|
|
-- better instead to use the right click properties?
|
|
--
|
|
|
|
TOOL.AddToMenu = false
|
|
|
|
TOOL.Category = "Construction"
|
|
TOOL.Name = "#tool.editentity.name"
|
|
|
|
function TOOL:LeftClick( trace )
|
|
|
|
if ( !trace.Hit ) then return false end
|
|
|
|
self:GetWeapon():SetTargetEntity1( trace.Entity )
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
function TOOL:RightClick( trace )
|
|
|
|
return self:LeftClick( trace )
|
|
|
|
end
|
|
|
|
function TOOL:Think()
|
|
|
|
local CurrentEditing = self:GetWeapon():GetTargetEntity1()
|
|
|
|
if ( CLIENT && self.LastEditing != CurrentEditing ) then
|
|
|
|
self.LastEditing = CurrentEditing
|
|
|
|
local CPanel = controlpanel.Get( "editentity" )
|
|
if ( !CPanel ) then return end
|
|
|
|
CPanel:ClearControls()
|
|
self.BuildCPanel( CPanel, CurrentEditing )
|
|
|
|
end
|
|
|
|
end
|
|
|
|
function TOOL.BuildCPanel( CPanel, ent )
|
|
|
|
local control = vgui.Create( "DEntityProperties" )
|
|
control:SetEntity( ent )
|
|
control:SetSize( 10, 500 )
|
|
|
|
CPanel:AddPanel( control )
|
|
|
|
end
|