This commit is contained in:
lifestorm
2024-08-04 23:54:45 +03:00
parent 8064ba84d8
commit 6a58f406b1
7522 changed files with 4011896 additions and 15 deletions

View File

@@ -0,0 +1,66 @@
--[[
| 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/
--]]
--
--
-- worldpicker is for picking an entity from the game while you have the GUI open.
-- Calling util.worldpicker.Start( func ) will hide all GUI and let you pick an entity from
-- the game world. Once selected it will call your passed function with the trace.
--
-- It's used in the icon editor
--
--
local bDoing = false
local fnAction = nil
util.worldpicker = {
--
-- Start world picking
--
Start = function( func )
bDoing = true
fnAction = func
gui.EnableScreenClicker( true )
end,
--
-- Finish world picking - you shouldn't have to call this (called from hook below)
--
Finish = function( tr )
bDoing = false
fnAction( tr )
gui.EnableScreenClicker( false )
end,
Active = function() return bDoing end
}
hook.Add( "VGUIMousePressAllowed", "WorldPickerMouseDisable", function( code )
if ( !bDoing ) then return false end
local dir = gui.ScreenToVector( input.GetCursorPos() )
local tr = util.TraceLine( {
start = LocalPlayer():GetShootPos(),
endpos = LocalPlayer():GetShootPos() + dir * 32768,
filter = LocalPlayer()
} )
util.worldpicker.Finish( tr )
-- Don't register this click
return true
end )