Guest User

Untitled

a guest
Jun 26th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. -- Unless this weapon should follow standard logic...
  2. function RaycastWeaponBase:_soundfix_should_play_normal()
  3.     local name_id = self:get_name_id()
  4.     if tweak_data.weapon[name_id].sounds.fire_single == nil then
  5.         return true
  6.     end
  7.     return false
  8. end
  9.  
  10. -- ...don't play a sound conventionally...
  11. local original_fire_sound = RaycastWeaponBase._fire_sound
  12. function RaycastWeaponBase:_fire_sound()
  13.     if self:_soundfix_should_play_normal() then
  14.         original_fire_sound(self)
  15.     end
  16. end
  17.  
  18. -- ...and instead play the single fire noise here
  19. local original_fire = RaycastWeaponBase.fire
  20. function RaycastWeaponBase:fire(...)
  21.     local result = original_fire(self, ...)
  22.    
  23.     -- TODO?: Why should this have to check for result?
  24.     if not self:_soundfix_should_play_normal() and result then
  25.         self:play_tweak_data_sound("fire_single", "fire")
  26.     end
  27.  
  28.     return result
  29. end
Advertisement
Add Comment
Please, Sign In to add comment