Advertisement
Guest User

Untitled

a guest
Jul 31st, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.53 KB | None | 0 0
  1. if RequiredScript == "lib/tweak_data/weapontweakdata" then
  2.  
  3. Hooks:PostHook( WeaponTweakData, "init", "Tact_Reload", function(self)
  4. --tactical reloading shite
  5. local tact_rel = {'deagle','colt_1911','usp','p226','g22c','glock_17','glock_18c','b92fs','ppk','mp9','new_mp5','mp7','p90','olympic','akmsu','akm','akm_gold','ak74','m16','amcar','new_m4','ak5','s552','g36','aug','saiga','new_m14','scar','fal','rpk','msr','r93','m95','famas','galil','g3','scorpion','benelli','serbu','r870','ksg','g26','spas12','l85a2','vhs','hs2000','tec9','sub2000','asval','wa2000','polymer','winchester1874','sparrow','model70','m37','china','sr2','pl14','tecci','hajk','boot','packrat','arbiter','flint','coal','baka','aa12','m1928','desertfox','schakal','lemming','siltstone','tti','contraband'}
  6.  
  7. if self.m40a5 then
  8. table.insert( tact_rel, "m40a5" )
  9. end
  10. if self.ak12 then
  11. table.insert( tact_rel, "ak12" )
  12. end
  13. if self.pp then
  14. table.insert( tact_rel, "pp" )
  15. end
  16. if self.mpx then
  17. table.insert( tact_rel, "mpx" )
  18. end
  19. if self.fd338 then
  20. table.insert( tact_rel, "fd338" )
  21. end
  22. if self.sks then
  23. table.insert( tact_rel, "sks" )
  24. end
  25. if self.grach then
  26. table.insert( tact_rel, "grach" )
  27. end
  28. if self.qs then
  29. table.insert( tact_rel, "qs" )
  30. end
  31. if self.novas then
  32. table.insert( tact_rel, "novas" )
  33. end
  34. if self.acw then
  35. table.insert( tact_rel, "acw" )
  36. end
  37. if self.sr3m then
  38. table.insert( tact_rel, "sr3m" )
  39. end
  40. if self.l115 then
  41. table.insert( tact_rel, "l115" )
  42. end
  43. if self.g36k then
  44. table.insert( tact_rel, "g36k" )
  45. end
  46.  
  47. for i, wep_id in ipairs(tact_rel) do
  48. self[ wep_id ].tactical_reload = 1
  49. end
  50.  
  51. local tact_akimbo = {'x_deagle','x_1911','x_b92fs','jowi','x_usp','x_g17','x_g22c','x_sr2','x_mp5','x_akmsu'}
  52. if self.x_mpx then
  53. table.insert( tact_rel, "x_mpx" )
  54. end
  55. if self.x_fmg9 then
  56. table.insert( tact_rel, "x_fmg9" )
  57. end
  58. for i, wep_id in ipairs(tact_akimbo) do
  59. self[ wep_id ].tactical_reload = 2
  60. end
  61.  
  62. if self.contraband_m203 then
  63. table.insert( tact_rel, "contraband_m203" )
  64.  
  65. for i, wep_id in ipairs(tact_rel) do
  66. self[ wep_id ].tactical_reload = 0
  67. end
  68. end)
  69.  
  70. elseif RequiredScript == "lib/units/weapons/newraycastweaponbase" then
  71.  
  72. --These functions were made by Deadly Mutton Chops and B1313
  73. --{
  74. function NewRaycastWeaponBase:clip_full()
  75. if self:weapon_tweak_data().tactical_reload then
  76. return self:get_ammo_remaining_in_clip() == self:get_ammo_max_per_clip() + self:weapon_tweak_data().tactical_reload
  77. else
  78. return self:get_ammo_remaining_in_clip() == self:get_ammo_max_per_clip()
  79. end
  80. end
  81.  
  82. function NewRaycastWeaponBase:on_reload()
  83. if self:weapon_tweak_data().uses_clip == true then
  84. if self:get_ammo_remaining_in_clip() <= self:get_ammo_max_per_clip() then
  85. self:set_ammo_remaining_in_clip(math.min(self:get_ammo_total(), self:get_ammo_max_per_clip(), self:get_ammo_remaining_in_clip() + self:weapon_tweak_data().clip_capacity))
  86. end
  87. else
  88. if self:get_ammo_remaining_in_clip() > 0 and self:weapon_tweak_data().tactical_reload == 1 then
  89. self:set_ammo_remaining_in_clip(math.min(self:get_ammo_total(), self:get_ammo_max_per_clip() + 1))
  90. elseif self:get_ammo_remaining_in_clip() > 1 and self:weapon_tweak_data().tactical_reload == 2 then
  91. self:set_ammo_remaining_in_clip(math.min(self:get_ammo_total(), self:get_ammo_max_per_clip() + 2))
  92. elseif self:get_ammo_remaining_in_clip() == 1 and self:weapon_tweak_data().tactical_reload == 2 then
  93. self:set_ammo_remaining_in_clip(math.min(self:get_ammo_total(), self:get_ammo_max_per_clip() + 1))
  94. elseif self:get_ammo_remaining_in_clip() > 0 and not self:weapon_tweak_data().tactical_reload then
  95. self:set_ammo_remaining_in_clip(math.min(self:get_ammo_total(), self:get_ammo_max_per_clip()))
  96. elseif self._setup.expend_ammo then
  97. self:set_ammo_remaining_in_clip(math.min(self:get_ammo_total(), self:get_ammo_max_per_clip()))
  98. else
  99. self:set_ammo_remaining_in_clip(self:get_ammo_max_per_clip())
  100. self:set_ammo_total(self:get_ammo_max_per_clip())
  101. end
  102. end
  103. managers.job:set_memory("kill_count_no_reload_" .. tostring(self._name_id), nil, true)
  104. end
  105.  
  106. function NewRaycastWeaponBase:reload_expire_t()
  107. if self._use_shotgun_reload then
  108. local ammo_remaining_in_clip = self:get_ammo_remaining_in_clip()
  109. if self:get_ammo_remaining_in_clip() > 0 and self:weapon_tweak_data().tactical_reload == 1 then
  110. return math.min(self:get_ammo_total() - ammo_remaining_in_clip, self:get_ammo_max_per_clip() + 1 - ammo_remaining_in_clip) * self:reload_shell_expire_t()
  111. else
  112. return math.min(self:get_ammo_total() - ammo_remaining_in_clip, self:get_ammo_max_per_clip() - ammo_remaining_in_clip) * self:reload_shell_expire_t()
  113. end
  114. end
  115. return nil
  116. end
  117.  
  118. function NewRaycastWeaponBase:update_reloading(t, dt, time_left)
  119. if self._use_shotgun_reload and t > self._next_shell_reloded_t then
  120. local speed_multiplier = self:reload_speed_multiplier()
  121. self._next_shell_reloded_t = self._next_shell_reloded_t + self:reload_shell_expire_t() / speed_multiplier
  122. if self:get_ammo_remaining_in_clip() > 0 and self:weapon_tweak_data().tactical_reload == 1 then
  123. self:set_ammo_remaining_in_clip(math.min(self:get_ammo_max_per_clip() + 1, self:get_ammo_remaining_in_clip() + 1))
  124. return true
  125. else
  126. self:set_ammo_remaining_in_clip(math.min(self:get_ammo_max_per_clip(), self:get_ammo_remaining_in_clip() + 1))
  127. return true
  128. end
  129. managers.job:set_memory("kill_count_no_reload_" .. tostring(self._name_id), nil, true)
  130. return true
  131. end
  132. end
  133. --}
  134.  
  135. elseif RequiredScript == "lib/units/weapons/shotgun/newshotgunbase" then
  136.  
  137. --These functions were made by Dumb Money Clocks and B1313
  138. --{
  139. function NewShotgunBase:reload_expire_t()
  140. local ammo_remaining_in_clip = self:get_ammo_remaining_in_clip()
  141. if self:get_ammo_remaining_in_clip() > 0 and self:weapon_tweak_data().tactical_reload == 1 then
  142. return math.min(self:get_ammo_total() - ammo_remaining_in_clip, self:get_ammo_max_per_clip() + 1 - ammo_remaining_in_clip) * self:reload_shell_expire_t()
  143. else
  144. return math.min(self:get_ammo_total() - ammo_remaining_in_clip, self:get_ammo_max_per_clip() - ammo_remaining_in_clip) * self:reload_shell_expire_t()
  145. end
  146. end
  147.  
  148. function NewShotgunBase:reload_enter_expire_t()
  149. return self:weapon_tweak_data().timers.shotgun_reload_enter or 0.3
  150. end
  151.  
  152. function NewShotgunBase:reload_exit_expire_t()
  153. return self:weapon_tweak_data().timers.shotgun_reload_exit_empty or 0.7
  154. end
  155.  
  156. function NewShotgunBase:reload_not_empty_exit_expire_t()
  157. return self:weapon_tweak_data().timers.shotgun_reload_exit_not_empty or 0.3
  158. end
  159.  
  160. function NewShotgunBase:reload_shell_expire_t()
  161. return self:weapon_tweak_data().timers.shotgun_reload_shell or 0.56666666
  162. end
  163.  
  164. function NewShotgunBase:_first_shell_reload_expire_t()
  165. return self:reload_shell_expire_t() - (self:weapon_tweak_data().timers.shotgun_reload_first_shell_offset or 0.33)
  166. end
  167.  
  168. function NewShotgunBase:start_reload(...)
  169. NewShotgunBase.super.start_reload(self, ...)
  170. self._started_reload_empty = self:clip_empty()
  171. local speed_multiplier = self:reload_speed_multiplier()
  172. self._next_shell_reloded_t = managers.player:player_timer():time() + self:_first_shell_reload_expire_t() / speed_multiplier
  173. end
  174.  
  175. function NewShotgunBase:started_reload_empty()
  176. return self._started_reload_empty
  177. end
  178.  
  179. function NewShotgunBase:update_reloading(t, dt, time_left)
  180. if t > self._next_shell_reloded_t then
  181. local speed_multiplier = self:reload_speed_multiplier()
  182. self._next_shell_reloded_t = self._next_shell_reloded_t + self:reload_shell_expire_t() / speed_multiplier
  183. if self:get_ammo_remaining_in_clip() > 0 and self:weapon_tweak_data().tactical_reload == 1 then
  184. self:set_ammo_remaining_in_clip(math.min(self:get_ammo_max_per_clip() + 1, self:get_ammo_remaining_in_clip() + 1))
  185. return true
  186. else
  187. self:set_ammo_remaining_in_clip(math.min(self:get_ammo_max_per_clip(), self:get_ammo_remaining_in_clip() + 1))
  188. return true
  189. end
  190. end
  191. end
  192.  
  193. function SaigaShotgun:reload_expire_t()
  194. return nil
  195. end
  196.  
  197. function SaigaShotgun:reload_enter_expire_t()
  198. return nil
  199. end
  200.  
  201. function SaigaShotgun:reload_exit_expire_t()
  202. return self:weapon_tweak_data().timers.reload_exit_empty or nil
  203. end
  204.  
  205. function SaigaShotgun:reload_not_empty_exit_expire_t()
  206. return self:weapon_tweak_data().timers.reload_exit_not_empty or nil
  207. end
  208.  
  209. function SaigaShotgun:update_reloading(t, dt, time_left)
  210. end
  211. --}
  212.  
  213. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement