Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Header comment that will likely be deleted. This was made by 90e.
- --Auto-Fire SoundFix, unofficial patch
- --Changes from official version:
- --No longer crashes, supports underbarrel attachments
- --7/2/17 Made code look less hideous, thanks to Llamageddon! (https://modworkshop.net/member.php?action=profile&uid=42988)
- -- <3 Offy
- -- Unless this weapon should follow standard logic...
- function RaycastWeaponBase:_soundfix_should_play_normal()
- local name_id = self:get_name_id()
- if tweak_data.weapon[name_id].sounds.fire_single == nil or self:gadget_overrides_weapon_functions() then
- return true
- end
- return false
- end
- -- ...don't play a sound conventionally...
- local original_fire_sound = RaycastWeaponBase._fire_sound
- function RaycastWeaponBase:_fire_sound()
- if self:_soundfix_should_play_normal() then
- original_fire_sound(self)
- end
- end
- -- ...and instead play the single fire noise here
- local original_fire = RaycastWeaponBase.fire
- function RaycastWeaponBase:fire(...)
- local result = original_fire(self, ...)
- -- TODO?: Why should this have to check for result?
- if not self:_soundfix_should_play_normal() and result then
- self:play_tweak_data_sound("fire_single", "fire")
- end
- return result
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement