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'}
- if self.m40a5 then
- table.insert( tact_rel, "m40a5" )
- end
- if self.ak12 then
- table.insert( tact_rel, "ak12" )
- end
- if self.pp then
- table.insert( tact_rel, "pp" )
- end
- if self.mpx then
- table.insert( tact_rel, "mpx" )
- end
- if self.fd338 then
- table.insert( tact_rel, "fd338" )
- end
- if self.sks then
- table.insert( tact_rel, "sks" )
- end
- if self.grach then
- table.insert( tact_rel, "grach" )
- end
- if self.qs then
- table.insert( tact_rel, "qs" )
- end
- if self.novas then
- table.insert( tact_rel, "novas" )
- end
- if self.acw then
- table.insert( tact_rel, "acw" )
- end
- if self.sr3m then
- table.insert( tact_rel, "sr3m" )
- end
- if self.l115 then
- table.insert( tact_rel, "l115" )
- end
- if self.g36k then
- table.insert( tact_rel, "g36k" )
- end
- if self.contraband then
- table.insert( tact_rel, "contraband" )
- end --say hello to my Little Friend 7.62 Assault Rifle
- 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'}
- if self.x_mpx then
- table.insert( tact_rel, "x_mpx" )
- end
- if self.x_fmg9 then
- table.insert( tact_rel, "x_fmg9" )
- end
- 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:weapon_tweak_data().tactical_reload then
- return self:get_ammo_remaining_in_clip() == self:get_ammo_max_per_clip() + self:weapon_tweak_data().tactical_reload
- else
- return self:get_ammo_remaining_in_clip() == self:get_ammo_max_per_clip()
- end
- end
- function NewRaycastWeaponBase:on_reload()
- if self:gadget_overrides_weapon_functions() then --offyerrocker wuz hear lol
- NewRaycastWeaponBase.super.on_reload(self)
- --last two lines here are probably unnecessary
- --Previous method only affected conventional guns. Reloading the contraband_m203 would reload the base gun instead with that method.
- self:set_reload_objects_visible(false)
- self._reload_objects = {}
- elseif self:weapon_tweak_data().uses_clip == true then
- if self:get_ammo_remaining_in_clip() <= self:get_ammo_max_per_clip() then
- 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))
- end
- else
- 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_total(), self:get_ammo_max_per_clip() + 1))
- elseif self:get_ammo_remaining_in_clip() > 1 and self:weapon_tweak_data().tactical_reload == 2 then
- self:set_ammo_remaining_in_clip(math.min(self:get_ammo_total(), self:get_ammo_max_per_clip() + 2))
- elseif self:get_ammo_remaining_in_clip() == 1 and self:weapon_tweak_data().tactical_reload == 2 then
- self:set_ammo_remaining_in_clip(math.min(self:get_ammo_total(), self:get_ammo_max_per_clip() + 1))
- elseif self:get_ammo_remaining_in_clip() > 0 and not self:weapon_tweak_data().tactical_reload then
- self:set_ammo_remaining_in_clip(math.min(self:get_ammo_total(), self:get_ammo_max_per_clip()))
- elseif self._setup.expend_ammo then
- self:set_ammo_remaining_in_clip(math.min(self:get_ammo_total(), self:get_ammo_max_per_clip()))
- else
- self:set_ammo_remaining_in_clip(self:get_ammo_max_per_clip())
- self:set_ammo_total(self:get_ammo_max_per_clip())
- end
- end
- managers.job:set_memory("kill_count_no_reload_" .. tostring(self._name_id), nil, true)
- 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/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