1
1
function Create (self )
2
2
3
- if g_nucleocommunicationtable == nil then
4
- g_nucleocommunicationtable = {};
3
+ if NucleoCommunicationTable == nil then
4
+ NucleoCommunicationTable = {};
5
5
end
6
-
7
- if g_nucleocommunicationtable [self .Sharpness ] == nil then
8
- g_nucleocommunicationtable [self .Sharpness ] = {};
6
+ if NucleoCommunicationTable [self .Sharpness ] == nil then
7
+ NucleoCommunicationTable [self .Sharpness ] = {};
9
8
end
9
+ NucleoCommunicationTable [self .Sharpness ][# NucleoCommunicationTable [self .Sharpness ] + 1 ] = {self .UniqueID , self };
10
10
11
- g_nucleocommunicationtable [ self .Sharpness ][ # g_nucleocommunicationtable [self .Sharpness ] + 1 ] = { self . UniqueID , self } ;
11
+ self .Vel = Vector ( self . Vel . X , self . Vel . Y ): DegRotate ( # NucleoCommunicationTable [self .Sharpness ] * RangeRand ( - 1 , 1 )) ;
12
12
13
13
self .detTimer = Timer ();
14
14
self .boom = false ;
15
15
16
- self .detDelay = 4000 / math.sqrt (# g_nucleocommunicationtable [self .Sharpness ]);
16
+ self .detDelay = 4000 / math.sqrt (# NucleoCommunicationTable [self .Sharpness ]);
17
17
self .speed = 15 ;
18
18
self .acceleration = 0.1 ;
19
19
self .disintegrationStrength = 75 ;
@@ -44,25 +44,25 @@ function Update(self)
44
44
45
45
PrimitiveMan :DrawCirclePrimitive (self .Pos , self .Radius , self .colors [math.random (# self .colors )]);
46
46
47
- if g_nucleocommunicationtable [self .Sharpness ] ~= nil then
48
- for i = 1 , # g_nucleocommunicationtable [self .Sharpness ] do
49
- if g_nucleocommunicationtable [self .Sharpness ][i ][1 ] == self .UniqueID then
50
- if g_nucleocommunicationtable [self .Sharpness ][i ][2 ].UniqueID ~= self .UniqueID then
51
- g_nucleocommunicationtable [self .Sharpness ][i ][2 ] = self ;
47
+ if NucleoCommunicationTable [self .Sharpness ] ~= nil then
48
+ for i = 1 , # NucleoCommunicationTable [self .Sharpness ] do
49
+ if NucleoCommunicationTable [self .Sharpness ][i ][1 ] == self .UniqueID then
50
+ if NucleoCommunicationTable [self .Sharpness ][i ][2 ].UniqueID ~= self .UniqueID then
51
+ NucleoCommunicationTable [self .Sharpness ][i ][2 ] = self ;
52
52
end
53
53
else
54
- local raydirection = SceneMan :ShortestDistance (self .Pos ,g_nucleocommunicationtable [self .Sharpness ][i ][2 ].Pos ,SceneMan .SceneWrapsX )
55
- if MovableMan :IsParticle (g_nucleocommunicationtable [self .Sharpness ][i ][2 ]) and raydirection .Magnitude < self .linkRange then
54
+ local rayDirection = SceneMan :ShortestDistance (self .Pos ,NucleoCommunicationTable [self .Sharpness ][i ][2 ].Pos ,SceneMan .SceneWrapsX )
55
+ if MovableMan :IsParticle (NucleoCommunicationTable [self .Sharpness ][i ][2 ]) and rayDirection .Magnitude < self .linkRange then
56
56
57
- local dist = SceneMan :ShortestDistance (self .Pos , g_nucleocommunicationtable [self .Sharpness ][i ][2 ].Pos , SceneMan .SceneWrapsX );
57
+ local dist = SceneMan :ShortestDistance (self .Pos , NucleoCommunicationTable [self .Sharpness ][i ][2 ].Pos , SceneMan .SceneWrapsX );
58
58
PrimitiveMan :DrawLinePrimitive (self .Pos + Vector (math.random (- 1 , 1 ), math.random (- 1 , 1 )), self .Pos + dist + Vector (math.random (- 1 , 1 ), math.random (- 1 , 1 )), self .colors [math.random (# self .colors )]);
59
59
-- The projectiles are drawn towards each other
60
- self .Vel = self .Vel + dist * rte .PxTravelledPerFrame * self .linkPullRatio ;
60
+ self .Vel = self .Vel + dist : RadRotate ( RangeRand ( - 0.1 , 0.1 )) * rte .PxTravelledPerFrame * self .linkPullRatio ;
61
61
62
- local moid = SceneMan :CastMORay (self .Pos , raydirection , rte .NoMOID , self .Team , rte .airID , true , 1 );
62
+ local moid = SceneMan :CastMORay (self .Pos , rayDirection , rte .NoMOID , self .Team , rte .airID , true , 1 );
63
63
if moid ~= rte .NoMOID then
64
64
local hitPos = Vector ();
65
- SceneMan :CastFindMORay (self .Pos , raydirection , moid , hitPos , rte .airID , true , 1 );
65
+ SceneMan :CastFindMORay (self .Pos , rayDirection , moid , hitPos , rte .airID , true , 1 );
66
66
self .Pos = hitPos ;
67
67
self .boom = true ;
68
68
self .hitTarget = true ;
@@ -72,18 +72,18 @@ function Update(self)
72
72
end
73
73
end
74
74
else
75
- g_nucleocommunicationtable [self .Sharpness ] = {};
76
- g_nucleocommunicationtable [self .Sharpness ][# g_nucleocommunicationtable [self .Sharpness ] + 1 ] = {self .UniqueID ,self };
75
+ NucleoCommunicationTable [self .Sharpness ] = {};
76
+ NucleoCommunicationTable [self .Sharpness ][# NucleoCommunicationTable [self .Sharpness ] + 1 ] = {self .UniqueID ,self };
77
77
end
78
78
self .Vel = Vector (self .Vel .X , self .Vel .Y ):SetMagnitude (math.min (self .Vel .Magnitude + self .acceleration , self .speed ));
79
79
self .AngularVel = self .AngularVel * 0.9 ;
80
80
self .RotAngle = 0 ;
81
81
82
82
if self .hitTarget then
83
- for i = 1 , # g_nucleocommunicationtable [self .Sharpness ] do
84
- if g_nucleocommunicationtable [self .Sharpness ][i ][1 ] ~= self .UniqueID and MovableMan :IsParticle (g_nucleocommunicationtable [self .Sharpness ][i ][2 ]) then
85
- g_nucleocommunicationtable [self .Sharpness ][i ][2 ].Pos = self .Pos + Vector (math.random () * 5 , 0 ):RadRotate (math.random () * math.pi * 2 );
86
- g_nucleocommunicationtable [self .Sharpness ][i ][2 ]:SetNumberValue (" GOBOOM" , 1 );
83
+ for i = 1 , # NucleoCommunicationTable [self .Sharpness ] do
84
+ if NucleoCommunicationTable [self .Sharpness ][i ][1 ] ~= self .UniqueID and MovableMan :IsParticle (NucleoCommunicationTable [self .Sharpness ][i ][2 ]) then
85
+ NucleoCommunicationTable [self .Sharpness ][i ][2 ].Pos = self .Pos + Vector (math.random () * 5 , 0 ):RadRotate (math.random () * math.pi * 2 );
86
+ NucleoCommunicationTable [self .Sharpness ][i ][2 ]:SetNumberValue (" GOBOOM" , 1 );
87
87
end
88
88
end
89
89
end
@@ -108,7 +108,7 @@ function Update(self)
108
108
melt .Pos = self .Pos ;
109
109
melt .Team = self .Team ;
110
110
melt .Sharpness = ToActor (parent ).ID ;
111
- melt .PinStrength = self .disintegrationStrength * math.sqrt (# g_nucleocommunicationtable [self .Sharpness ]);
111
+ melt .PinStrength = self .disintegrationStrength * math.sqrt (# NucleoCommunicationTable [self .Sharpness ]);
112
112
MovableMan :AddMO (melt );
113
113
end
114
114
end
@@ -123,23 +123,23 @@ function Update(self)
123
123
end
124
124
125
125
function Destroy (self )
126
- if g_nucleocommunicationtable and self .Sharpness and g_nucleocommunicationtable [self .Sharpness ] then
127
- for i = 1 , # g_nucleocommunicationtable [self .Sharpness ] do
128
- if g_nucleocommunicationtable [self .Sharpness ][i ][1 ] == self .UniqueID then
129
- g_nucleocommunicationtable [self .Sharpness ][i ] = nil ;
126
+ if NucleoCommunicationTable and self .Sharpness and NucleoCommunicationTable [self .Sharpness ] then
127
+ for i = 1 , # NucleoCommunicationTable [self .Sharpness ] do
128
+ if NucleoCommunicationTable [self .Sharpness ][i ][1 ] == self .UniqueID then
129
+ NucleoCommunicationTable [self .Sharpness ][i ] = nil ;
130
130
end
131
131
end
132
132
133
133
local temptable = {};
134
- for i = 1 , # g_nucleocommunicationtable [self .Sharpness ] do
135
- if g_nucleocommunicationtable [self .Sharpness ][i ] ~= nil then
136
- temptable [# temptable + 1 ] = g_nucleocommunicationtable [self .Sharpness ][i ];
134
+ for i = 1 , # NucleoCommunicationTable [self .Sharpness ] do
135
+ if NucleoCommunicationTable [self .Sharpness ][i ] ~= nil then
136
+ temptable [# temptable + 1 ] = NucleoCommunicationTable [self .Sharpness ][i ];
137
137
end
138
138
end
139
- g_nucleocommunicationtable [self .Sharpness ] = temptable ;
139
+ NucleoCommunicationTable [self .Sharpness ] = temptable ;
140
140
141
- if # g_nucleocommunicationtable [self .Sharpness ] == 0 then
142
- g_nucleocommunicationtable [self .Sharpness ] = nil ;
141
+ if # NucleoCommunicationTable [self .Sharpness ] == 0 then
142
+ NucleoCommunicationTable [self .Sharpness ] = nil ;
143
143
end
144
144
end
145
145
end
0 commit comments