Maximum of 7 turrets active at once

Blaster ammo capacity 6 -> 5
This commit is contained in:
JetBoom 2015-03-09 14:26:27 -04:00
parent bd937c290e
commit 33b18089e5
8 changed files with 56 additions and 18 deletions

View file

@ -36,6 +36,12 @@ function ENT:SetObjectHealth(health)
self:SetDTFloat(3, health)
end
local TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER
local draw_SimpleText = draw.SimpleText
local surface_SetDrawColor = surface.SetDrawColor
local surface_DrawRect = surface.DrawRect
local cam_Start3D2D = cam.Start3D2D
local cam_End3D2D = cam.End3D2D
local smokegravity = Vector(0, 0, 200)
local aScreen = Angle(0, 270, 60)
local vScreen = Vector(0, -2, 45)
@ -78,38 +84,41 @@ function ENT:Draw()
local owner = self:GetObjectOwner()
local ammo = self:GetAmmo()
local flash = math.sin(CurTime() * 15) > 0
local wid, hei = 128, 92
cam.Start3D2D(self:LocalToWorld(vScreen), self:LocalToWorldAngles(aScreen), 0.075)
local x = wid / 2
surface.SetDrawColor(0, 0, 0, 160)
surface.DrawRect(0, 0, wid, hei)
cam_Start3D2D(self:LocalToWorld(vScreen), self:LocalToWorldAngles(aScreen), 0.075)
surface.SetDrawColor(200, 200, 200, 160)
surface.DrawRect(0, 0, 8, 16)
surface.DrawRect(wid - 8, 0, 8, 16)
surface.DrawRect(8, 0, wid - 16, 8)
surface_SetDrawColor(0, 0, 0, 160)
surface_DrawRect(0, 0, wid, hei)
surface.DrawRect(0, hei - 16, 8, 16)
surface.DrawRect(wid - 8, hei - 16, 8, 16)
surface.DrawRect(8, hei - 8, wid - 16, 8)
surface_SetDrawColor(200, 200, 200, 160)
surface_DrawRect(0, 0, 8, 16)
surface_DrawRect(wid - 8, 0, 8, 16)
surface_DrawRect(8, 0, wid - 16, 8)
surface_DrawRect(0, hei - 16, 8, 16)
surface_DrawRect(wid - 8, hei - 16, 8, 16)
surface_DrawRect(8, hei - 8, wid - 16, 8)
if owner:IsValid() and owner:IsPlayer() then
draw.SimpleText(owner:ClippedName(), "DefaultFont", wid * 0.5, 10, owner == MySelf and COLOR_BLUE or COLOR_WHITE, TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
draw_SimpleText(owner:ClippedName(), "DefaultFont", x, 10, owner == MySelf and COLOR_BLUE or COLOR_WHITE, TEXT_ALIGN_CENTER)
end
draw.SimpleText(translate.Format("integrity_x", math.ceil(healthpercent * 100)), "DefaultFontBold", wid * 0.5, hei * 0.5, COLOR_WHITE, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
draw_SimpleText(translate.Format("integrity_x", math.ceil(healthpercent * 100)), "DefaultFontBold", x, 25, COLOR_WHITE, TEXT_ALIGN_CENTER)
if flash and self:GetManualControl() then
draw.SimpleText(translate.Get("manual_control"), "DefaultFont", wid * 0.5, hei * 0.325, COLOR_YELLOW, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
draw_SimpleText(translate.Get("manual_control"), "DefaultFont", x, 40, COLOR_YELLOW, TEXT_ALIGN_CENTER)
end
if ammo > 0 then
draw.SimpleText("["..ammo.." / "..self.MaxAmmo.."]", "DefaultFontBold", wid * 0.5, hei - 10, COLOR_WHITE, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
draw_SimpleText("["..ammo.." / "..self.MaxAmmo.."]", "DefaultFontBold", x, 55, COLOR_WHITE, TEXT_ALIGN_CENTER)
elseif flash then
draw.SimpleText(translate.Get("empty"), "DefaultFontBold", wid * 0.5, hei - 10, COLOR_RED, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
draw_SimpleText(translate.Get("empty"), "DefaultFontBold", x, 55, COLOR_RED, TEXT_ALIGN_CENTER)
end
cam.End3D2D()
draw_SimpleText("CH. "..self:GetChannel().." / "..GAMEMODE.MaxChannels[self:GetClass()], "DefaultFontSmall", x, 70, COLOR_WHITE, TEXT_ALIGN_CENTER)
cam_End3D2D()
end
local matBeam = Material("effects/laser1")

View file

@ -187,6 +187,14 @@ function ENT:GetMaxObjectHealth()
return self:GetDTInt(1)
end
function ENT:GetChannel()
return self:GetDTInt(2)
end
function ENT:SetChannel(channel)
self:SetDTInt(2, channel)
end
function ENT:GetTarget()
return self:GetDTEntity(0)
end

View file

@ -27,7 +27,7 @@ SWEP.Primary.Damage = 12
SWEP.Primary.NumShots = 7
SWEP.Primary.Delay = 0.8
SWEP.Primary.ClipSize = 6
SWEP.Primary.ClipSize = 5
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "buckshot"
GAMEMODE:SetupDefaultClip(SWEP.Primary)

View file

@ -51,6 +51,13 @@ function SWEP:PrimaryAttack()
self:SetNextPrimaryAttack(CurTime() + self.Primary.Delay)
local channel = GAMEMODE:GetFreeChannel("prop_gunturret")
if channel == -1 then
owner:SendLua("surface.PlaySound(\"buttons/button8.wav\")")
owner:CenterNotify(COLOR_RED, translate.ClientGet(owner, "no_free_channel"))
return
end
local ent = ents.Create("prop_gunturret")
if ent:IsValid() then
ent:SetPos(pos)
@ -58,6 +65,7 @@ function SWEP:PrimaryAttack()
ent:Spawn()
ent:SetObjectOwner(owner)
ent:SetChannel(channel)
ent:EmitSound("npc/dog/dog_servo12.wav")

View file

@ -25,6 +25,7 @@ AddCSLuaFile("sh_options.lua")
AddCSLuaFile("sh_zombieclasses.lua")
AddCSLuaFile("sh_animations.lua")
AddCSLuaFile("sh_sigils.lua")
AddCSLuaFile("sh_channel.lua")
AddCSLuaFile("cl_draw.lua")
AddCSLuaFile("cl_util.lua")

View file

@ -139,6 +139,7 @@ LANGUAGE.too_close_to_a_spawn = "Too close to a zombie spawn!"
--LANGUAGE.nest_already_being_built = "This nest is already being built by someone else!"
LANGUAGE.x_has_built_this_nest_and_is_still_around = "%s has built this nest and is still around, so you can't demolish it."
LANGUAGE.no_other_nests = "You can't destroy a nest if only one remains."
LANGUAGE.no_free_channel = "Radio interference from too many already being placed!"
-- Sigils point objectives
LANGUAGE.sigil_destroyed = "The Undead have destroyed a Sigil!"

View file

@ -207,12 +207,22 @@ function meta:DrawCrosshairCross()
baserot = math.NormalizeAngle(baserot + vel:GetNormalized():Dot(EyeAngles():Right()) * math.min(10, len / 200))
end
--[[if baserot ~= 0 then
render.PushFilterMag(TEXFILTER.ANISOTROPIC)
render.PushFilterMin(TEXFILTER.ANISOTROPIC)
end]]
local ang = Angle(0, 0, baserot)
for i=0, 359, 360 / 4 do
ang.roll = baserot + i
local p = ang:Up() * midarea
DrawLine(math.Round(x + p.y), math.Round(y + p.z), ang.roll)
end
--[[if baserot ~= 0 then
render.PopFilterMag()
render.PopFilterMin()
end]]
--[[local x = ScrW() * 0.5
local y = ScrH() * 0.5

View file

@ -47,6 +47,7 @@ include("sh_options.lua")
include("sh_zombieclasses.lua")
include("sh_animations.lua")
include("sh_sigils.lua")
include("sh_channel.lua")
include("noxapi/noxapi.lua")