Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if RequiredScript == "lib/tweak_data/weapontweakdata" then
- Hooks:PostHook( WeaponTweakData, "init", "Tact_Reload", function(self)
- --tactical reloading shite
- 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','schakal','desertfox','packrat','arbiter','contraband','tti','coal','flint','siltstone','lemming','breech','basset','corgi','komodo','legacy','shepheard','shrew'}
- for i, wep_id in ipairs(tact_rel) do
- self[ wep_id ].tactical_reload = 1
- end
- local tact_akimbo = {'x_deagle','x_1911','x_b92fs','jowi','x_usp','x_g17','x_g22c','x_sr2','x_mp5','x_akmsu','x_packrat','x_basset','x_breech','x_coal','x_hajk','x_hs2000','x_legacy','x_mp7','x_mp9','x_olympic','x_p226','x_p90','x_pl14','x_polymer','x_ppk','x_schakal','x_scorpion','x_shepheard','x_shrew','x_sparrow','x_tec9','x_usp'}
- for i, wep_id in ipairs(tact_akimbo) do
- self[ wep_id ].tactical_reload = 2
- end
- end)
- elseif RequiredScript == "lib/units/weapons/newraycastweaponbase" then
- --These functions were made by Deadly Mutton Chops and B1313
- --{
- function NewRaycastWeaponBase:clip_full()
- if self:ammo_base():weapon_tweak_data().tactical_reload then
- return self:ammo_base():get_ammo_remaining_in_clip() == self:ammo_base():get_ammo_max_per_clip() + self:ammo_base():weapon_tweak_data().tactical_reload
- else
- return self:ammo_base():get_ammo_remaining_in_clip() == self:ammo_base():get_ammo_max_per_clip()
- end
- end
- function NewRaycastWeaponBase:on_reload()
- local ammo_base = self._reload_ammo_base or self:ammo_base()
- if ammo_base:weapon_tweak_data().uses_clip == true then
- if ammo_base:get_ammo_remaining_in_clip() <= ammo_base:get_ammo_max_per_clip() then
- ammo_base:set_ammo_remaining_in_clip(math.min(ammo_base:get_ammo_total(), ammo_base:get_ammo_max_per_clip(), ammo_base:get_ammo_remaining_in_clip() + ammo_base:weapon_tweak_data().clip_capacity))
- end
- else
- if ammo_base:get_ammo_remaining_in_clip() > 0 and ammo_base:weapon_tweak_data().tactical_reload == 1 then
- ammo_base:set_ammo_remaining_in_clip(math.min(ammo_base:get_ammo_total(), ammo_base:get_ammo_max_per_clip() + 1))
- elseif ammo_base:get_ammo_remaining_in_clip() > 1 and ammo_base:weapon_tweak_data().tactical_reload == 2 then
- ammo_base:set_ammo_remaining_in_clip(math.min(ammo_base:get_ammo_total(), ammo_base:get_ammo_max_per_clip() + 2))
- elseif ammo_base:get_ammo_remaining_in_clip() == 1 and ammo_base:weapon_tweak_data().tactical_reload == 2 then
- ammo_base:set_ammo_remaining_in_clip(math.min(ammo_base:get_ammo_total(), ammo_base:get_ammo_max_per_clip() + 1))
- elseif ammo_base:get_ammo_remaining_in_clip() > 0 and not ammo_base:weapon_tweak_data().tactical_reload then
- ammo_base:set_ammo_remaining_in_clip(math.min(ammo_base:get_ammo_total(), ammo_base:get_ammo_max_per_clip()))
- elseif self._setup.expend_ammo then
- ammo_base:set_ammo_remaining_in_clip(math.min(ammo_base:get_ammo_total(), ammo_base:get_ammo_max_per_clip()))
- else
- ammo_base:set_ammo_remaining_in_clip(ammo_base:get_ammo_max_per_clip())
- ammo_base:set_ammo_total(ammo_base:get_ammo_max_per_clip())
- end
- end
- managers.job:set_memory("kill_count_no_reload_" .. tostring(self._name_id), nil, true)
- self._reload_ammo_base = nil
- end
- function NewRaycastWeaponBase:reload_expire_t()
- if self._use_shotgun_reload then
- local ammo_remaining_in_clip = self:get_ammo_remaining_in_clip()
- if self:get_ammo_remaining_in_clip() > 0 and self:weapon_tweak_data().tactical_reload == 1 then
- 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()
- else
- 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()
- end
- end
- return nil
- end
- function NewRaycastWeaponBase:update_reloading(t, dt, time_left)
- if self._use_shotgun_reload and t > self._next_shell_reloded_t then
- local speed_multiplier = self:reload_speed_multiplier()
- self._next_shell_reloded_t = self._next_shell_reloded_t + self:reload_shell_expire_t() / speed_multiplier
- if self:get_ammo_remaining_in_clip() > 0 and self:weapon_tweak_data().tactical_reload == 1 then
- self:set_ammo_remaining_in_clip(math.min(self:get_ammo_max_per_clip() + 1, self:get_ammo_remaining_in_clip() + 1))
- return true
- else
- self:set_ammo_remaining_in_clip(math.min(self:get_ammo_max_per_clip(), self:get_ammo_remaining_in_clip() + 1))
- return true
- end
- managers.job:set_memory("kill_count_no_reload_" .. tostring(self._name_id), nil, true)
- return true
- end
- end
- --}
- elseif RequiredScript == "lib/units/weapons/shotgun/shotgunbase" then
- --These functions were made by Dumb Money Clocks and B1313
- --{
- function NewShotgunBase:reload_expire_t()
- local ammo_remaining_in_clip = self:get_ammo_remaining_in_clip()
- if self:get_ammo_remaining_in_clip() > 0 and self:weapon_tweak_data().tactical_reload == 1 then
- 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()
- else
- 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()
- end
- end
- function NewShotgunBase:reload_enter_expire_t()
- return self:weapon_tweak_data().timers.shotgun_reload_enter or 0.3
- end
- function NewShotgunBase:reload_exit_expire_t()
- return self:weapon_tweak_data().timers.shotgun_reload_exit_empty or 0.7
- end
- function NewShotgunBase:reload_not_empty_exit_expire_t()
- return self:weapon_tweak_data().timers.shotgun_reload_exit_not_empty or 0.3
- end
- function NewShotgunBase:reload_shell_expire_t()
- return self:weapon_tweak_data().timers.shotgun_reload_shell or 0.56666666
- end
- function NewShotgunBase:_first_shell_reload_expire_t()
- return self:reload_shell_expire_t() - (self:weapon_tweak_data().timers.shotgun_reload_first_shell_offset or 0.33)
- end
- function NewShotgunBase:start_reload(...)
- NewShotgunBase.super.start_reload(self, ...)
- self._started_reload_empty = self:clip_empty()
- local speed_multiplier = self:reload_speed_multiplier()
- self._next_shell_reloded_t = managers.player:player_timer():time() + self:_first_shell_reload_expire_t() / speed_multiplier
- end
- function NewShotgunBase:started_reload_empty()
- return self._started_reload_empty
- end
- function NewShotgunBase:update_reloading(t, dt, time_left)
- if t > self._next_shell_reloded_t then
- local speed_multiplier = self:reload_speed_multiplier()
- self._next_shell_reloded_t = self._next_shell_reloded_t + self:reload_shell_expire_t() / speed_multiplier
- if self:get_ammo_remaining_in_clip() > 0 and self:weapon_tweak_data().tactical_reload == 1 then
- self:set_ammo_remaining_in_clip(math.min(self:get_ammo_max_per_clip() + 1, self:get_ammo_remaining_in_clip() + 1))
- return true
- else
- self:set_ammo_remaining_in_clip(math.min(self:get_ammo_max_per_clip(), self:get_ammo_remaining_in_clip() + 1))
- return true
- end
- end
- end
- function SaigaShotgun:reload_expire_t()
- return nil
- end
- function SaigaShotgun:reload_enter_expire_t()
- return nil
- end
- function SaigaShotgun:reload_exit_expire_t()
- return self:weapon_tweak_data().timers.reload_exit_empty or nil
- end
- function SaigaShotgun:reload_not_empty_exit_expire_t()
- return self:weapon_tweak_data().timers.reload_exit_not_empty or nil
- end
- function SaigaShotgun:update_reloading(t, dt, time_left)
- end
- --}
- elseif RequiredScript == "lib/units/weapons/shotgun/newshotgunbase" then
- --These functions were made by Dumb Money Clocks and B1313
- --{
- function NewShotgunBase:reload_expire_t()
- local ammo_remaining_in_clip = self:get_ammo_remaining_in_clip()
- if self:get_ammo_remaining_in_clip() > 0 and self:weapon_tweak_data().tactical_reload == 1 then
- 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()
- else
- 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()
- end
- end
- function NewShotgunBase:reload_enter_expire_t()
- return self:weapon_tweak_data().timers.shotgun_reload_enter or 0.3
- end
- function NewShotgunBase:reload_exit_expire_t()
- return self:weapon_tweak_data().timers.shotgun_reload_exit_empty or 0.7
- end
- function NewShotgunBase:reload_not_empty_exit_expire_t()
- return self:weapon_tweak_data().timers.shotgun_reload_exit_not_empty or 0.3
- end
- function NewShotgunBase:reload_shell_expire_t()
- return self:weapon_tweak_data().timers.shotgun_reload_shell or 0.56666666
- end
- function NewShotgunBase:_first_shell_reload_expire_t()
- return self:reload_shell_expire_t() - (self:weapon_tweak_data().timers.shotgun_reload_first_shell_offset or 0.33)
- end
- function NewShotgunBase:start_reload(...)
- NewShotgunBase.super.start_reload(self, ...)
- self._started_reload_empty = self:clip_empty()
- local speed_multiplier = self:reload_speed_multiplier()
- self._next_shell_reloded_t = managers.player:player_timer():time() + self:_first_shell_reload_expire_t() / speed_multiplier
- end
- function NewShotgunBase:started_reload_empty()
- return self._started_reload_empty
- end
- function NewShotgunBase:update_reloading(t, dt, time_left)
- if t > self._next_shell_reloded_t then
- local speed_multiplier = self:reload_speed_multiplier()
- self._next_shell_reloded_t = self._next_shell_reloded_t + self:reload_shell_expire_t() / speed_multiplier
- if self:get_ammo_remaining_in_clip() > 0 and self:weapon_tweak_data().tactical_reload == 1 then
- self:set_ammo_remaining_in_clip(math.min(self:get_ammo_max_per_clip() + 1, self:get_ammo_remaining_in_clip() + 1))
- return true
- else
- self:set_ammo_remaining_in_clip(math.min(self:get_ammo_max_per_clip(), self:get_ammo_remaining_in_clip() + 1))
- return true
- end
- end
- end
- function SaigaShotgun:reload_expire_t()
- return nil
- end
- function SaigaShotgun:reload_enter_expire_t()
- return nil
- end
- function SaigaShotgun:reload_exit_expire_t()
- return self:weapon_tweak_data().timers.reload_exit_empty or nil
- end
- function SaigaShotgun:reload_not_empty_exit_expire_t()
- return self:weapon_tweak_data().timers.reload_exit_not_empty or nil
- end
- function SaigaShotgun:update_reloading(t, dt, time_left)
- end
- --}
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement