1
0
mirror of https://github.com/wgetJane/ttt-combattext.git synced 2025-03-04 03:13:18 -05:00

add ttt_combattext_unreliable cvar

This commit is contained in:
Jane 2022-08-22 23:35:06 +08:00
parent ef8efdcf11
commit 3d5728ffb5
3 changed files with 26 additions and 3 deletions

View File

@ -117,6 +117,15 @@ for _, v in ipairs({
updatefont = true
end
},
{
"unreliable", 0,
function(_,_, new)
if updateuserinfo then
updateuserinfo()
end
end,
false, false
},
{
"dingaling", 0,
function(_,_, new)
@ -247,8 +256,11 @@ for _, v in ipairs({
local tk, cv
if v[5] then
if v[5] ~= nil then
fc = fc + FCVAR_USERINFO
end
if v[5] then
tkpfx, cv = "#ttt_combattext." .. v[4] .. ".", "ttt_" .. v[1]
tk = tkpfx .. "enable"
cvpfx = cv .. "_"
@ -711,6 +723,8 @@ local function createsettingstab(panel, onaddform)
add("CheckBox", "antialias")
add("CheckBox", "unreliable")
panel:AddItem(f)
if onaddform then
onaddform(f)
@ -866,6 +880,8 @@ local function createsettingstab(panel, onaddform)
d:AddChoice(le("disguise_choice" .. i), i)
end
add("CheckBox", "npcinfl")
add("CheckBox", "lineofsight")
d = add("ComboBox", "rounding")

View File

@ -86,13 +86,14 @@ local function updateplayerinfo(_, ply)
local cl_cvars = ply.ttt_combattext_cvars
if not cl_cvars then
cl_cvars = {true, false, false}
cl_cvars = {true, false, false, false}
ply.ttt_combattext_cvars = cl_cvars
end
cl_cvars[1] = ply:GetInfoNum("ttt_combattext", 1) == 1
cl_cvars[2] = ply:GetInfoNum("ttt_dingaling", 0) == 1
cl_cvars[3] = ply:GetInfoNum("ttt_dingaling_lasthit", 0) == 1
cl_cvars[4] = ply:GetInfoNum("ttt_combattext_unreliable", 0) == 1
return cl_cvars
end
@ -333,7 +334,7 @@ hook.Add("PostEntityTakeDamage", "ttt_combattext_PostEntityTakeDamage", function
damage = rounding == 1 and math.floor(damage + 0.5)
or (rounding == 2 and math.ceil or math.floor)(damage)
net.Start("ttt_combattext")
net.Start("ttt_combattext", cl_cvars[4])
-- dealing more than 255 damage in one hit is rare, so use only 8 bits by default
local bigint = damage > 255

View File

@ -28,6 +28,9 @@ ttt_combattext.dmgtext.shadow_desc=Draw damage numbers with drop shadows
ttt_combattext.dmgtext.antialias=Text anti-aliasing
ttt_combattext.dmgtext.antialias_desc=Draw damage numbers with smooth text
ttt_combattext.dmgtext.unreliable=Use unreliable net messages
ttt_combattext.dmgtext.unreliable_desc=Use unreliable net messages which are faster and might feel better for automatic weapons at high ping
ttt_combattext.hitsound.title=Hit sound
@ -94,6 +97,9 @@ ttt_combattext.server.disguise_choice0=Show damage text
ttt_combattext.server.disguise_choice1=Don't show damage text
ttt_combattext.server.disguise_choice2=Don't show damage text and don't play hit sound
ttt_combattext.server.npcinfl=Allow NPC inflictors
ttt_combattext.server.npcinfl_desc=Show damage dealt by NPCs on a player's behalf
ttt_combattext.server.lineofsight=Check line of sight
ttt_combattext.server.lineofsight_desc=Don't show damage text if the target cannot be seen