-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_tests.lua
More file actions
47 lines (33 loc) · 1.16 KB
/
example_tests.lua
File metadata and controls
47 lines (33 loc) · 1.16 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
local function testSpawnRegion()
if IsValid(sregion) then sregion:Remove() end
if IsValid(sponent) then sponent:Remove() end
local pos = player.GetAll()[1]:GetEyeTrace().HitPos
sregion = ents.Create("fite_spawnregion")
sregion:SetPos(pos)
sregion:Spawn()
sponent = ents.Create("prop_physics")
sponent:SetPos(pos + Vector(0,0,16))
sponent:SetModel("models/weapons/w_rif_galil.mdl")
sponent:Spawn()
sponent.IsAvailableTo = function(ent, ply) return true end
sregion:BindToSpawn(sponent)
sregion:SetSpawnVolume(FITENITE.SpawnVolume.FloorCylinder())
end
local function testFlag()
if IsValid(sregion) then sregion:Remove() end
if IsValid(fiteflag) then fiteflag:Remove() end
local trace = player.GetAll()[1]:GetEyeTrace()
local pos = trace.HitPos
//local norm = trace.HitNormal
sregion = ents.Create("fite_spawnregion")
sregion:SetPos(pos)
sregion:Spawn()
fiteflag = ents.Create("fite_flag")
fiteflag:SetPos(pos)
fiteflag:SetAngles(Angle(0,0,0))
fiteflag:Spawn()
fiteflag.IsAvailableTo = function(ent, ply) return ply:Team() == ent.Team end
sregion:BindToSpawn(fiteflag)
sregion:SetSpawnVolume(FITENITE.SpawnVolume.FloorCylinder())
end
testFlag()