mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-28 12:53:02 +05:00
some random fixes
This commit is contained in:
parent
4a8f05dd02
commit
f0617bd0ac
6 changed files with 47 additions and 9 deletions
|
@ -83,14 +83,11 @@ function SWEP:SecondaryAttack()
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("PostDrawTranslucentRenderables", "ShapeGun", function()
|
hook.Add("PostDrawTranslucentRenderables", "ShapeGun", function()
|
||||||
local ply = self:GetOwner()
|
local ply = Entity(1)
|
||||||
|
|
||||||
if not ply:IsValid() then return end
|
|
||||||
|
|
||||||
local wep = ply:GetActiveWeapon()
|
local wep = ply:GetActiveWeapon()
|
||||||
local isShapeDrawer = wep:GetClass() == "shapedrawer"
|
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
|
for _, v in ipairs(wep.points) do
|
||||||
render.DrawWireframeBox(v, angle_zero, Vector(-1, -1, -1), Vector(1, 1, 1))
|
render.DrawWireframeBox(v, angle_zero, Vector(-1, -1, -1), Vector(1, 1, 1))
|
||||||
end
|
end
|
||||||
|
|
|
@ -186,7 +186,7 @@ local spawn = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function PrintAllBars()
|
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 pos, ang = v:GetPos(), v:GetAngles()
|
||||||
local str = "{\"br_swingbar\", Vector(" .. pos.x .. ", " .. pos.y .. ", " .. pos.z .. "), Angle(" .. ang.x .. ", " .. ang.y .. ", " .. ang.z .. ")},"
|
local str = "{\"br_swingbar\", Vector(" .. pos.x .. ", " .. pos.y .. ", " .. pos.z .. "), Angle(" .. ang.x .. ", " .. ang.y .. ", " .. ang.z .. ")},"
|
||||||
print(str)
|
print(str)
|
||||||
|
@ -194,7 +194,7 @@ function PrintAllBars()
|
||||||
end
|
end
|
||||||
|
|
||||||
function PrintAllCampBoxes()
|
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 pos, ang = v:GetPos(), v:GetAngles()
|
||||||
local str = "{\"br_anticampbox\", Vector(" .. pos.x .. ", " .. pos.y .. ", " .. pos.z .. "), Angle(" .. ang.x .. ", " .. ang.y .. ", " .. ang.z .. ")},"
|
local str = "{\"br_anticampbox\", Vector(" .. pos.x .. ", " .. pos.y .. ", " .. pos.z .. "), Angle(" .. ang.x .. ", " .. ang.y .. ", " .. ang.z .. ")},"
|
||||||
print(str)
|
print(str)
|
||||||
|
@ -202,7 +202,7 @@ function PrintAllCampBoxes()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function CreateSpawnEntities()
|
local function CreateSpawnEntities()
|
||||||
for k, v in ipairs(spawn) do
|
for _, v in ipairs(spawn) do
|
||||||
BRProtectedEntity(v[1], v[2], v[3])
|
BRProtectedEntity(v[1], v[2], v[3])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -319,7 +319,7 @@ end
|
||||||
hook.Add("EntityFireBullets", "thisengineismadebyacrackhead", function(ent, data)
|
hook.Add("EntityFireBullets", "thisengineismadebyacrackhead", function(ent, data)
|
||||||
if not IsValid(ent) or not isfunction(ent.GetShootPos) or not ent:IsPlayer() then return end
|
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
|
if ply == ent then continue end
|
||||||
|
|
||||||
local fov = calc_fov(data.Dir:Angle(), (ply:GetShootPos() - data.Src):Angle())
|
local fov = calc_fov(data.Dir:Angle(), (ply:GetShootPos() - data.Src):Angle())
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
function BRProtectedEntity(class, pos, ang)
|
function BRProtectedEntity(class, pos, ang)
|
||||||
local a = ents.Create(class)
|
local a = ents.Create(class)
|
||||||
|
|
||||||
a:SetPos(pos)
|
a:SetPos(pos)
|
||||||
a:SetAngles(ang)
|
a:SetAngles(ang)
|
||||||
a:Spawn()
|
a:Spawn()
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
DEFINE_BASECLASS("gamemode_base")
|
DEFINE_BASECLASS("gamemode_base")
|
||||||
|
|
||||||
|
local entMeta = FindMetaTable("Entity")
|
||||||
|
|
||||||
-- successfully yonked from DarkRP, thanks <3
|
-- successfully yonked from DarkRP, thanks <3
|
||||||
function fp(tbl)
|
function fp(tbl)
|
||||||
local func = tbl[1]
|
local func = tbl[1]
|
||||||
|
@ -16,19 +18,57 @@ function fp(tbl)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local oldPlyColor
|
||||||
|
|
||||||
local function disableBabyGod(ply)
|
local function disableBabyGod(ply)
|
||||||
if not IsValid(ply) or not ply.Babygod then return end
|
if not IsValid(ply) or not ply.Babygod then return end
|
||||||
|
|
||||||
ply.Babygod = nil
|
ply.Babygod = nil
|
||||||
|
|
||||||
|
ply:SetRenderMode(RENDERMODE_NORMAL)
|
||||||
ply:GodDisable()
|
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
|
end
|
||||||
|
|
||||||
local function enableBabyGod(ply)
|
local function enableBabyGod(ply)
|
||||||
timer.Remove(ply:EntIndex() .. "babygod")
|
timer.Remove(ply:EntIndex() .. "babygod")
|
||||||
|
|
||||||
ply.Babygod = true
|
ply.Babygod = true
|
||||||
|
|
||||||
ply:GodEnable()
|
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}))
|
timer.Create(ply:EntIndex() .. "babygod", 5, 1, fp({disableBabyGod, ply}))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue