Added point floaters to healing other players.

Added point floaters to healing other players.
Fixed medic aura interfering with transparency radius.
This commit is contained in:
JetBoom 2014-11-09 18:28:31 -05:00
parent 2cef7419fe
commit 8e1e8f6d8f
5 changed files with 52 additions and 17 deletions

View file

@ -0,0 +1,37 @@
EFFECT.LifeTime = 3
function EFFECT:Init(data)
self:SetRenderBounds(Vector(-64, -64, -64), Vector(64, 64, 64))
self.Seed = math.Rand(0, 10)
local pos = data:GetOrigin()
local amount = math.Round(data:GetMagnitude())
self.Pos = pos
self.Amount = amount
self.DeathTime = CurTime() + self.LifeTime
end
function EFFECT:Think()
self.Pos.z = self.Pos.z + FrameTime() * 32
return CurTime() < self.DeathTime
end
local col = Color(30, 255, 30, 255)
local col2 = Color(0, 0, 0, 255)
function EFFECT:Render()
local delta = math.Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime
col.a = delta * 240
col2.a = col.a
local ang = EyeAngles()
local right = ang:Right()
ang:RotateAroundAxis(ang:Up(), -90)
ang:RotateAroundAxis(ang:Forward(), 90)
cam.IgnoreZ(true)
cam.Start3D2D(self.Pos + math.sin(CurTime() + self.Seed) * 30 * delta * right, ang, (delta * 0.12 + 0.045) / 2)
draw.SimpleText(self.Amount, "ZS3D2DFont2Big", 0, -21, col, TEXT_ALIGN_CENTER)
cam.End3D2D()
cam.IgnoreZ(false)
end

View file

@ -108,12 +108,6 @@ function SWEP:SecondaryAttack()
end
end
--[[function SWEP:Initialize()
if CLIENT and self:GetOwner() == LocalPlayer() and LocalPlayer():GetActiveWeapon() == self then
hook.Add("PostPlayerDraw", "PostPlayerDrawMedical", GAMEMODE.PostPlayerDrawMedical)
end
end]]
function SWEP:Deploy()
gamemode.Call("WeaponDeployed", self.Owner, self)
@ -121,6 +115,7 @@ function SWEP:Deploy()
if CLIENT then
hook.Add("PostPlayerDraw", "PostPlayerDrawMedical", GAMEMODE.PostPlayerDrawMedical)
GAMEMODE.MedicalAura = true
end
return true
@ -129,6 +124,7 @@ end
function SWEP:Holster()
if CLIENT then
hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical")
GAMEMODE.MedicalAura = false
end
return true

View file

@ -80,12 +80,6 @@ function SWEP:ShootBullets(dmg, numbul, cone)
end
end
--[[function SWEP:Initialize()
if CLIENT and self:GetOwner() == LocalPlayer() and LocalPlayer():GetActiveWeapon() == self then
hook.Add("PostPlayerDraw", "PostPlayerDrawMedical", GAMEMODE.PostPlayerDrawMedical)
end
end]]
function SWEP:Deploy()
gamemode.Call("WeaponDeployed", self.Owner, self)
@ -93,6 +87,7 @@ function SWEP:Deploy()
if CLIENT then
hook.Add("PostPlayerDraw", "PostPlayerDrawMedical", GAMEMODE.PostPlayerDrawMedical)
GAMEMODE.MedicalAura = true
end
return true
@ -101,6 +96,7 @@ end
function SWEP:Holster()
if CLIENT then
hook.Remove("PostPlayerDraw", "PostPlayerDrawMedical")
GAMEMODE.MedicalAura = false
end
return true

View file

@ -15,7 +15,7 @@ function GM:ReceivedCommission(crate, buyer, points)
end
function GM:HealedOtherPlayer(other, points)
gamemode.Call("FloatingScore", other, "floatingscore", points)
gamemode.Call("FloatingScore", other, "floatingscore_heal", points, nil, true)
end
function GM:RepairedObject(other, points)
@ -23,10 +23,16 @@ function GM:RepairedObject(other, points)
end
local cvarNoFloatingScore = CreateClientConVar("zs_nofloatingscore", 0, true, false)
function GM:FloatingScore(victim, effectname, frags, flags)
function GM:FloatingScore(victim, effectname, frags, flags, override_allow)
if cvarNoFloatingScore:GetBool() then return end
local isvec = type(victim) == "Vector"
if cvarNoFloatingScore:GetBool() or not isvec and (not victim:IsValid() or victim:IsPlayer() and victim:Team() == MySelf:Team()) then return end
if not isvec then
if not victim:IsValid() or victim:IsPlayer() and victim:Team() == MySelf:Team() and not override_allow then
return
end
end
effectname = effectname or "floatingscore"

View file

@ -127,7 +127,7 @@ local draw_SimpleTextBlurry = draw.SimpleTextBlurry
local draw_SimpleTextBlur = draw.SimpleTextBlur
local draw_GetFontHeight = draw.GetFontHeight
local MedicalAuraDistance = 400
local MedicalAuraDistance = 300
GM.LifeStatsBrainsEaten = 0
GM.LifeStatsHumanDamage = 0
@ -1337,7 +1337,7 @@ function GM:_PrePlayerDraw(pl)
if pl.status_overridemodel and pl.status_overridemodel:IsValid() and self:ShouldDrawLocalPlayer(MySelf) then -- We need to do this otherwise the player's real model shows up for some reason.
undomodelblend = true
render.SetBlend(0)
elseif MySelf:Team() == TEAM_HUMAN and pl ~= MySelf and pl:Team() == TEAM_HUMAN then
elseif MySelf:Team() == TEAM_HUMAN and pl ~= MySelf and pl:Team() == TEAM_HUMAN and not self.MedicalAura then
local radius = self.TransparencyRadius
if radius > 0 then
local eyepos = EyePos()