@@ -18,6 +18,7 @@ function Create(self)
18
18
coalitionC4TableA [self .tableNum ] = self ;
19
19
coalitionC4TableB [self .tableNum ] = self .alliedTeam ;
20
20
21
+ self .breachStrength = 100 ;
21
22
end
22
23
23
24
function Update (self )
@@ -27,23 +28,30 @@ function Update(self)
27
28
self .ToSettle = false ;
28
29
elseif self .Sharpness == 1 then
29
30
self .ToDelete = true ;
30
- elseif self .Sharpness == 2 then
31
+ elseif self .Sharpness == 2 then -- Explode
32
+ -- Gib the thing we're attached to if it's fragile enough
33
+ if self .target and IsMOSRotating (self .target ) then
34
+ local targetStrength = math.sqrt (1 + math.abs (self .target .GibWoundLimit - self .target .WoundCount )) * (self .target .Material .StructuralIntegrity * 0.1 + math.sqrt (self .target .Diameter + self .target .Mass ));
35
+ if targetStrength < self .breachStrength then
36
+ self .target :GibThis ();
37
+ end
38
+ end
31
39
self :GibThis ();
32
40
end
33
41
34
42
if self .actionPhase == 0 then
35
- local rayHitPos = Vector (0 , 0 );
43
+ local rayHitPos = Vector ();
36
44
local rayHit = false ;
37
- for i = 1 , 15 do
38
- local checkPos = self .Pos + Vector (self .Vel .X ,self .Vel .Y ):SetMagnitude (i );
39
- local checkPix = SceneMan :GetMOIDPixel (checkPos .X ,checkPos .Y );
45
+ local checkVec = Vector (self .Vel .X , self .Vel .Y ):SetMagnitude (self .Radius + self .Vel .Magnitude * 0.3 );
46
+ for i = 1 , 2 do
47
+ local checkPos = self .Pos + (checkVec / i );
48
+ local checkPix = SceneMan :GetMOIDPixel (checkPos .X , checkPos .Y );
40
49
if checkPix ~= rte .NoMOID then
41
- checkPos = checkPos + SceneMan :ShortestDistance (checkPos ,self .Pos ,SceneMan .SceneWrapsX ):SetMagnitude (3 );
42
- self .target = MovableMan :GetMOFromID (checkPix );
43
- self .stickpositionX = checkPos .X - self .target .Pos .X ;
44
- self .stickpositionY = checkPos .Y - self .target .Pos .Y ;
45
- self .stickrotation = self .target .RotAngle ;
46
- self .stickdirection = self .RotAngle ;
50
+ checkPos = checkPos + SceneMan :ShortestDistance (checkPos , self .Pos , SceneMan .SceneWrapsX ):SetMagnitude (3 );
51
+ self .target = ToMOSRotating (MovableMan :GetMOFromID (checkPix ));
52
+ self .stickPosition = SceneMan :ShortestDistance (self .target .Pos , checkPos , SceneMan .SceneWrapsX );
53
+ self .stickRotation = self .target .RotAngle ;
54
+ self .stickDirection = self .RotAngle ;
47
55
local soundfx = CreateAEmitter (" Remote Explosive Sound Activate" );
48
56
soundfx .Pos = self .Pos ;
49
57
MovableMan :AddParticle (soundfx );
@@ -52,50 +60,43 @@ function Update(self)
52
60
break ;
53
61
end
54
62
end
55
- if rayHit == true then
63
+ if rayHit then
56
64
self .actionPhase = 1 ;
57
- else
58
- if SceneMan :CastStrengthRay (self .Pos ,Vector (self .Vel .X ,self .Vel .Y ):SetMagnitude (15 ),0 ,rayHitPos ,0 ,0 ,SceneMan .SceneWrapsX ) == true then
59
- self .Pos = rayHitPos + SceneMan :ShortestDistance (rayHitPos ,self .Pos ,SceneMan .SceneWrapsX ):SetMagnitude (3 );
60
- self .PinStrength = 1000 ;
61
- self .AngularVel = 0 ;
62
- self .stuck = true ;
63
- self .actionPhase = 2 ;
64
- local soundfx = CreateAEmitter (" Remote Explosive Sound Activate" );
65
- soundfx .Pos = self .Pos ;
66
- MovableMan :AddParticle (soundfx );
67
- end
65
+ elseif SceneMan :CastStrengthRay (self .Pos , checkVec , 0 , rayHitPos , 1 , 0 , SceneMan .SceneWrapsX ) then
66
+ self .Pos = rayHitPos + SceneMan :ShortestDistance (rayHitPos , self .Pos , SceneMan .SceneWrapsX ):SetMagnitude (3 );
67
+ self .PinStrength = 1000 ;
68
+ self .AngularVel = 0 ;
69
+ self .stuck = true ;
70
+ self .actionPhase = 2 ;
71
+ local soundfx = CreateAEmitter (" Remote Explosive Sound Activate" );
72
+ soundfx .Pos = self .Pos ;
73
+ MovableMan :AddParticle (soundfx );
68
74
end
69
75
elseif self .actionPhase == 1 then
70
- if self .target ~= nil and self .target .ID ~= 255 then
71
- self .Pos = self .target .Pos + Vector (self .stickpositionX , self .stickpositionY ):RadRotate (self .target .RotAngle - self .stickrotation );
72
- self .RotAngle = self .stickdirection + (self .target .RotAngle - self .stickrotation );
76
+ if self .target and self .target .ID ~= rte . NoMOID then
77
+ self .Pos = self .target .Pos + Vector (self .stickPosition . X , self .stickPosition . Y ):RadRotate (self .target .RotAngle - self .stickRotation );
78
+ self .RotAngle = self .stickDirection + (self .target .RotAngle - self .stickRotation );
73
79
self .PinStrength = 1000 ;
74
- self .Vel = Vector (0 , 0 );
80
+ self .Vel = Vector ();
75
81
else
76
82
self .PinStrength = 0 ;
77
83
self .actionPhase = 0 ;
78
84
end
79
85
end
80
-
81
- if self .stuck == true then
86
+ if self .stuck then
82
87
if self .blinkTimer :IsPastSimMS (500 ) then
83
88
self .blinkTimer :Reset ();
84
89
if self .blink == false then
85
90
self .blink = true ;
86
- self .Frame = (self .alliedTeam + 1 ) * 2 ;
91
+ self .Frame = (self .alliedTeam + 1 ) * 2 ;
87
92
else
88
93
self .blink = false ;
89
- self .Frame = ((self .alliedTeam + 1 ) * 2 ) + 1 ;
94
+ self .Frame = ((self .alliedTeam + 1 ) * 2 ) + 1 ;
90
95
end
91
96
end
92
97
end
93
-
94
98
end
95
-
96
99
function Destroy (self )
97
-
98
100
coalitionC4TableA [self .tableNum ] = nil ;
99
101
coalitionC4TableB [self .tableNum ] = nil ;
100
-
101
102
end
0 commit comments