aboutsummaryrefslogtreecommitdiff
path: root/gamemode/server/test/testfile.lua
blob: 95e40fa03406a0f67d2efbf0e0488d3066517ae4 (plain)
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
--print("This is a test file to see if it gets included! Test!")
--Msg("Testing heatmap.lua\n")
local hm = heatmap.CreateHeatMap()
--PrintTable(hm)
--PrintTable(heatmap)
--local effect = heatmap.UniformInfiniteForever(5)
--hm:RegisterEffect(effect,Vector(0,0,0))
--PrintTable(hm)
--local neweffect = heatmap.LinearInfiniteForeverGrounded(2000,Vector(0,0,0))
--hm:RegisterEffect(neweffect,Vector(0,0,0))
--PrintTable(hm)
local decayeffect =
heatmap.LinearInfiniteLinearDecayGrounded(2000,5)
hm:RegisterEffect(decayeffect,Vector(4000,4000,0))
local bubbleeffect = heatmap.ParabolicInfiniteForeverGrounded(1000,2.5)
hm:RegisterEffect(bubbleeffect,Vector(0,0,0))

function sendHeatMap(ply)
    local points = {}
    net.Start("showheatmap")
    for i=0,10000,100 do
        points[i] = {}
        for j=0,10000,100 do
            local offset = --[[ply:GetPos() + ]]Vector(i,j,0) + Vector(-5000,-5000,0)
            points[i][j] = hm:CalculateFor(offset, 0)
            --net.WriteVector(offset)
            net.WriteFloat(points[i][j])
            --print("at ("..i..","..j..") is ")
            --print(points[i][j])
        end
    end
    net.Send(ply)
end

function callloop(ply)
    sendHeatMap(ply)
    hm.curtime = hm.curtime + 0.5
    timer.Simple(0.5,function() callloop(ply) end)
end

util.AddNetworkString("showheatmap")
concommand.Add("ShowHeatMap",function(ply,cmd,args)
    callloop(ply)
end)

concommand.Add("HeatMapAt",function(ply,cmd,args)
    print(hm:CalculateFor(ply:GetPos(),0))
end)