diff --git a/beatrun/gamemodes/beatrun/entities/weapons/shapedrawer/shared.lua b/beatrun/gamemodes/beatrun/entities/weapons/shapedrawer/shared.lua index b661ae3..96532b8 100644 --- a/beatrun/gamemodes/beatrun/entities/weapons/shapedrawer/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/weapons/shapedrawer/shared.lua @@ -83,14 +83,11 @@ function SWEP:SecondaryAttack() end hook.Add("PostDrawTranslucentRenderables", "ShapeGun", function() - local ply = self:GetOwner() - - if not ply:IsValid() then return end - + local ply = Entity(1) local wep = ply:GetActiveWeapon() local isShapeDrawer = wep:GetClass() == "shapedrawer" - if IsValid(wep) and isShapeDrawer then + if IsValid(ply) and IsValid(wep) and isShapeDrawer then for _, v in ipairs(wep.points) do render.DrawWireframeBox(v, angle_zero, Vector(-1, -1, -1), Vector(1, 1, 1)) end diff --git a/beatrun/gamemodes/beatrun/gamemode/Maps/dm_cubix_fix.lua b/beatrun/gamemodes/beatrun/gamemode/Maps/dm_cubix_fix.lua index 7cc192c..a016ce7 100644 --- a/beatrun/gamemodes/beatrun/gamemode/Maps/dm_cubix_fix.lua +++ b/beatrun/gamemodes/beatrun/gamemode/Maps/dm_cubix_fix.lua @@ -186,7 +186,7 @@ local spawn = { } function PrintAllBars() - for k, v in pairs(ents.FindByClass("br_swingbar")) do + for _, v in pairs(ents.FindByClass("br_swingbar")) do local pos, ang = v:GetPos(), v:GetAngles() local str = "{\"br_swingbar\", Vector(" .. pos.x .. ", " .. pos.y .. ", " .. pos.z .. "), Angle(" .. ang.x .. ", " .. ang.y .. ", " .. ang.z .. ")}," print(str) @@ -194,7 +194,7 @@ function PrintAllBars() end function PrintAllCampBoxes() - for k, v in pairs(ents.FindByClass("br_anticampbox")) do + for _, v in pairs(ents.FindByClass("br_anticampbox")) do local pos, ang = v:GetPos(), v:GetAngles() local str = "{\"br_anticampbox\", Vector(" .. pos.x .. ", " .. pos.y .. ", " .. pos.z .. "), Angle(" .. ang.x .. ", " .. ang.y .. ", " .. ang.z .. ")}," print(str) @@ -202,7 +202,7 @@ function PrintAllCampBoxes() end local function CreateSpawnEntities() - for k, v in ipairs(spawn) do + for _, v in ipairs(spawn) do BRProtectedEntity(v[1], v[2], v[3]) end end diff --git a/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua b/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua index 5eac96a..768de6f 100644 --- a/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua +++ b/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua @@ -319,7 +319,7 @@ end hook.Add("EntityFireBullets", "thisengineismadebyacrackhead", function(ent, data) if not IsValid(ent) or not isfunction(ent.GetShootPos) or not ent:IsPlayer() then return end - for i, ply in ipairs(player.GetAll()) do + for _, ply in ipairs(player.GetAll()) do if ply == ent then continue end local fov = calc_fov(data.Dir:Angle(), (ply:GetShootPos() - data.Src):Angle()) diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Misc.lua b/beatrun/gamemodes/beatrun/gamemode/sh/0_Misc.lua similarity index 100% rename from beatrun/gamemodes/beatrun/gamemode/sh/Misc.lua rename to beatrun/gamemodes/beatrun/gamemode/sh/0_Misc.lua diff --git a/beatrun/gamemodes/beatrun/gamemode/sv/MapScript.lua b/beatrun/gamemodes/beatrun/gamemode/sv/MapScript.lua index 7dfcd59..8d82e18 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sv/MapScript.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sv/MapScript.lua @@ -1,5 +1,6 @@ function BRProtectedEntity(class, pos, ang) local a = ents.Create(class) + a:SetPos(pos) a:SetAngles(ang) a:Spawn() diff --git a/beatrun/gamemodes/beatrun/gamemode/sv/spawn.lua b/beatrun/gamemodes/beatrun/gamemode/sv/spawn.lua index 6437d44..b4ea80a 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sv/spawn.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sv/spawn.lua @@ -1,5 +1,7 @@ DEFINE_BASECLASS("gamemode_base") +local entMeta = FindMetaTable("Entity") + -- successfully yonked from DarkRP, thanks <3 function fp(tbl) local func = tbl[1] @@ -16,19 +18,57 @@ function fp(tbl) end end +local oldPlyColor + local function disableBabyGod(ply) if not IsValid(ply) or not ply.Babygod then return end ply.Babygod = nil + + ply:SetRenderMode(RENDERMODE_NORMAL) ply:GodDisable() + + local reinstateOldColor = true + + for _, p in ipairs(player.GetAll()) do + reinstateOldColor = reinstateOldColor and p.Babygod == nil + end + + if reinstateOldColor then + entMeta.SetColor = oldPlyColor + oldPlyColor = nil + end + + ply:SetColor(ply.babyGodColor or color_white) + + ply.babyGodColor = nil end local function enableBabyGod(ply) timer.Remove(ply:EntIndex() .. "babygod") ply.Babygod = true + ply:GodEnable() + ply.babyGodColor = ply:GetColor() + + ply:SetRenderMode(RENDERMODE_TRANSALPHA) + + if not oldPlyColor then + oldPlyColor = entMeta.SetColor + + entMeta.SetColor = function(p, c, ...) + if not p.Babygod then return oldPlyColor(p, c, ...) end + + p.babyGodColor = c + + oldPlyColor(p, Color(c.r, c.g, c.b, 100)) + end + end + + ply:SetColor(ply.babyGodColor) + timer.Create(ply:EntIndex() .. "babygod", 5, 1, fp({disableBabyGod, ply})) end