Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit e725740

Browse files
committed
Missile Launcher edits;
- Properly account for shake range - Moved missile definition into Create - Remove beeping sound from MissileStart since it's already being played separately
1 parent b7dbd22 commit e725740

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

Data/Coalition.rte/Devices/Weapons/MissileLauncher/MissileLauncher.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ AddDevice = HDFirearm
464464
ReloadTime = 3200
465465
FullAuto = 0
466466
FireIgnoresThis = 1
467-
ShakeRange = 10
468-
SharpShakeRange = 7
467+
ShakeRange = 5
468+
SharpShakeRange = 1
469469
NoSupportFactor = 0
470470
ParticleSpreadRange = 0
471471
ShellSpreadRange = 8

Data/Coalition.rte/Devices/Weapons/MissileLauncher/MissileLauncher.lua

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ function Create(self)
1717

1818
self.arrow = CreateMOSRotating("Grapple Gun Guide Arrow");
1919
self.detectSound = CreateSoundContainer("Mine Activate", "Base.rte");
20+
self.missile = CreateAEmitter("Particle Coalition Missile Launcher", "Coalition.rte");
2021
end
2122

2223
function Update(self)
2324
local parent = self:GetRootParent();
25+
local sharpAimProgress = 0;
2426
if parent and IsActor(parent) then
2527
parent = ToActor(parent);
28+
sharpAimProgress = parent.SharpAimProgress;
2629
local controller = parent:GetController();
2730
local screen = ActivityMan:GetActivity():ScreenOfPlayer(controller.Player);
2831
local playerControlled = parent:IsPlayerControlled();
@@ -85,18 +88,19 @@ function Update(self)
8588
end
8689
end
8790
if self.FiredFrame then
88-
self.missile = CreateAEmitter("Particle Coalition Missile Launcher", "Coalition.rte");
89-
self.missile.Pos = self.MuzzlePos;
90-
local fireVector = Vector(self.fireVel * self.FlipFactor, 0):RadRotate(self.RotAngle);
91-
self.missile.Vel = self.Vel + fireVector + Vector(0, -math.abs(math.cos(fireVector.AbsRadAngle)));
92-
self.missile.RotAngle = self.missile.Vel.AbsRadAngle;
93-
self.missile.AngularVel = math.cos(self.missile.Vel.AbsRadAngle) * 10;
94-
self.missile.Team = self.Team;
95-
self.missile.IgnoresTeamHits = true;
91+
local missile = self.missile:Clone();
92+
missile.Pos = self.MuzzlePos;
93+
local shake = math.rad(self.ShakeRange * (1 - sharpAimProgress) + self.SharpShakeRange * sharpAimProgress) * RangeRand(-1, 1);
94+
local fireVector = Vector(self.fireVel * self.FlipFactor, 0):RadRotate(self.RotAngle + shake);
95+
missile.Vel = self.Vel + fireVector + Vector(0, -math.abs(math.cos(fireVector.AbsRadAngle)));
96+
missile.RotAngle = missile.Vel.AbsRadAngle;
97+
missile.AngularVel = math.cos(missile.Vel.AbsRadAngle) * 10 + shake;
98+
missile.Team = self.Team;
99+
missile.IgnoresTeamHits = true;
96100

97101
if self.target and IsMOSRotating(self.target) then
98-
self.missile:SetNumberValue("TargetID", self.target.ID);
102+
missile:SetNumberValue("TargetID", self.target.ID);
99103
end
100-
MovableMan:AddParticle(self.missile);
104+
MovableMan:AddParticle(missile);
101105
end
102106
end
Binary file not shown.

0 commit comments

Comments
 (0)