-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
65 lines (53 loc) · 1.72 KB
/
init.lua
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
AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside
AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent.
include('shared.lua')
local interval = 5
function ENT:Initialize()
self:SetModel( "models/props_c17/consolebox01a.mdl" )
self:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics,
self:SetMoveType( MOVETYPE_VPHYSICS ) -- after all, gmod is a physics
self:SetSolid( SOLID_VPHYSICS ) -- Toolbox
self:SetUseType(SIMPLE_USE)
self.timer = CurTime()
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
end
function ENT:Think()
if CurTime() > self.timer + interval then
self.timer = CurTime()
self:SetPrintAmount(self:GetPrintAmount() + math.random(1,3))
self:SetTemperature(self:GetTemperature() + math.random(-2,4))
end
local temperature = self:GetTemperature()
self:SetColor(255,(255-temperature*2.5),(255-temperature*2.5))
if temperature > 80 then
local vPoint = self:GetPos()
local effectdata = EffectData()
effectdata:SetStart(vPoint)
effectdata:SetOrigin(vPoint)
effectdata:SetScale(1)
util.Effect("Sparks", effectdata)
end
if self:GetTemperature() > 100 then
local vPoint = self:GetPos()
local effectdata = EffectData()
effectdata:SetStart(vPoint)
effectdata:SetOrigin(vPoint)
effectdata:SetScale(1)
util.Effect("Explosion", effectdata)
self:Remove()
end
end
--function ENT:OnTakeDamage(dmg)
-- self:TakePhysicsDamage(dmg)
-- self:SetTemperature(self:GetTemperature() + dmg)
--end
function ENT:Use(act, call)
local moneyAmount = self:GetPrintAmount()
self:SetPrintAmount(0)
call:AddMoney(moneyAmount)
call:SaveMoney()
call:PrintMessage(HUD_PRINTCENTER, "Got $"..moneyAmount)
end