diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_rabbitfrog/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_rabbitfrog/shared.lua deleted file mode 100644 index e171770..0000000 --- a/beatrun/gamemodes/beatrun/entities/entities/br_rabbitfrog/shared.lua +++ /dev/null @@ -1,266 +0,0 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Rabbitfrog" -ENT.Author = "" -ENT.Category = "Beatrun" - -ENT.Information = "" -ENT.Spawnable = true -ENT.RenderGroup = RENDERGROUP_OPAQUE - -AddCSLuaFile() - -ENT.Model = "models/nt/props_vehicles/rabbitfrog_dynamic.mdl" -ENT.AutomaticFrameAdvance = true - -function ENT:SetupDataTables() - self:NetworkVar("Entity", 0, "Passenger1") - self:NetworkVar("Entity", 1, "Passenger2") - self:NetworkVar("Entity", 2, "Passenger3") - self:NetworkVar("Entity", 3, "Passenger4") - self:NetworkVar("Vector", 0, "DestinationPos") - self:NetworkVar("Angle", 1, "DestinationAngle") -end - --- local mins, maxs = Vector(-64, -64, 0), Vector(64, 64, 154) - -function ENT:Initialize() - self:SetModel(self.Model) - -- self:SetMoveType(MOVETYPE_NONE) - -- self:SetSolid(SOLID_BBOX) - -- self:SetCollisionBounds(mins, maxs) - - if SERVER then - self:PhysicsInit(SOLID_VPHYSICS) - end - - self:SetMoveType(MOVETYPE_VPHYSICS) - self:ResetSequence(1) - - if SERVER then - self:SetUseType(SIMPLE_USE) - end -end - -function ENT:OnRemove() -end - -function ENT:UpdateTransmitState() - return TRANSMIT_ALWAYS -end - -function ENT:Think() - self:NextThink(CurTime()) - - return true -end - -local blur = Material("pp/blurscreen") - -local function draw_blur(a, d) - surface.SetDrawColor(255, 255, 255) - surface.SetMaterial(blur) - - for i = 1, d do - blur:SetFloat("$blur", (i / d) * a) - blur:Recompute() - - render.UpdateScreenEffectTexture() - surface.DrawTexturedRect(0, 0, ScrW(), ScrH()) - end -end - -local blurint = 4 --- local rabbitpos, rabbitang = Vector(), Angle() - -local landseq = { - [1] = true, - [4] = true -} - --- local initseq = 1 --- local offset = Vector(-30, 5, 0) --- local offsetdraw = Vector(0, 70, 0) --- local angoffset = Angle(0, 90, 90) --- local lastpos = Vector() --- local lastang = Angle() --- local endlerp = 0 --- local endlerppos = Vector() --- local neweye = false --- local fx = false -local diff = 1 - -local function IsLanding(ent) - return landseq[ent:GetSequence()] or false -end - -local introalpha = 255 - -local function LandingHUDPaint() - introalpha = introalpha - (FrameTime() * 50) - - surface.SetDrawColor(0, 0, 0, introalpha) - surface.DrawRect(0, 0, ScrW(), ScrH()) - - if introalpha <= 0 then - hook.Remove("HUDPaint", "LandingHUDPaint") - end -end - -local function LandingHUDIntro() - introalpha = 255 - hook.Add("HUDPaint", "LandingHUDPaint", LandingHUDPaint) -end - -local function LandingIntro() - fx = false - neweye = false - endlerp = 0 - surface.PlaySound("hopperland.mp3") - LandingHUDIntro() -end - - -function ENT:Draw() - -- Reset everything to known good - render.SetStencilWriteMask(0xFF) - render.SetStencilTestMask(0xFF) - render.SetStencilReferenceValue(0) - -- render.SetStencilCompareFunction( STENCIL_ALWAYS ) - render.SetStencilPassOperation(STENCIL_KEEP) - -- render.SetStencilFailOperation( STENCIL_KEEP ) - render.SetStencilZFailOperation(STENCIL_KEEP) - render.ClearStencil() - - render.SetStencilEnable(true) -- Enable stencils - render.SetStencilReferenceValue(1) -- Set the reference value to 1. This is what the compare function tests against - render.SetStencilCompareFunction(STENCIL_NEVER) -- Force everything to fail - render.SetStencilFailOperation(STENCIL_REPLACE) -- Save all the things we don't draw - - self:DrawModel() -- Fail to draw our entities. - - render.SetStencilCompareFunction(STENCIL_EQUAL) -- Render all pixels that don't have their stencil value as 1 - render.SetStencilFailOperation(STENCIL_KEEP) -- Don't modify the stencil buffer when things fail - - -- for _, ent in pairs( ents.FindByClass( "sent_stencil_test_big" ) ) do - render.PushFilterMag(TEXFILTER.ANISOTROPIC) -- Draw our big entities. They will have holes in them wherever the smaller entities were - render.PushFilterMin(TEXFILTER.ANISOTROPIC) - self:DrawModel() - cam.Start2D(vector_origin, angle_zero) - draw_blur(math.max(blurint * -diff, 0), 5) - -- DrawBokehDOF(5,0.99,8) - render.PopFilterMag() - render.PopFilterMin() - cam.End2D() - -- end - - render.SetStencilEnable(false) -- Let everything render normally again -end - - -local function RabbitCalcView(ply, origin, ang) - local rabbit = ply:GetRabbit() - - if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then - if rabbit:GetCycle() < 1 then - util.ScreenShake(vector_origin, 1, 100, 0.5, 0) - end - - local matrix = rabbit:GetBoneMatrix(0) - local pos = matrix:GetTranslation() - local angles = matrix:GetAngles() - local npos, _ = LocalToWorld(offset, angles, pos, angles) - angles:Sub(angoffset) - angles.x = -angles.x - angles.y = angles.y - 90 - angles.z = angles.x - - local oldangx = ang.x - ang.x = 0 - - diff = ang:Forward():Dot(angles:Right()) - - local absdiff = math.abs(diff) - ang.x = oldangx - angles.z = angles.z * absdiff - -- angles.x = angles.x * absdiff - -- angles.x = angles.x*ang:Forward():Dot(ang:Forward()) - -- angles.z = angles.z*math.abs(ang:Forward():Dot(ang:Forward())) - - pos:Set(npos) - origin:Set(pos) - ang:Add(angles) - lastpos:Set(origin) - lastang:Set(ang) - elseif endlerp < 1 then - if not neweye then - lastang.z = 0 - - ang:Set(lastang) - - ply:SetEyeAngles(lastang) - neweye = true - - ply:CLViewPunch(Angle(12, 0, 0)) - - if VManip then - VManip:PlayAnim("vault") - end - end - - origin:Set(LerpVector(endlerp, lastpos, origin)) - - endlerp = endlerp + (FrameTime() * 4) - - endlerppos:Set(origin) - end -end - -local function RabbitVM(wep, vm, oldpos, oldang, pos, ang) - local rabbit = LocalPlayer():GetRabbit() - local diffpos = pos - oldpos - local diffang = ang - oldang - - if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then - pos:Set(lastpos) - ang:Set(lastang) - pos:Sub(diffpos) - ang:Sub(diffang) - elseif endlerp < 1 then - pos:Set(endlerppos) - end -end - --- hook.Add("CalcViewModelView", "RabbitVM", RabbitVM) - --- hook.Add("BeatrunDrawHUD", "Rabbit", function() --- if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then return false end --- end) - -function ENT:Use(ply, caller, usetype, value) - if not ply:IsPlayer() then return end - - print("hi") - - ply:SetRabbit(self) - ply:SetRabbitSeat(1) -end - --- hook.Add("CalcViewModelView", "RabbitVM", RabbitVM) --- hook.Add("CalcView", "RabbitCalcView", RabbitCalcView) - - -local function RabbitPlayerMove(ply, mv, cmd) - local rabbit = ply:GetRabbit() - - if IsValid(rabbit) then - local matrix = rabbit:GetBoneMatrix(0) - local pos = matrix:GetTranslation() - ply:GetViewOffset() - local angles = matrix:GetAngles() - local npos, _ = LocalToWorld(offset, angles, pos, angles) - ply:SetMoveType(MOVETYPE_NOCLIP) - mv:SetOrigin(npos) - end -end - --- hook.Add("SetupMove", "RabbitPlayerMove", RabbitPlayerMove) \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua b/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua index 86a204e..af0c0db 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua @@ -56,8 +56,8 @@ hook.Add("RenderScreenspaceEffects", "BeatrunNoclipBW", function() color = math.Approach(color, 1, RealFrameTime() * 2) end - if LocalPlayer():Health() < 100 then - tab["$pp_colour_colour"] = math.max(LocalPlayer():Health() / LocalPlayer():GetMaxHealth(), 0) + if ply:Health() < 100 then + tab["$pp_colour_colour"] = math.max(ply:Health() / ply:GetMaxHealth(), 0) DrawColorModify(tab) end end) @@ -131,20 +131,22 @@ local function BeatrunHUD() surface.SetFont("DebugFixedSmall") - local tw, _ = surface.GetTextSize("v" .. VERSIONGLOBAL) + local version_text = "v" .. VERSIONGLOBAL + local tw, _ = surface.GetTextSize(version_text) surface.SetTextColor(255, 255, 255, 20) surface.SetTextPos(scrw - tw, 0) - surface.DrawText("v" .. VERSIONGLOBAL) + surface.DrawText(version_text) surface.SetFont("BeatrunHUD") if file.Exists("beatrun/version.txt", "DATA") then local latest_version = file.Read("beatrun/version.txt", "DATA") if latest_version ~= VERSIONGLOBAL then - local notlatest_w, _ = surface.GetTextSize("Update available!") + local update_text = "Update available!" + local notlatest_w, _ = surface.GetTextSize(update_text) surface.SetTextColor(255, 255, 255, 30) surface.SetTextPos(scrw - notlatest_w, 10) - surface.DrawText("Update available!") + surface.DrawText(update_text) surface.SetFont("BeatrunHUD") end end @@ -216,7 +218,7 @@ local function BeatrunHUD() hidealpha = 0 end - local corner_color_c = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDCornerColor")) + local corner_color_c = string.ToColor(ply:GetInfo("Beatrun_HUDCornerColor")) corner_color_c.a = math.Clamp(corner_color_c.a + 50, 0, 255) corner_color_c.a = dynamic:GetBool() and math.max(150 - hidealpha, 50) or corner_color_c.a @@ -225,10 +227,10 @@ local function BeatrunHUD() DrawBlurRect(20 + vp.z, scrh * 0.895 + vp.x, SScaleX(bgpadding), SScaleY(85), math.max(255 - hidealpha, 2)) - local corner_color = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDCornerColor")) + local corner_color = string.ToColor(ply:GetInfo("Beatrun_HUDCornerColor")) corner_color.a = dynamic:GetBool() and math.max(100 - hidealpha, 50) or corner_color.a - local text_color = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDTextColor")) + local text_color = string.ToColor(ply:GetInfo("Beatrun_HUDTextColor")) text_color.a = dynamic:GetBool() and math.max(255 - hidealpha, 2) or text_color.a surface.SetDrawColor(corner_color) @@ -241,16 +243,16 @@ local function BeatrunHUD() if verificationstats:GetBool() then surface.SetTextPos(scrw * 0.015 + vp.z, scrh * 0.02 + vp.x) surface.DrawText("Purist: ") - surface.DrawText(LocalPlayer():GetInfo("Beatrun_PuristMode") == "1" and "true" or "false") + surface.DrawText(ply:GetInfo("Beatrun_PuristMode") == "1" and "true" or "false") surface.SetTextPos(scrw * 0.015 + vp.z, scrh * 0.04 + vp.x) surface.DrawText("Purist Wallrun: ") - surface.DrawText(LocalPlayer():GetInfo("Beatrun_PuristWallrun") == "1" and "true" or "false") + surface.DrawText(ply:GetInfo("Beatrun_PuristWallrun") == "1" and "true" or "false") surface.SetTextPos(scrw * 0.015 + vp.z, scrh * 0.06 + vp.x) surface.DrawText("Kick Glitch: ") - surface.DrawText(LocalPlayer():GetInfo("Beatrun_OldKickGlitch") == "1" and "Old" or "New") + surface.DrawText(ply:GetInfo("Beatrun_OldKickGlitch") == "1" and "Old" or "New") end - if tobool(LocalPlayer():GetInfo("Beatrun_PuristMode")) then + if tobool(ply:GetInfo("Beatrun_PuristMode")) then surface.SetDrawColor(230, 230, 230) surface.SetMaterial(MELogo) surface.DrawTexturedRect(scrw * 0.00125 + vp.z, scrh * 0.9 + vp.x + SScaleY(16) * 0.25, SScaleX(16), SScaleY(16)) @@ -264,11 +266,11 @@ local function BeatrunHUD() surface.DrawText(nicktext) surface.SetDrawColor(25, 25, 25, math.max(255 - hidealpha, 2)) surface.DrawRect(scrw * 0.015 + vp.z, scrh * 0.94 + 1 + vp.x, SScaleX(150), SScaleY(4)) - surface.SetDrawColor(string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDTextColor")), math.max(255 - hidealpha, 2)) + surface.SetDrawColor(string.ToColor(ply:GetInfo("Beatrun_HUDTextColor")), math.max(255 - hidealpha, 2)) surface.DrawRect(scrw * 0.015 + vp.z, scrh * 0.94 + vp.x, SScaleX(150 * math.min(ply:GetLevelRatio(), 1)), SScaleY(5)) for k, v in pairs(XP_floatingxp) do - local floating_color = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDFloatingXPColor")) + local floating_color = string.ToColor(ply:GetInfo("Beatrun_HUDFloatingXPColor")) floating_color.a = math.Clamp(1000 * math.abs(CurTime() - k) / 5 - hidealpha, 0, 255) surface.SetFont("BeatrunHUD") @@ -282,7 +284,7 @@ local function BeatrunHUD() end end - local text_color_c = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDTextColor")) + local text_color_c = string.ToColor(ply:GetInfo("Beatrun_HUDTextColor")) text_color_c.a = text_color_c.a - 55 text_color_c.a = dynamic:GetBool() and math.max(200 - hidealpha, 2) or text_color_c.a