Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function SWEP:Think()
- if not IsFirstTimePredicted() then return end
- -- Update the rotation speed
- -- This is done on both server and client
- self.Reloading = self.Reloading or false
- self.SpinAccel = self.SpinAccel or 0
- if self.Owner:KeyDown(IN_ATTACK) and not self.Reloading then
- self.SpinAccel = math.Approach(self.SpinAccel, self.CyMaxSpeed, 0.02*FrameTime())
- else
- self.SpinAccel = math.Approach(self.SpinAccel, 0, 0.015*FrameTime())
- end
- -- Update piston positions on the client only
- if CLIENT then
- self.SpinPos1 = (self.SpinPos1 or 0) + self.SpinAccel
- self.SpinPos2 = (self.SpinPos2 or 0) + self.SpinAccel
- self.SpinPos3 = (self.SpinPos3 or 0) + self.SpinAccel
- self.VElements["cylinder"].pos.x = -self.SpinPos1
- self.VElements["cylinder+"].pos.x = self.SpinPos2
- self.VElements["cylinder++"].pos.x = -self.SpinPos3
- if -self.SpinPos1 <= self.CyIn then
- self.SpinPos1 = -self.CyOut
- end
- if self.SpinPos2 >= self.CyOut then
- self.SpinPos2 = self.CyIn
- end
- if -self.SpinPos3 <= self.CyIn then
- self.SpinPos3 = -self.CyOut
- end
- end
- print(self.SpinAccel)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement