Skip to content

Commit c8118e7

Browse files
committed
Fixes and safety checks for trajectory guide cause I got a lua error from it
1 parent a2076ec commit c8118e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Data/Base.rte/Devices/Shared/Scripts/TrajectoryGuide.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ end
3434

3535
function Update(self)
3636
local actor = self:GetRootParent();
37-
if MovableMan:IsActor(actor) and ToActor(actor):IsPlayerControlled() and not self:IsReloading() then
37+
if IsActor(actor) and MovableMan:ValidMO(actor) and ToActor(actor):IsPlayerControlled() and not self:IsReloading() then
3838
local actor = ToActor(actor);
3939
local controller = actor:GetController();
4040
if not self.isThrownDevice and (self:DoneReloading() or self.FiredFrame) and self.Magazine and self.Magazine.RoundCount ~= 0 then
@@ -58,7 +58,7 @@ function Update(self)
5858
--The following offset is as found in the source code (TODO: utilize EndThrowOffset properly instead)
5959
guideParPos = actor.Pos + actor.Vel * rte.PxTravelledPerFrame + Vector((actor.FGArm.ParentOffset.X + actor.FGArm.MaxLength) * actor.FlipFactor, actor.FGArm.ParentOffset.Y - actor.FGArm.MaxLength * 0.5):RadRotate(actor:GetAimAngle(false) * actor.FlipFactor);
6060
guideParVel = Vector(minVel + (maxVel - minVel) * throwProgress, 0):RadRotate(actor:GetAimAngle(true));
61-
else
61+
elseif not self.isThrownDevice then
6262
guideParPos = self.MuzzlePos;
6363
guideParVel = Vector(self.projectileVel, 0):RadRotate(actor:GetAimAngle(true));
6464
end

0 commit comments

Comments
 (0)