Convars, Total Anarchy Mode

This commit is contained in:
Arctic 2022-07-31 12:36:59 +10:00
parent 25fa8273db
commit 5223e7bb99
11 changed files with 245 additions and 93 deletions

View File

@ -154,6 +154,7 @@ Only terminology that may cause confusion is laid out. Any terms that are standa
## List of Conditions
Use these in attachment stats, e.g. AimDownSightsTimeMultCrouch to multiply ADS time when crouching.
- **NPC**: Enabled when the owner is an NPC.
- **True**: Enabled when TrueNames is active.
- **Silenced**: Enabled when a silencer is installed.
- **UBGL**: Enabled when an underbarrel weapon is active.

View File

@ -521,21 +521,32 @@ function ARC9.DrawHUD()
-- surface.SetDrawColor(ARC9.GetHUDColor("shadow_3d", 20))
-- surface.DrawRect( 8, 4, 254, 110 )
surface.SetDrawColor(ARC9.GetHUDColor("bg_3d", 20))
surface.DrawRect( 0, 0, 254, 110 )
if GetConVar("arc9_hud_compact"):GetBool() then
surface.SetDrawColor(ARC9.GetHUDColor("bg_3d", 20))
surface.DrawRect( 0, 0, 254, 80 )
surface.SetDrawColor(ARC9.GetHUDColor("bg_3d", 100))
surface.SetMaterial(hud_bg)
surface.DrawTexturedRect(0, 0, 254, 110)
surface.SetDrawColor(ARC9.GetHUDColor("bg_3d", 100))
surface.SetMaterial(hud_bg)
surface.DrawTexturedRect(0, 0, 254, 80)
surface.DrawLine(0, 115, 254, 115)
surface.DrawLine(0, 85, 254, 85)
else
surface.SetDrawColor(ARC9.GetHUDColor("bg_3d", 20))
surface.DrawRect( 0, 0, 254, 110 )
surface.SetDrawColor(ARC9.GetHUDColor("bg_3d", 100))
surface.SetMaterial(hud_bg)
surface.DrawTexturedRect(0, 0, 254, 110)
surface.DrawLine(0, 115, 254, 115)
end
-- surface.SetDrawColor(ARC9.GetHUDColor("bg_3d", 20))
-- surface.DrawRect( 0, 0, 140, 70 )
local deco_x = 6
local deco_y = 2
local deco = "ARC9 UNIVERSAL HUD v1.03"
local deco = "ARCTIC SYSTEMS HUD v" .. ARC9.Version
surface.SetTextColor(ARC9.GetHUDColor("shadow_3d", 100))
surface.SetFont("ARC9_Deco_8_Unscaled")
@ -774,86 +785,88 @@ function ARC9.DrawHUD()
CreateControllerKeyLine( { x = fmh_x - fmh_w, y = fmh_y, size = 16, font = "ARC9_12_Unscaled" }, fmh_text )
end
// bullet fields
if !GetConVar("arc9_hud_compact"):GetBool() then
// bullet fields
local b_alpha = 225
local b_alpha = 225
local b_m_left = -8
local b_m_down = 72
local b_m_margin = 2
local b_m_left = -8
local b_m_down = 72
local b_m_margin = 2
local row_size = 15
local row_size = 15
if showheat then
row_size = 10
end
local row1_bullets = 0
local row2_bullets = 0
local rackrise = 0
local disparity = weapon_clipsize % row_size
local corrected = clip_to_show - disparity
local row = math.ceil(corrected / row_size)
local sb = 14
local crc = clip_to_show
if disparity > 0 then
crc = clip_to_show + row_size - disparity
end
if crc > row_size then
row2_bullets = math.min(row_size, clip_to_show + disparity)
row1_bullets = (corrected % row_size)
if row1_bullets == 0 then
row1_bullets = row_size
if showheat then
row_size = 10
end
if clip_to_show <= row_size + disparity then
row2_bullets = disparity
local row1_bullets = 0
local row2_bullets = 0
local rackrise = 0
local disparity = weapon_clipsize % row_size
local corrected = clip_to_show - disparity
local row = math.ceil(corrected / row_size)
local sb = 14
local crc = clip_to_show
if disparity > 0 then
crc = clip_to_show + row_size - disparity
end
if row < lastrow then
rackrisetime = CurTime()
end
if crc > row_size then
row2_bullets = math.min(row_size, clip_to_show + disparity)
row1_bullets = (corrected % row_size)
lastrow = row
else
row2_bullets = clip_to_show
end
if row1_bullets == 0 then
row1_bullets = row_size
end
if rackrisetime + 0.2 > CurTime() then
local rackrisedelta = ((rackrisetime + 0.2) - CurTime()) / 0.2
rackrise = rackrisedelta * (sb + b_m_margin)
end
if clip_to_show <= row_size + disparity then
row2_bullets = disparity
end
for i = 1, row1_bullets do
surface.SetDrawColor(ARC9.GetHUDColor("shadow_3d", 100))
surface.DrawRect(b_m_left + ((sb + b_m_margin) * i) + s_right, b_m_down + rackrise + s_down, sb, sb)
if row < lastrow then
rackrisetime = CurTime()
end
if row1_bullets - i < chambered then
surface.SetDrawColor(ARC9.GetHUDColor("hi_3d", b_alpha))
lastrow = row
else
surface.SetDrawColor(ARC9.GetHUDColor("fg_3d", b_alpha))
row2_bullets = clip_to_show
end
surface.DrawRect(b_m_left + ((sb + b_m_margin) * i), b_m_down + rackrise, sb, sb)
end
for i = 1, row2_bullets do
surface.SetDrawColor(ARC9.GetHUDColor("shadow_3d", 100))
surface.DrawRect(b_m_left + ((sb + b_m_margin) * i) + s_right, b_m_down + sb + b_m_margin + rackrise + s_down, sb, sb)
if row2_bullets - i < chambered - row1_bullets then
surface.SetDrawColor(ARC9.GetHUDColor("hi_3d", b_alpha))
else
surface.SetDrawColor(ARC9.GetHUDColor("fg_3d", b_alpha))
if rackrisetime + 0.2 > CurTime() then
local rackrisedelta = ((rackrisetime + 0.2) - CurTime()) / 0.2
rackrise = rackrisedelta * (sb + b_m_margin)
end
for i = 1, row1_bullets do
surface.SetDrawColor(ARC9.GetHUDColor("shadow_3d", 100))
surface.DrawRect(b_m_left + ((sb + b_m_margin) * i) + s_right, b_m_down + rackrise + s_down, sb, sb)
if row1_bullets - i < chambered then
surface.SetDrawColor(ARC9.GetHUDColor("hi_3d", b_alpha))
else
surface.SetDrawColor(ARC9.GetHUDColor("fg_3d", b_alpha))
end
surface.DrawRect(b_m_left + ((sb + b_m_margin) * i), b_m_down + rackrise, sb, sb)
end
for i = 1, row2_bullets do
surface.SetDrawColor(ARC9.GetHUDColor("shadow_3d", 100))
surface.DrawRect(b_m_left + ((sb + b_m_margin) * i) + s_right, b_m_down + sb + b_m_margin + rackrise + s_down, sb, sb)
if row2_bullets - i < chambered - row1_bullets then
surface.SetDrawColor(ARC9.GetHUDColor("hi_3d", b_alpha))
else
surface.SetDrawColor(ARC9.GetHUDColor("fg_3d", b_alpha))
end
surface.DrawRect(b_m_left + ((sb + b_m_margin) * i), b_m_down + sb + b_m_margin + rackrise, sb, sb)
end
surface.DrawRect(b_m_left + ((sb + b_m_margin) * i), b_m_down + sb + b_m_margin + rackrise, sb, sb)
end
cam.End3D2D()

View File

@ -13,4 +13,14 @@ hook.Add("CreateMove", "ARC9_CreateMove", function(cmd)
cmd:SetButtons(buttons)
end
end
if GetConVar("arc9_autoreload"):GetBool() then
if wpn:Clip1() == 0 and wpn:Ammo1() > 0 and wpn:GetNextPrimaryFire() + 0.5 < CurTime() then
local buttons = cmd:GetButtons()
buttons = buttons + IN_RELOAD
cmd:SetButtons(buttons)
end
end
end)

View File

@ -1,4 +1,5 @@
function ARC9.AttemptGiveNPCWeapon()
if !GetConVar("arc9_npc_give_weapons"):GetBool() then return end
local wpn = LocalPlayer():GetActiveWeapon()
if !wpn.ARC9 then return end

View File

@ -199,6 +199,8 @@ ARC9.RHIKBones = {
ARC9.HUToM = 0.0254
ARC9.MOAToAcc = 10 / 360 / 60
ARC9.Version = "1.0"
function ARC9.Dev(level)
return GetConVar("developer"):GetInt() >= level
end

View File

@ -1,4 +1,8 @@
local conVars = {
{
name = "npc_give_weapons",
default = "1",
},
{
name = "truenames",
default = "0",
@ -104,6 +108,11 @@ local conVars = {
default = "0",
replicated = true
},
{
name = "atts_anarchy",
default = "0",
replicated = true
},
{
name = "atts_free",
default = "0",
@ -222,7 +231,11 @@ local conVars = {
{
name = "hud_always",
default = "0"
},
},
{
name = "hud_compact",
default = "0"
},
{
name = "hud_arc9",
default = "1"
@ -242,6 +255,11 @@ local conVars = {
default = "1",
client = true
},
{
name = "autoreload",
default = "1",
client = true
},
{
name = "toggleads",
default = "0",
@ -372,16 +390,15 @@ local function menu_client_ti(panel)
command = "arc9_autosave"
})
panel:ControlHelp( "Reattach your last used attachments." )
panel:AddControl("checkbox", {
label = "Compensate Sensitivity",
command = "arc9_compensate_sens"
})
panel:ControlHelp( "Does this do anything?" )
panel:AddControl("checkbox", {
label = "Draw HUD",
command = "arc9_hud_arc9"
})
panel:ControlHelp( "HUD on ARC-9 weapons." )
panel:AddControl("checkbox", {
label = "Compact HUD",
command = "arc9_hud_compact"
})
panel:ControlHelp( "Reduced-size HUD design." )
panel:AddControl("checkbox", {
label = "Draw HUD Everywhere",
command = "arc9_hud_always"
@ -401,7 +418,26 @@ local function menu_client_ti(panel)
label = "Toggle ADS",
command = "arc9_toggleads"
})
panel:ControlHelp( "Toggle ADS is very broken on RT sights. Fix before release." )
panel:AddControl("checkbox", {
label = "Automatic Reload",
command = "arc9_autoreload"
})
// Add a slider for FOV
panel:AddControl("slider", {
label = "Viewmodel FOV",
command = "arc9_fov",
min = -45,
max = 45,
})
// Add help text for imaginary bullets
panel:ControlHelp( "Imaginary bullets appear to travel outside the skybox. There is no gameplay difference to disabling this option." )
// Add a toggle for imaginary bullets
panel:AddControl("checkbox", {
label = "Enable Imaginary Bullets",
command = "arc9_bullet_imaginary"
})
end
local function menu_client_customization(panel)
@ -436,6 +472,64 @@ local function menu_client_customization(panel)
panel:ControlHelp( "Fake day to debug and test as, set over 0!!" )
end
local function menu_client_optics(panel)
panel:AddControl("checkbox", {
label = "Cheap Scopes",
command = "arc9_cheapscopes"
})
panel:ControlHelp( "Cheap Scopes are practically as good as normal scopes, but substantially improve performance." )
panel:AddControl("color", {
label = "Reflex Sight Color",
red = "arc9_reflex_r",
green = "arc9_reflex_g",
blue = "arc9_reflex_b"
})
panel:AddControl("color", {
label = "Scope Color",
red = "arc9_scope_r",
green = "arc9_scope_g",
blue = "arc9_scope_b"
})
end
local function menu_server_ballistics(panel)
panel:AddControl("checkbox", {
label = "Physical Bullets",
command = "arc9_bullet_physics"
})
panel:ControlHelp( "Most weapons are designed for this to be on. Some weapons force physical bullets on. Disabling this will improve server performance." )
// Add a slider to control bullet gravity
panel:AddControl("slider", {
label = "Gravity Multiplier",
command = "arc9_bullet_gravity",
min = 0,
max = 100,
})
// Add a slider for bullet drag
panel:AddControl("slider", {
label = "Drag Multiplier",
command = "arc9_bullet_drag",
min = 0,
max = 100,
})
// Add a toggle for ricochet
panel:AddControl("checkbox", {
label = "Enable Ricochet",
command = "arc9_ricochet"
})
// Add a slider for bullet lifetime
panel:AddControl("slider", {
label = "Bullet Lifetime",
command = "arc9_bullet_lifetime",
min = 1,
max = 100,
})
end
local function menu_client_controller(panel)
panel:AddControl( "header", { description = "Replace key names with controller glyphs." } )
panel:CheckBox("Engage Super Controller Mode", "arc9_controller")
@ -588,17 +682,20 @@ local function menu_server_ti(panel)
label = "NPCs Deal Equal Damage",
command = "arc9_npc_equality"
})
panel:AddControl("label", {
text = "Disable body damage cancel only if you have another addon that will override the HL2 limb damage multipliers."
})
panel:AddControl("checkbox", {
label = "Default Body Damage Cancel",
command = "arc9_mod_bodydamagecancel"
})
panel:ControlHelp( "Disable body damage cancel only if you have another addon that will override the HL2 limb damage multipliers." )
panel:AddControl("checkbox", {
label = "Infinite Ammo",
command = "arc9_infinite_ammo"
})
// Add a slider for giving NPCs weapons.
panel:AddControl("checkbox", {
label = "Allow Giving NPCs Weapons With +USE.",
command = "arc9_npc_give_weapons",
})
end
local function menu_server_attachments(panel)
@ -606,10 +703,12 @@ local function menu_server_attachments(panel)
label = "Free Attachments",
command = "arc9_atts_free"
})
panel:ControlHelp( "Enable this to be able to use all attachments without spawning entities." )
panel:AddControl("checkbox", {
label = "Attachment Locking",
command = "arc9_atts_lock"
})
panel:ControlHelp( "You only need one attachment to be able to use it on all guns." )
panel:AddControl("checkbox", {
label = "Lose Attachments On Death",
command = "arc9_atts_loseondie"
@ -618,10 +717,16 @@ local function menu_server_attachments(panel)
label = "Generate Attachment Entities",
command = "arc9_atts_generateentities"
})
panel:ControlHelp( "Disabling this can save a lot of time on startup." )
panel:AddControl("checkbox", {
label = "NPCs Get Random Attachments",
command = "arc9_atts_npc"
})
panel:AddControl("checkbox", {
label = "Total Anarchy Mode",
command = "arc9_atts_anarchy"
})
panel:ControlHelp( "For the love of God, don't enable this." )
end
c1 = {
@ -859,12 +964,18 @@ local clientmenus_ti = {
{
text = "Client - Controller", func = menu_client_controller
},
{
text = "Client - Optics", func = menu_client_optics
},
{
text = "Server", func = menu_server_ti
},
{
text = "Server - Attachments", func = menu_server_attachments
},
{
text = "Server - Ballistics", func = menu_server_ballistics
},
{
text = "Server - Modifiers", func = menu_server_modifiers
},

View File

@ -127,9 +127,14 @@ function ARC9.GetAttsForCats(cats)
end
for _, cat in pairs(cats) do
if table.HasValue(attcats, cat) then
if GetConVar("arc9_atts_anarchy"):GetBool() then
table.insert(atts, k.ShortName)
break
else
if table.HasValue(attcats, cat) then
table.insert(atts, k.ShortName)
break
end
end
end
end

View File

@ -20,6 +20,8 @@ if SERVER then
net.Receive("arc9_givenpcweapon", function(len, ply)
local ent = net.ReadEntity()
if !GetConVar("arc9_npc_give_weapons"):GetBool() then return end
if !ent:IsValid() then return end
if !ent:IsNPC() then return end

View File

@ -384,10 +384,10 @@ function SWEP:CreateCustomizeHUD()
surface.SetFont("ARC9_10")
local tx = "problem?"
local tz = surface.GetTextSize(tx)
surface.SetTextPos((w/2) - (tz/2)+ScreenScale(1), ScreenScale(8+1))
surface.SetTextPos((w/2) - (tz/2)+ScreenScale(1), ScreenScale(16+1))
surface.SetTextColor(ARC9.GetHUDColor("shadow"))
surface.DrawText(tx)
surface.SetTextPos((w/2) - (tz/2), ScreenScale(8))
surface.SetTextPos((w/2) - (tz/2), ScreenScale(16))
surface.SetTextColor(ARC9.GetHUDColor("fg"))
surface.DrawText(tx)
end
@ -440,10 +440,10 @@ function SWEP:CreateCustomizeHUD()
surface.SetFont("ARC9_10")
local tx = "Happy Birthday to Arctic!"
local tz = surface.GetTextSize(tx)
surface.SetTextPos((w/2) - (tz/2)+ScreenScale(1), ScreenScale(8+1))
surface.SetTextPos((w/2) - (tz/2)+ScreenScale(1), ScreenScale(16+1))
surface.SetTextColor(ARC9.GetHUDColor("shadow"))
surface.DrawText(tx)
surface.SetTextPos((w/2) - (tz/2), ScreenScale(8))
surface.SetTextPos((w/2) - (tz/2), ScreenScale(16))
surface.SetTextColor(ARC9.GetHUDColor("fg"))
surface.DrawText(tx)
end
@ -490,10 +490,10 @@ function SWEP:CreateCustomizeHUD()
surface.SetFont("ARC9_10")
local tx = "Summer break!"
local tz = surface.GetTextSize(tx)
surface.SetTextPos((w/2) - (tz/2)+ScreenScale(1), ScreenScale(8+1))
surface.SetTextPos((w/2) - (tz/2)+ScreenScale(1), ScreenScale(16+1))
surface.SetTextColor(ARC9.GetHUDColor("shadow"))
surface.DrawText(tx)
surface.SetTextPos((w/2) - (tz/2), ScreenScale(8))
surface.SetTextPos((w/2) - (tz/2), ScreenScale(16))
surface.SetTextColor(ARC9.GetHUDColor("fg"))
surface.DrawText(tx)
end
@ -508,10 +508,10 @@ function SWEP:CreateCustomizeHUD()
surface.SetFont("ARC9_10")
local tx = "Happy Halloween!"
local tz = surface.GetTextSize(tx)
surface.SetTextPos((w/2) - (tz/2)+ScreenScale(1), ScreenScale(8+1))
surface.SetTextPos((w/2) - (tz/2)+ScreenScale(1), ScreenScale(16+1))
surface.SetTextColor(ARC9.GetHUDColor("shadow"))
surface.DrawText(tx)
surface.SetTextPos((w/2) - (tz/2), ScreenScale(8))
surface.SetTextPos((w/2) - (tz/2), ScreenScale(16))
surface.SetTextColor(ARC9.GetHUDColor("fg"))
surface.DrawText(tx)
end
@ -563,10 +563,10 @@ function SWEP:CreateCustomizeHUD()
surface.SetFont("ARC9_10")
local tx = "Happy Holidays!"
local tz = surface.GetTextSize(tx)
surface.SetTextPos((w/2) - (tz/2)+ScreenScale(1), ScreenScale(8+1))
surface.SetTextPos((w/2) - (tz/2)+ScreenScale(1), ScreenScale(16+1))
surface.SetTextColor(ARC9.GetHUDColor("shadow"))
surface.DrawText(tx)
surface.SetTextPos((w/2) - (tz/2), ScreenScale(8))
surface.SetTextPos((w/2) - (tz/2), ScreenScale(16))
surface.SetTextColor(ARC9.GetHUDColor("fg"))
surface.DrawText(tx)
end

View File

@ -239,6 +239,8 @@ function SWEP:GetAttBlocked(atttbl)
end
function SWEP:SlotInvalid(slottbl)
if GetConVar("arc9_atts_anarchy"):GetBool() then return false end
local eles = self:GetElements()
if slottbl.ExcludeElements then
@ -367,6 +369,7 @@ function SWEP:GetSlotBlocked(slottbl)
end
function SWEP:CanAttach(addr, att, slottbl)
if GetConVar("arc9_atts_anarchy"):GetBool() then return true end
if GetConVar("arc9_atts_nocustomize"):GetBool() then return false end
slottbl = slottbl or self:LocateSlotFromAddress(addr)

View File

@ -178,6 +178,10 @@ function SWEP:GetProcessedValue(val, base)
return true
end
if owner:IsNPC() then
stat = self:GetValue(val, stat, "NPC")
end
if GetConVar("arc9_truenames"):GetBool() then
stat = self:GetValue(val, stat, "True")
end