This repository was archived by the owner on Jan 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +39
-25
lines changed
Base.rte/Devices/Shared/Scripts Expand file tree Collapse file tree 3 files changed +39
-25
lines changed Original file line number Diff line number Diff line change 1
1
function Create (self )
2
- self .burstTimer = Timer ();
3
- self .burst = false ;
4
- self .canBurst = true ;
2
+ self .shotsPerBurst = 3 ;
3
+ self .coolDownDelay = (60000 / self .RateOfFire );
5
4
end
6
-
7
5
function Update (self )
8
-
9
- if self .canBurst == true and self :IsActivated () and self .Magazine ~= nil and self .Magazine .RoundCount > 0 then
10
- self .burstTimer :Reset ();
11
- self .canBurst = false ;
12
- self .burst = true ;
13
- end
14
-
15
- if self .burst == true then
16
- if self .burstTimer :IsPastSimMS (150 ) then
17
- self .burstTimer :Reset ();
18
- self :Deactivate ();
19
- self .burst = false ;
20
- else
6
+ if self .Magazine then
7
+ if self .coolDownTimer then
8
+ local parent = self :GetRootParent ();
9
+ if self .coolDownTimer :IsPastSimMS (self .coolDownDelay ) and (parent and IsActor (parent )) and (not self :IsActivated () or not ToActor (parent ):IsPlayerControlled ()) then
10
+ self .coolDownTimer , self .shotCounter = nil ;
11
+ else
12
+ self :Deactivate ();
13
+ end
14
+ elseif self .shotCounter then
21
15
self :Activate ();
22
- end
23
- else
24
- if self .canBurst == false then
25
- self :Deactivate ();
26
- if self .burstTimer :IsPastSimMS (200 ) then
27
- self .canBurst = true ;
16
+ if self .FiredFrame then
17
+ self .shotCounter = self .shotCounter + 1 ;
18
+ if self .shotCounter >= self .shotsPerBurst then
19
+ self .coolDownTimer = Timer ();
20
+ end
28
21
end
22
+ elseif self .FiredFrame then
23
+ self .shotCounter = 1 ;
29
24
end
25
+ else
26
+ self .coolDownTimer , self .shotCounter = nil ;
30
27
end
31
-
32
28
end
Original file line number Diff line number Diff line change
1
+ function Create (self )
2
+ self .setAngle = 0 ;
3
+ self .tilt = 0.2 ;
4
+ end
5
+ function Update (self )
6
+ if self .setAngle > 0 then
7
+ self .setAngle = self .setAngle - 0.0001 * self .RateOfFire ;
8
+ if self .setAngle < 0 then
9
+ self .setAngle = 0 ;
10
+ end
11
+ end
12
+ if self .FiredFrame then
13
+ self .setAngle = self .setAngle + self .tilt ;
14
+ end
15
+ self .RotAngle = self .RotAngle + self .setAngle * self .FlipFactor ;
16
+ local jointOffset = Vector (self .JointOffset .X * self .FlipFactor , self .JointOffset .Y ):RadRotate (self .RotAngle );
17
+ self .Pos = self .Pos - jointOffset + Vector (jointOffset .X , jointOffset .Y ):RadRotate (- self .setAngle * self .FlipFactor );
18
+ end
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ function Create(self)
3
3
self .loadedShell = false ;
4
4
self .reloadCycle = false ;
5
5
6
- self .reloadDelay = self . ReloadTime ;
6
+ self .reloadDelay = 100 ;
7
7
8
8
if self .Magazine then
9
9
self .ammoCounter = self .Magazine .RoundCount ;
You can’t perform that action at this time.
0 commit comments