zombiesurvival-evolved/gamemodes/zombiesurvival/gamemode/vgui/zshealtharea.lua

125 lines
3.9 KiB
Lua
Raw Permalink Normal View History

2014-10-02 08:49:54 +08:00
local PANEL = {}
local matGlow = Material("sprites/glow04_noz")
local texDownEdge = surface.GetTextureID("gui/gradient_down")
2014-10-02 08:49:54 +08:00
local colHealth = Color(0, 0, 0, 240)
local function ContentsPaint(self, w, h)
local lp = MySelf
2014-10-02 08:49:54 +08:00
if lp:IsValid() then
local screenscale = BetterScreenScale()
2014-10-02 08:49:54 +08:00
local health = math.max(lp:Health(), 0)
local healthperc = math.Clamp(health / lp:GetMaxHealthEx(), 0, 1)
local wid, hei = 300 * screenscale, 18 * screenscale
2014-10-02 08:49:54 +08:00
colHealth.r = (1 - healthperc) * 180
colHealth.g = healthperc * 180
colHealth.b = 0
2014-10-02 08:49:54 +08:00
local x = 18 * screenscale
local y = 115 * screenscale
2014-10-02 08:49:54 +08:00
local subwidth = healthperc * wid
2014-10-02 08:49:54 +08:00
draw.SimpleTextBlurry(health, "ZSHUDFont", x + wid + 12 * screenscale, y + 8 * screenscale, colHealth, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
2014-10-02 08:49:54 +08:00
surface.SetDrawColor(0, 0, 0, 230)
surface.DrawRect(x, y, wid, hei)
Merge with current nox changes. Random starting loadouts now include things that aren't weapons (ammo, traits, etc.). Added an option to disable the automatic suicide when changing zombie classes. Zombies will no longer receive damage resistance when only one human remains. Players can no longer claim the arsenal crate that gets spawned in the human spawn when nobody has one. Any player can pack it up though. The Ghoul's ghoul touch special ability has been changed. It will no longer slow targets but will debuff them for the next 10 seconds. They will take 40% more damage (the extra damage is attributed to the person who ghoul touched them last) for the next 10 seconds as well as slightly disorienting them. The Ghoul movement speed has been reduced from 185 to 170. Added crafting recipe: 'Waraxe' Handgun. Combine two 'Battleaxe' Handguns to craft this. Slightly better version of the Owens. The Flesh Creeper model has been changed to one that doesn't have severely awkward hitboxes. The Flesh Creeper can no longer jump and attack at the same time. The Lead Pipe special trait has been changed from a disorientation to a severe view punch/snap on a global cooldown of 1.5 seconds. The Regenerative trait is now 1 health every 6 seconds under 50% health instead of 1 health every 5 seconds under 50% health. Fast Zombie Legs have been changed to be a slightly faster but slightly weaker version of Zombie Legs. Zombies that have just spawned or enter zombie gas will now have a temporary buff which gives 25% extra speed and 40% damage resistance. This buff lasts for 3 seconds and is refreshed by entering the gas. Gas will no longer heal. Zombies with this buff on will strobe dark green. Added crafting recipe: Bladehack. Combine a saw blade with a manhack to get this. Slower but has more health, does more damage, and has less of a knockback when hitting something. Resupply Boxes now award the owner a point for every 2 people who use their box instead of every single person (so half as many points). Fixed Fast Zombie Legs spawning much more abundantly than intended. Fixed Flesh Creepers not being able to jump over obstacles due to their insanely low jump height. Fixed zombies taking themselves in to account when calculating horde damage resistance (bosses always had full resistance because of this). Fixed allowing people to use worth menu after redeeming.
2014-11-07 13:03:40 +08:00
surface.SetDrawColor(colHealth.r * 0.6, colHealth.g * 0.6, colHealth.b, 160)
surface.SetTexture(texDownEdge)
surface.DrawTexturedRect(x + 2, y + 1, subwidth - 4, hei - 2)
surface.SetDrawColor(colHealth.r * 0.6, colHealth.g * 0.6, colHealth.b, 30)
surface.DrawRect(x + 2, y + 1, subwidth - 4, hei - 2)
2014-10-02 08:49:54 +08:00
surface.SetMaterial(matGlow)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRect(x + 2 + subwidth - 6, y + 1 - hei/2, 4, hei * 2)
Merge with current nox changes. Random starting loadouts now include things that aren't weapons (ammo, traits, etc.). Added an option to disable the automatic suicide when changing zombie classes. Zombies will no longer receive damage resistance when only one human remains. Players can no longer claim the arsenal crate that gets spawned in the human spawn when nobody has one. Any player can pack it up though. The Ghoul's ghoul touch special ability has been changed. It will no longer slow targets but will debuff them for the next 10 seconds. They will take 40% more damage (the extra damage is attributed to the person who ghoul touched them last) for the next 10 seconds as well as slightly disorienting them. The Ghoul movement speed has been reduced from 185 to 170. Added crafting recipe: 'Waraxe' Handgun. Combine two 'Battleaxe' Handguns to craft this. Slightly better version of the Owens. The Flesh Creeper model has been changed to one that doesn't have severely awkward hitboxes. The Flesh Creeper can no longer jump and attack at the same time. The Lead Pipe special trait has been changed from a disorientation to a severe view punch/snap on a global cooldown of 1.5 seconds. The Regenerative trait is now 1 health every 6 seconds under 50% health instead of 1 health every 5 seconds under 50% health. Fast Zombie Legs have been changed to be a slightly faster but slightly weaker version of Zombie Legs. Zombies that have just spawned or enter zombie gas will now have a temporary buff which gives 25% extra speed and 40% damage resistance. This buff lasts for 3 seconds and is refreshed by entering the gas. Gas will no longer heal. Zombies with this buff on will strobe dark green. Added crafting recipe: Bladehack. Combine a saw blade with a manhack to get this. Slower but has more health, does more damage, and has less of a knockback when hitting something. Resupply Boxes now award the owner a point for every 2 people who use their box instead of every single person (so half as many points). Fixed Fast Zombie Legs spawning much more abundantly than intended. Fixed Flesh Creepers not being able to jump over obstacles due to their insanely low jump height. Fixed zombies taking themselves in to account when calculating horde damage resistance (bosses always had full resistance because of this). Fixed allowing people to use worth menu after redeeming.
2014-11-07 13:03:40 +08:00
local phantomhealth = math.max(lp:GetPhantomHealth(), 0)
healthperc = math.Clamp(phantomhealth / lp:GetMaxHealthEx(), 0, 1)
2014-10-02 08:49:54 +08:00
colHealth.r = 100
colHealth.g = 90
colHealth.b = 80
local phantomwidth = healthperc * wid
Merge with current nox changes. Random starting loadouts now include things that aren't weapons (ammo, traits, etc.). Added an option to disable the automatic suicide when changing zombie classes. Zombies will no longer receive damage resistance when only one human remains. Players can no longer claim the arsenal crate that gets spawned in the human spawn when nobody has one. Any player can pack it up though. The Ghoul's ghoul touch special ability has been changed. It will no longer slow targets but will debuff them for the next 10 seconds. They will take 40% more damage (the extra damage is attributed to the person who ghoul touched them last) for the next 10 seconds as well as slightly disorienting them. The Ghoul movement speed has been reduced from 185 to 170. Added crafting recipe: 'Waraxe' Handgun. Combine two 'Battleaxe' Handguns to craft this. Slightly better version of the Owens. The Flesh Creeper model has been changed to one that doesn't have severely awkward hitboxes. The Flesh Creeper can no longer jump and attack at the same time. The Lead Pipe special trait has been changed from a disorientation to a severe view punch/snap on a global cooldown of 1.5 seconds. The Regenerative trait is now 1 health every 6 seconds under 50% health instead of 1 health every 5 seconds under 50% health. Fast Zombie Legs have been changed to be a slightly faster but slightly weaker version of Zombie Legs. Zombies that have just spawned or enter zombie gas will now have a temporary buff which gives 25% extra speed and 40% damage resistance. This buff lasts for 3 seconds and is refreshed by entering the gas. Gas will no longer heal. Zombies with this buff on will strobe dark green. Added crafting recipe: Bladehack. Combine a saw blade with a manhack to get this. Slower but has more health, does more damage, and has less of a knockback when hitting something. Resupply Boxes now award the owner a point for every 2 people who use their box instead of every single person (so half as many points). Fixed Fast Zombie Legs spawning much more abundantly than intended. Fixed Flesh Creepers not being able to jump over obstacles due to their insanely low jump height. Fixed zombies taking themselves in to account when calculating horde damage resistance (bosses always had full resistance because of this). Fixed allowing people to use worth menu after redeeming.
2014-11-07 13:03:40 +08:00
surface.SetDrawColor(colHealth.r, colHealth.g, colHealth.b, 160)
surface.SetTexture(texDownEdge)
surface.DrawTexturedRect(x + 2 + subwidth - 4, y + 1, phantomwidth, hei - 2)
surface.SetDrawColor(colHealth.r, colHealth.g, colHealth.b, 30)
surface.DrawRect(x + 2 + subwidth - 4, y + 1, phantomwidth, hei - 2)
Merge with current nox changes. Random starting loadouts now include things that aren't weapons (ammo, traits, etc.). Added an option to disable the automatic suicide when changing zombie classes. Zombies will no longer receive damage resistance when only one human remains. Players can no longer claim the arsenal crate that gets spawned in the human spawn when nobody has one. Any player can pack it up though. The Ghoul's ghoul touch special ability has been changed. It will no longer slow targets but will debuff them for the next 10 seconds. They will take 40% more damage (the extra damage is attributed to the person who ghoul touched them last) for the next 10 seconds as well as slightly disorienting them. The Ghoul movement speed has been reduced from 185 to 170. Added crafting recipe: 'Waraxe' Handgun. Combine two 'Battleaxe' Handguns to craft this. Slightly better version of the Owens. The Flesh Creeper model has been changed to one that doesn't have severely awkward hitboxes. The Flesh Creeper can no longer jump and attack at the same time. The Lead Pipe special trait has been changed from a disorientation to a severe view punch/snap on a global cooldown of 1.5 seconds. The Regenerative trait is now 1 health every 6 seconds under 50% health instead of 1 health every 5 seconds under 50% health. Fast Zombie Legs have been changed to be a slightly faster but slightly weaker version of Zombie Legs. Zombies that have just spawned or enter zombie gas will now have a temporary buff which gives 25% extra speed and 40% damage resistance. This buff lasts for 3 seconds and is refreshed by entering the gas. Gas will no longer heal. Zombies with this buff on will strobe dark green. Added crafting recipe: Bladehack. Combine a saw blade with a manhack to get this. Slower but has more health, does more damage, and has less of a knockback when hitting something. Resupply Boxes now award the owner a point for every 2 people who use their box instead of every single person (so half as many points). Fixed Fast Zombie Legs spawning much more abundantly than intended. Fixed Flesh Creepers not being able to jump over obstacles due to their insanely low jump height. Fixed zombies taking themselves in to account when calculating horde damage resistance (bosses always had full resistance because of this). Fixed allowing people to use worth menu after redeeming.
2014-11-07 13:03:40 +08:00
if lp:Team() == TEAM_HUMAN then
local bloodarmor = lp:GetBloodArmor()
if bloodarmor > 0 then
x = 78 * screenscale
y = 142 * screenscale
wid, hei = 240 * screenscale, 14 * screenscale
2014-10-02 08:49:54 +08:00
healthperc = math.Clamp(bloodarmor / (lp.MaxBloodArmor or 10), 0, 1)
colHealth.r = 50 + healthperc * 205
colHealth.g = 0
colHealth.b = (1 - healthperc) * 50
2014-10-02 08:49:54 +08:00
subwidth = healthperc * wid
2014-10-02 08:49:54 +08:00
draw.SimpleTextBlurry(bloodarmor, "ZSHUDFontSmall", x + wid + 12 * screenscale, y + 8 * screenscale, colHealth, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
2014-10-02 08:49:54 +08:00
surface.SetDrawColor(0, 0, 0, 230)
surface.DrawRect(x, y, wid, hei)
2014-10-02 08:49:54 +08:00
surface.SetDrawColor(colHealth.r * 0.6, colHealth.g * 0.6, colHealth.b, 160)
surface.SetTexture(texDownEdge)
surface.DrawTexturedRect(x + 2, y + 1, subwidth - 4, hei - 2)
surface.SetDrawColor(colHealth.r * 0.5, colHealth.g * 0.5, colHealth.b, 30)
surface.DrawRect(x + 2, y + 1, subwidth - 4, hei - 2)
2014-10-02 08:49:54 +08:00
surface.SetMaterial(matGlow)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRect(x + 2 + subwidth - 6, y + 1 - hei/2, 4, hei * 2)
2014-10-02 08:49:54 +08:00
end
end
end
end
function PANEL:Init()
self:DockMargin(0, 0, 0, 0)
self:DockPadding(0, 0, 0, 0)
2014-10-02 08:49:54 +08:00
local contents = vgui.Create("Panel", self)
contents:Dock(FILL)
contents.Paint = ContentsPaint
2014-10-02 08:49:54 +08:00
self:ParentToHUD()
self:InvalidateLayout()
2014-10-02 08:49:54 +08:00
end
function PANEL:PerformLayout()
local screenscale = BetterScreenScale()
2014-10-02 08:49:54 +08:00
self:SetSize(screenscale * 500, screenscale * 168)
2014-10-02 08:49:54 +08:00
self:AlignLeft()
self:AlignBottom()
2014-10-02 08:49:54 +08:00
end
local matGradientLeft = CreateMaterial("gradient-l", "UnlitGeneric", {["$basetexture"] = "vgui/gradient-l", ["$vertexalpha"] = "1", ["$vertexcolor"] = "1", ["$ignorez"] = "1", ["$nomip"] = "1"})
function PANEL:Paint(w, h)
local y = h * 0.6
h = h - y
2014-10-02 08:49:54 +08:00
surface.SetDrawColor(0, 0, 0, 180)
surface.DrawRect(0, y, w * 0.4, h + 1)
surface.SetMaterial(matGradientLeft)
surface.DrawTexturedRect(w * 0.4, y, w * 0.6, h + 1)
2014-10-02 08:49:54 +08:00
--surface.DrawLine(0, y, w, y)
surface.SetDrawColor(0, 0, 0, 250)
surface.SetMaterial(matGradientLeft)
surface.DrawTexturedRect(0, y, w, 1)
2014-10-02 08:49:54 +08:00
return true
2014-10-02 08:49:54 +08:00
end
vgui.Register("ZSHealthArea", PANEL, "Panel")