Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions Data/Ronin.rte/Devices/Weapons/K98K/K98K.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,12 @@ function ThreadedUpdate(self)
self.needsChamber = false;
self.InheritedRotAngleTarget = 0;
self.rotationSpeed = 0.1;

local shell = CreateMOSParticle("Casing Long");

shell.Pos = self.Pos;
shell.Vel = self.Vel + Vector(-6 * self.FlipFactor, -4):RadRotate(self.RotAngle);
shell.Team = self.Team;
MovableMan:AddParticle(shell);
self.shell = CreateMOSParticle("Casing Long");
self.shell.Pos = self.Pos;
self.shell.Vel = self.Vel + Vector(-6 * self.FlipFactor, -4):RadRotate(self.RotAngle);
self.shell.Team = self.Team;
self:RequestSyncedUpdate();

self.chamberAnim = true;
end
Expand Down Expand Up @@ -189,7 +188,12 @@ function ThreadedUpdate(self)
end

if self.chamberAnim then
local balance = 5 + math.abs(math.sin(self.parent.RotAngle) * 5); --Laying down horizontally reduces swaying when pulling bolt
local balance = 5;

if self.parent then
balance = balance + math.abs(math.sin(self.parent.RotAngle) * 5); --Laying down horizontally reduces swaying when pulling bolt
end

self.Frame = 1;
self.SupportOffset = Vector(-5, -1);
local rotTotal = math.sin(self.rotFactor)/balance;
Expand Down Expand Up @@ -286,6 +290,13 @@ function ThreadedUpdate(self)
end
end

function SyncedUpdate(self)
if self.shell then
MovableMan:AddParticle(self.shell);
self.shell = nil;
end
end

function OnSave(self)
self:SetNumberValue("ammoCounter", self.ammoCounter);
end
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function ThreadedUpdate(self)
self.smoke = CreateMOSParticle("Tiny Smoke Ball 1");
self.smoke.Pos = self.Pos + Vector(math.random(-1, 1), math.random(-1, 1));
self.smoke.Vel = self.Vel + Vector(RangeRand(-2, 2), RangeRand(-2, 2));
self.smoke.Lifetime = smoke.Lifetime * RangeRand(0.5, 1.0);
self.smoke.Lifetime = self.smoke.Lifetime * RangeRand(0.5, 1.0);
self:RequestSyncedUpdate();
end
end
Expand Down