-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDakimakura.txt
54 lines (46 loc) · 1.58 KB
/
Dakimakura.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--@name Dakimakura
--@author thegrb93 aka Sparky
--@client
local ent
local pillows = {
{
"https://dl.dropboxusercontent.com/s/nkzh5kbjwvq3hwg/salazle1.png",
"https://dl.dropboxusercontent.com/s/ygb1j67a2zxa8oo/salazle2.png",
Color(231,231,231),
},
}
local pillow = 1
local tex1 = render.createMaterial(pillows[pillow][1])
local tex2 = render.createMaterial(pillows[pillow][2])
local col = pillows[pillow][3]
render.createRenderTarget("rt")
local m = material.create("VertexLitGeneric")
m:setTextureRenderTarget("$basetexture", "rt")
local function doRender()
if not ent then
local mindist = math.huge
find.all(function(e)
if e:isValid() and e:getOwner()==owner() and e:getModel()=="models/props_c17/furnituremattress001a.mdl" then
local d = e:getPos():getDistanceSqr(chip():getPos())
if d < mindist then
ent = e
mindist = d
end
end
end)
if not ent then return end
end
render.selectRenderTarget("rt")
local pos, ang = ent:getBonePosition(0)
local tex = (ang:getRight():dot(player():getAimVector())<0) and tex1 or tex2
render.setColor(col)
render.drawRect(0,0,1024,1024)
render.setMaterial(tex)
local rot = Matrix() rot:setAngles(Angle(0,90,0))
render.pushMatrix(rot)
render.drawTexturedRectUV(0, -720, 1024, 720, 0.1369140625, 0, 0.8630859375, 1)
render.popMatrix()
render.selectRenderTarget()
ent:setMaterial("!"..m:getName())
end
hook.add("renderoffscreen","",doRender)