Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _lastHeadshot = nil
- function check_headshot(self, attack_data)
- if self._dead or self._invulnerable then return end
- if attack_data.attacker_unit ~= managers.player:player_unit() then return end
- -- Check headshot
- if self._head_body_name and attack_data.col_ray.body and attack_data.col_ray.body:name() == self._ids_head_body_name then
- -- Check last headshot
- if not _lastHeadshot or os.clock() - _lastHeadshot > 0.5 then
- _lastHeadshot = os.clock()
- io.stdout:write("PLAY headshot.wav\n")
- end
- end
- end
- if not _copDmg then _copDmg = CopDamage.damage_bullet end
- function CopDamage:damage_bullet( attack_data )
- check_headshot(self, attack_data)
- return _copDmg(self, attack_data)
- end
- if not _civDmg then _civDmg = CivilianDamage.damage_bullet end
- function CivilianDamage:damage_bullet( attack_data )
- check_headshot(self, attack_data)
- return _civDmg(self, attack_data)
- end
- HuskCivilianDamage.damage_bullet = CivilianDamage.damage_bullet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement