@@ -111,13 +111,12 @@ function ThreadedUpdate(self)
111
111
self .needsChamber = false ;
112
112
self .InheritedRotAngleTarget = 0 ;
113
113
self .rotationSpeed = 0.1 ;
114
-
115
- local shell = CreateMOSParticle (" Casing Long" );
116
114
117
- shell .Pos = self .Pos ;
118
- shell .Vel = self .Vel + Vector (- 6 * self .FlipFactor , - 4 ):RadRotate (self .RotAngle );
119
- shell .Team = self .Team ;
120
- MovableMan :AddParticle (shell );
115
+ self .shell = CreateMOSParticle (" Casing Long" );
116
+ self .shell .Pos = self .Pos ;
117
+ self .shell .Vel = self .Vel + Vector (- 6 * self .FlipFactor , - 4 ):RadRotate (self .RotAngle );
118
+ self .shell .Team = self .Team ;
119
+ self :RequestSyncedUpdate ();
121
120
122
121
self .chamberAnim = true ;
123
122
end
@@ -189,7 +188,12 @@ function ThreadedUpdate(self)
189
188
end
190
189
191
190
if self .chamberAnim then
192
- local balance = 5 + math.abs (math.sin (self .parent .RotAngle ) * 5 ); -- Laying down horizontally reduces swaying when pulling bolt
191
+ local balance = 5 ;
192
+
193
+ if self .parent then
194
+ balance = balance + math.abs (math.sin (self .parent .RotAngle ) * 5 ); -- Laying down horizontally reduces swaying when pulling bolt
195
+ end
196
+
193
197
self .Frame = 1 ;
194
198
self .SupportOffset = Vector (- 5 , - 1 );
195
199
local rotTotal = math.sin (self .rotFactor )/ balance ;
@@ -286,6 +290,13 @@ function ThreadedUpdate(self)
286
290
end
287
291
end
288
292
293
+ function SyncedUpdate (self )
294
+ if self .shell then
295
+ MovableMan :AddParticle (self .shell );
296
+ self .shell = nil ;
297
+ end
298
+ end
299
+
289
300
function OnSave (self )
290
301
self :SetNumberValue (" ammoCounter" , self .ammoCounter );
291
302
end
0 commit comments