Finished
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
local BLOCKED_AMMOMAKER_COMMANDS = {
|
||||
returnCasingsOnAttack = true,
|
||||
incrementSpendtRoundCount = true,
|
||||
returnCasingsOnReload = true,
|
||||
}
|
||||
|
||||
local function isPatchToggleEnabled()
|
||||
local vars = SandboxVars and SandboxVars.OpinionatedFirearms
|
||||
if vars and vars.HBVCEFAmmoMakerPatch ~= nil then
|
||||
return vars.HBVCEFAmmoMakerPatch == true
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local function shouldBlockAmmoMakerCasingCommands()
|
||||
return isPatchToggleEnabled()
|
||||
end
|
||||
|
||||
local function getModuleAndCommand(...)
|
||||
local argc = select("#", ...)
|
||||
if argc < 2 then
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
local firstArg = select(1, ...)
|
||||
if type(firstArg) == "string" then
|
||||
return firstArg, select(2, ...)
|
||||
end
|
||||
|
||||
if argc >= 3 then
|
||||
return select(2, ...), select(3, ...)
|
||||
end
|
||||
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
local function installCommandGate()
|
||||
if _G.OpinionatedFirearms_AmmoMakerCommandGateInstalled then
|
||||
return true
|
||||
end
|
||||
|
||||
if type(sendClientCommand) ~= "function" then
|
||||
return false
|
||||
end
|
||||
|
||||
_G.OpinionatedFirearms_AmmoMakerCommandGateInstalled = true
|
||||
_G.OpinionatedFirearms_OriginalSendClientCommand = sendClientCommand
|
||||
|
||||
sendClientCommand = function(...)
|
||||
local module, command = getModuleAndCommand(...)
|
||||
if module == "ammomaker" and BLOCKED_AMMOMAKER_COMMANDS[command] and shouldBlockAmmoMakerCasingCommands() then
|
||||
return
|
||||
end
|
||||
|
||||
return _G.OpinionatedFirearms_OriginalSendClientCommand(...)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local function ensureGateOnTick()
|
||||
if installCommandGate() then
|
||||
Events.OnTick.Remove(ensureGateOnTick)
|
||||
end
|
||||
end
|
||||
|
||||
if not installCommandGate() then
|
||||
Events.OnTick.Add(ensureGateOnTick)
|
||||
end
|
||||
3
common/media/lua/shared/Translate/EN/Sandbox_EN.txt
Normal file
3
common/media/lua/shared/Translate/EN/Sandbox_EN.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
Sandbox_OpinionatedFirearms = "Opinionated Firearms",
|
||||
Sandbox_HBVCEFAmmoMakerPatch = "Hot Brass -> Ammo Maker Casings",
|
||||
Sandbox_HBVCEFAmmoMakerPatch_tooltip = "When enabled, Hot Brass ejects Ammo Maker fired casings with Guns93 and will not eject Guns93 casing.",
|
||||
Reference in New Issue
Block a user