@@ -99,27 +99,26 @@ function Update(self)
99
99
self .delayTimer :Reset ();
100
100
101
101
local rayHitPos = Vector ();
102
- local startPos = self .Pos + Vector (self .Radius , 0 ):RadRotate (detectionAngle );
103
- local terrainRaycast = SceneMan :CastStrengthRay (startPos , Vector (self .laserLength , 0 ):RadRotate (detectionAngle ), 10 , rayHitPos , 1 , rte .airID , SceneMan .SceneWrapsX );
104
-
105
- if terrainRaycast == true then
106
- self .tempLaserLength = SceneMan :ShortestDistance (startPos , rayHitPos , SceneMan .SceneWrapsX ).Magnitude ;
107
- else
108
- self .tempLaserLength = self .laserLength ;
109
- end
110
- local raycast = SceneMan :CastMORay (startPos , Vector (self .tempLaserLength , 0 ):RadRotate (detectionAngle ), self .ID , self .alliedTeam , rte .airID , true , 4 );
111
- if raycast ~= rte .NoMOID then
112
- local target = ToMOSRotating (MovableMan :GetMOFromID (raycast )):GetRootParent ();
113
- if not (target .Team == self .alliedTeam and IsActor (target )) and (target .Vel .Magnitude * (1 + math.abs (target .AngularVel ) + math.sqrt (target .Radius ))) > self .detonateThreshold then
114
- self .actionPhase = 2 ;
115
- self .blink = false ;
116
- self .faceDirection = detectionAngle ;
102
+ local startPos = self .Pos + Vector (1 , 0 ):RadRotate (detectionAngle );
103
+ local hitTerrain = SceneMan :CastStrengthRay (startPos , Vector (self .laserLength , 0 ):RadRotate (detectionAngle ), 10 , rayHitPos , 1 , rte .airID , SceneMan .SceneWrapsX );
104
+
105
+ self .tempLaserLength = hitTerrain and SceneMan :ShortestDistance (startPos , rayHitPos , SceneMan .SceneWrapsX ).Magnitude or self .laserLength ;
106
+
107
+ if self .tempLaserLength > 3 then
108
+ local raycast = SceneMan :CastMORay (startPos , Vector (self .tempLaserLength , 0 ):RadRotate (detectionAngle ), self .ID , self .alliedTeam , rte .airID , true , 4 );
109
+ if raycast ~= rte .NoMOID then
110
+ local target = ToMOSRotating (MovableMan :GetMOFromID (raycast )):GetRootParent ();
111
+ if not (target .Team == self .alliedTeam and IsActor (target )) and (target .Vel .Magnitude * (1 + math.abs (target .AngularVel ) + math.sqrt (target .Radius ))) > self .detonateThreshold then
112
+ self .actionPhase = 2 ;
113
+ self .blink = false ;
114
+ self .faceDirection = detectionAngle ;
115
+ end
117
116
end
117
+ local effectpar = CreateMOPixel (" Mine Laser Beam " .. math.random (3 ), " Base.rte" );
118
+ effectpar .Pos = startPos + Vector (math.random () * self .tempLaserLength , 0 ):RadRotate (detectionAngle );
119
+ effectpar .EffectRotAngle = detectionAngle ;
120
+ MovableMan :AddParticle (effectpar );
118
121
end
119
- local effectpar = CreateMOPixel (" Mine Laser Beam " .. math.random (3 ), " Base.rte" );
120
- effectpar .Pos = startPos + Vector (math.random () * self .tempLaserLength , 0 ):RadRotate (detectionAngle );
121
- effectpar .EffectRotAngle = detectionAngle ;
122
- MovableMan :AddParticle (effectpar );
123
122
end
124
123
125
124
elseif self .actionPhase == 2 then
0 commit comments