Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.09 KB | None | 0 0
  1.  
  2. function Create(self)
  3.  
  4. self.parent = nil;
  5. self.pullTimer = Timer();
  6. self.chamberChecked = false
  7. self.chamber2Needed = false;
  8.  
  9. self.newMag = false;
  10. self.chamber = true;
  11. --self.pullTimer:Reset(); --
  12. self.num = math.pi;
  13. self.numTwo = math.pi;
  14. self.numThree = math.pi;
  15. self.numFinal = math.pi;
  16. self.sfx = true; --
  17.  
  18. self.negNum = 0;
  19. self.sLength = self.SharpLength;
  20.  
  21. local actor = MovableMan:GetMOFromID(self.RootID);
  22. if actor and IsAHuman(actor) then
  23. self.parent = ToAHuman(actor);
  24. end
  25. end
  26.  
  27. function Update(self)
  28.  
  29. local actor = MovableMan:GetMOFromID(self.RootID);
  30. if actor and IsAHuman(actor) then
  31. self.parent = ToAHuman(actor);
  32. else
  33. self.parent = nil;
  34. -- cock and load on pickup
  35. --self.chamber = true; --
  36. --self.pullTimer:Reset(); --
  37. --self.num = math.pi; --
  38. --self.sfx = true; --
  39. end
  40.  
  41. if self.HFlipped then
  42. self.negNum = -1;
  43. else
  44. self.negNum = 1;
  45. end
  46.  
  47. if self.parent then
  48.  
  49. if self.Magazine then
  50.  
  51. if self.newMag == true then
  52.  
  53. self.chamber = true;
  54. self.pullTimer:Reset();
  55. self.num = math.pi;
  56. self.numTwo = math.pi;
  57. self.numThree = math.pi;
  58. self.numFinal = math.pi;
  59. self.sfx = true;
  60. self.chamberChecked = false;
  61.  
  62. self.newMag = false;
  63. end
  64. else
  65. self.newMag = true;
  66. end
  67.  
  68. if self.chamber == true then
  69.  
  70. self:Deactivate();
  71. --self.parent:GetController():SetState(Controller.WEAPON_FIRE,false);
  72.  
  73. if self.pullTimer:IsPastSimMS(1750) then
  74.  
  75.  
  76. if self.chamberChecked == false then
  77.  
  78. if math.random(100) > 50 then
  79. print("chambers, over 50")
  80. self.chambers = true;
  81.  
  82. if self.sfx ~= false then
  83. sfx = CreateAEmitter("Chamber Red Stare 2");
  84. sfx.Pos = self.Pos;
  85. MovableMan:AddParticle(sfx);
  86.  
  87. self.sfx = false;
  88. end
  89. elseif math.random(100) <= 50 then
  90. print("chambers, under 50")
  91. self.chambers = false;
  92. end
  93. self.chamberChecked = true
  94.  
  95. end
  96.  
  97. if self.sfx ~= false then
  98. sfx = CreateAEmitter("Chamber Red Stare");
  99. sfx.Pos = self.Pos;
  100. MovableMan:AddParticle(sfx);
  101.  
  102. self.sfx = false;
  103. end
  104.  
  105. self.SharpLength = self.SharpLength+(self.sLength/30)*math.sin(2*self.num);
  106.  
  107. if self.chambers == true then
  108.  
  109. self.RotAngle = self.RotAngle +self.negNum*math.sin(self.num)/10;
  110.  
  111. self.num = self.num - math.pi*0.09;
  112.  
  113. else
  114.  
  115. self.RotAngle = self.RotAngle +self.negNum*math.sin(self.num)/7;
  116.  
  117. self.num = self.num - math.pi*0.075;
  118. end
  119.  
  120. end
  121.  
  122. if self.num <= 0 then
  123.  
  124. self.num = 0;
  125. self.chamber = false;
  126. self.SharpLength = self.sLength;
  127. print("chamber one ended")
  128. if self.chambers == true then
  129. print("chamber two active")
  130. self.sfx = true;
  131. self.pullTimer:Reset();
  132. self.chamberTwo = true;
  133. end
  134. end
  135. end
  136.  
  137. if self.chamberTwo == true then
  138.  
  139. self:Deactivate();
  140.  
  141.  
  142. if self.pullTimer:IsPastSimMS(940) then
  143.  
  144.  
  145. if self.sfx ~= false then
  146. sfx = CreateAEmitter("Chamber Red Stare 3");
  147. sfx.Pos = self.Pos;
  148. MovableMan:AddParticle(sfx);
  149.  
  150. self.sfx = false;
  151. end
  152.  
  153. self.SharpLength = self.SharpLength+(self.sLength/30)*math.sin(2*self.numTwo);
  154.  
  155. self.RotAngle = self.RotAngle +self.negNum*math.sin(self.numTwo)/10;
  156.  
  157. self.numTwo = self.numTwo - math.pi*0.09;
  158. end
  159.  
  160. if self.numTwo <= 0 then
  161.  
  162. self.numTwo = 0;
  163. print("chamber 2 ended")
  164. self.SharpLength = self.sLength;
  165. self.chamberTwo = false;
  166. print("chamber 3 active")
  167. self.sfx = true;
  168. self.pullTimer:Reset();
  169. self.chamberTwo = true;
  170. end
  171. end
  172.  
  173.  
  174. if self.chamberThree == true then
  175.  
  176. self:Deactivate();
  177.  
  178.  
  179. if self.pullTimer:IsPastSimMS(500) then
  180.  
  181.  
  182. if self.sfx ~= false then
  183. sfx = CreateAEmitter("Chamber Red Stare 4");
  184. sfx.Pos = self.Pos;
  185. MovableMan:AddParticle(sfx);
  186.  
  187. self.sfx = false;
  188. end
  189.  
  190. self.SharpLength = self.SharpLength+(self.sLength/30)*math.sin(2*self.numThree);
  191.  
  192. self.RotAngle = self.RotAngle +self.negNum*math.sin(self.numThree)/10;
  193.  
  194. self.numThree = self.numThree - math.pi*0.09;
  195. end
  196.  
  197. if self.numThree <= 0 then
  198.  
  199. self.numThree = 0;
  200. print("chamber 3 ended")
  201. self.SharpLength = self.sLength;
  202. self.chamberThree = false;
  203. print("chamber final active")
  204. self.sfx = true;
  205. self.pullTimer:Reset();
  206. self.chamberFinal = true;
  207. end
  208. end
  209.  
  210.  
  211. if self.chamberFinal == true then
  212.  
  213. self:Deactivate();
  214.  
  215.  
  216. if self.pullTimer:IsPastSimMS(1700) then
  217.  
  218.  
  219. if self.sfx ~= false then
  220. sfx = CreateAEmitter("Chamber Red Stare");
  221. sfx.Pos = self.Pos;
  222. MovableMan:AddParticle(sfx);
  223.  
  224. self.sfx = false;
  225. end
  226.  
  227. self.SharpLength = self.SharpLength+(self.sLength/30)*math.sin(2*self.numFinal);
  228.  
  229. self.RotAngle = self.RotAngle +self.negNum*math.sin(self.numFinal)/7;
  230.  
  231. self.numFinal = self.numFinal - math.pi*0.075;
  232. end
  233.  
  234. if self.numFinal <= 0 then
  235.  
  236. self.numFinal = 0;
  237. print("chamber final ended")
  238. self.SharpLength = self.sLength;
  239. self.chamberFinal = false;
  240. end
  241. end
  242. end
  243. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement