diff --git a/gamemodes/zombiesurvival/entities/entities/prop_gunturret/cl_init.lua b/gamemodes/zombiesurvival/entities/entities/prop_gunturret/cl_init.lua index 1e60b20..87f3add 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_gunturret/cl_init.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_gunturret/cl_init.lua @@ -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") diff --git a/gamemodes/zombiesurvival/entities/entities/prop_gunturret/shared.lua b/gamemodes/zombiesurvival/entities/entities/prop_gunturret/shared.lua index 3c2f87d..3d76aae 100644 --- a/gamemodes/zombiesurvival/entities/entities/prop_gunturret/shared.lua +++ b/gamemodes/zombiesurvival/entities/entities/prop_gunturret/shared.lua @@ -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 diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_blaster.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_blaster.lua index 8a76710..c12eddb 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_blaster.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_blaster.lua @@ -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) diff --git a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/init.lua b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/init.lua index 1e9169e..fcbc872 100644 --- a/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/init.lua +++ b/gamemodes/zombiesurvival/entities/weapons/weapon_zs_gunturret/init.lua @@ -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") diff --git a/gamemodes/zombiesurvival/gamemode/init.lua b/gamemodes/zombiesurvival/gamemode/init.lua index afd4600..8bcb1a9 100644 --- a/gamemodes/zombiesurvival/gamemode/init.lua +++ b/gamemodes/zombiesurvival/gamemode/init.lua @@ -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") diff --git a/gamemodes/zombiesurvival/gamemode/languages/english.lua b/gamemodes/zombiesurvival/gamemode/languages/english.lua index cbd7a38..c76c1c4 100644 --- a/gamemodes/zombiesurvival/gamemode/languages/english.lua +++ b/gamemodes/zombiesurvival/gamemode/languages/english.lua @@ -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!" diff --git a/gamemodes/zombiesurvival/gamemode/obj_weapon_extend.lua b/gamemodes/zombiesurvival/gamemode/obj_weapon_extend.lua index a976b6f..d892a43 100644 --- a/gamemodes/zombiesurvival/gamemode/obj_weapon_extend.lua +++ b/gamemodes/zombiesurvival/gamemode/obj_weapon_extend.lua @@ -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 diff --git a/gamemodes/zombiesurvival/gamemode/shared.lua b/gamemodes/zombiesurvival/gamemode/shared.lua index ca62e2e..1385361 100644 --- a/gamemodes/zombiesurvival/gamemode/shared.lua +++ b/gamemodes/zombiesurvival/gamemode/shared.lua @@ -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")