-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnoot_bomb.lua
More file actions
221 lines (191 loc) · 5.82 KB
/
Copy pathnoot_bomb.lua
File metadata and controls
221 lines (191 loc) · 5.82 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
easylua.StartEntity("noot_bomb")
DEFINE_BASECLASS( "base_anim" )
ENT.PrintName = "Timebomb Noot"
ENT.Author = "Flex"
ENT.Information = "NOOT NOOT"
ENT.Category = "Other"
ENT.Spawnable = true
ENT.AdminOnly = false
function ENT:SetupDataTables()
self:NetworkVar("Entity",0,"NootTarget")
end
function ENT:FindClosest(position)
local closest = nil
local dist = math.huge
local playerTable = player.GetAll()
local npcTable = ents.FindByClass("*npc_*")
local findme = table.Merge(playerTable, npcTable)
for _,ent in pairs(findme) do
if IsValid(ent) then
local curdist = self:GetPos():Distance(ent:GetPos())
if curdist < dist then
closest = ent
dist = curdist
end
end
end
return closest
end
if CLIENT then
local noot = 500
function ENT:Draw()
local target
if IsValid(self:GetNootTarget()) then
target = self:GetNootTarget()
else
target = self
end
local t_ang = (target:GetPos()-self:GetPos()):Angle()
local ent = ClientsideModel(self:GetModel())
ent:SetMaterial(self:GetMaterial())
ent:SetPos(self:GetPos())
ent:SetAngles(Angle((-10*(noot/100)),t_ang.y,0))
ent:DrawModel()
local outline = ClientsideModel(self:GetModel())
outline:SetMaterial(self:GetMaterial())
outline:SetPos(ent:GetPos())
outline:SetAngles(ent:GetAngles())
local mat = Matrix()
mat:Scale(Vector(-1.08,-1.08,-1.08))
outline:EnableMatrix("RenderMultiply",mat)
render.SetColorModulation(0,0,0)
outline:DrawModel()
outline:Remove()
local l_eye = ClientsideModel(self:GetModel())
l_eye:SetMaterial(self:GetMaterial())
local pos,ang = ent:GetPos(),ent:GetAngles()
pos:Add(ang:Forward()*6.5)
pos:Add(ang:Right()*-4)
pos:Add(ang:Up()*2)
l_eye:SetPos(pos)
local mat = Matrix()
mat:Scale(Vector(0.12,0.12,0.12))
l_eye:EnableMatrix("RenderMultiply",mat)
l_eye:DrawModel()
l_eye:Remove()
local r_eye = ClientsideModel(self:GetModel())
r_eye:SetMaterial(self:GetMaterial())
local pos,ang = ent:GetPos(),ent:GetAngles()
pos:Add(ang:Forward()*6.5)
pos:Add(ang:Right()*4)
pos:Add(ang:Up()*2)
r_eye:SetPos(pos)
local mat = Matrix()
mat:Scale(Vector(0.12,0.12,0.12))
r_eye:EnableMatrix("RenderMultiply",mat)
r_eye:DrawModel()
r_eye:Remove()
render.SetColorModulation(1,1,1)
local mouth = ClientsideModel("models/holograms/hq_tube.mdl")
mouth:SetMaterial(self:GetMaterial())
local pos,ang = ent:GetPos(),ent:GetAngles()
pos:Add(ang:Forward()*(5+(noot/100)))
pos:Add(ang:Right()*0)
pos:Add(ang:Up()*-3)
ang:RotateAroundAxis(ang:Right(),90)
mouth:SetPos(pos)
mouth:SetAngles(ang)
local mat = Matrix()
mat:Scale(Vector(0.65,0.65,0.65))
mouth:EnableMatrix("RenderMultiply",mat)
mouth:DrawModel()
mouth:Remove()
render.SetColorModulation(0,0,0)
local m_out = ClientsideModel("models/holograms/hq_tube.mdl")
m_out:SetMaterial(self:GetMaterial())
local pos,ang = ent:GetPos(),ent:GetAngles()
pos:Add(ang:Forward()*(5+(noot/100)))
pos:Add(ang:Right()*0)
pos:Add(ang:Up()*-3)
ang:RotateAroundAxis(ang:Right(),90)
m_out:SetPos(pos)
m_out:SetAngles(ang)
local mat = Matrix()
mat:Scale(Vector(-0.7,-0.7,-0.7))
m_out:EnableMatrix("RenderMultiply",mat)
m_out:DrawModel()
m_out:Remove()
local m_in = ClientsideModel("models/holograms/hq_cylinder.mdl")
m_in:SetMaterial(self:GetMaterial())
local pos,ang = ent:GetPos(),ent:GetAngles()
pos:Add(ang:Forward()*8)
pos:Add(ang:Right()*0)
pos:Add(ang:Up()*-3)
ang:RotateAroundAxis(ang:Right(),90)
m_in:SetPos(pos)
m_in:SetAngles(ang)
local mat = Matrix()
mat:Scale(Vector(0.6,0.6,0.1*0.6))
m_in:EnableMatrix("RenderMultiply",mat)
m_in:DrawModel()
m_in:Remove()
local hat = ClientsideModel("models/player/items/spy/hat_third_nr.mdl")
hat:SetMaterial(self:GetMaterial())
local pos,ang = ent:GetPos(),ent:GetAngles()
pos:Add(ang:Forward()*-4)
pos:Add(ang:Right()*0)
pos:Add(ang:Up()*-1)
hat:SetPos(pos)
hat:SetAngles(ang)
local mat = Matrix()
mat:Scale(Vector(1.7,1.7,1.7))
hat:EnableMatrix("RenderMultiply",mat)
hat:DrawModel()
hat:Remove()
ent:Remove()
render.SetColorModulation(1,1,1)
noot=noot/1.1
if math.Round(noot) == 1 then sound.Play("npc/crow/alert"..math.random(2,3)..".wav",self:GetPos()) noot = 500 end
end
end
--
function ENT:SpawnFunction( ply, tr, ClassName )
if ( !tr.Hit ) then return end
local ent = ents.Create( ClassName )
ent:SetPos( tr.HitPos + tr.HitNormal + Vector(0,0,10))
ent:Spawn()
ent:Activate()
return ent
end
function ENT:Initialize()
if SERVER then
self:SetModel("models/pac/default.mdl")
self:SetMaterial("models/debug/debugwhite")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_BSP)
self:SetUseType(SIMPLE_USE)
self:AddToMotionController(self:GetPhysicsObject())
self:StartMotionController()
self:GetPhysicsObject():Wake()
end
end
function ENT:Timebomb()
if self.Primed then return end
self.Primed = true
timer.Simple(5,function()
local e = ents.Create("env_explosion")
e:SetPos(self:GetPos())
e:SetOwner(self:GetOwner())
e:SetPhysicsAttacker(self:GetOwner())
e:Spawn()
e:SetKeyValue("iMagnitude",0)
e:Fire("Explode",0,0)
e:EmitSound("items/cart_explode.wav")
util.BlastDamage(self,self,self:GetPos(),150,200)
if IsValid(self) then
self:Remove()
end
end)
end
local noot = 400
function ENT:PhysicsSimulate(phys,delta)
self:SetNootTarget(self:FindClosest(self:GetPos()))
phys:ApplyForceCenter((self:GetNootTarget():GetPos()-self:GetPos())/5)
if self:GetPos():Distance(self:GetNootTarget():GetPos()) < 100 then
self:Timebomb()
end
noot=noot/1.1
if math.Round(noot) == 1 then phys:ApplyForceCenter(Vector(0,0,800)) noot = 400 end
end
easylua.EndEntity()