mirror of
https://github.com/Xerasin/Sit-Anywhere.git
synced 2025-03-04 03:13:07 -05:00
Don't allow picking up sit_holder
This commit is contained in:
parent
120c52ada9
commit
16d12c1b55
@ -66,7 +66,7 @@ function ENT:Think()
|
||||
local seat = self:GetSeat()
|
||||
if CLIENT and IsValid(seat) then
|
||||
local holder, targetPly = self, self:GetTargetPlayer()
|
||||
if not seat.RenderOverride then
|
||||
--[[if not seat.RenderOverride then
|
||||
seat.RenderOverride = function(sSeat)
|
||||
if not sSeat.Draw then return end
|
||||
if not IsValid(holder) or not IsValid(targetPly) then sSeat:Draw() return end
|
||||
@ -76,7 +76,7 @@ function ENT:Think()
|
||||
sSeat:SetRenderAngles(tAng)
|
||||
sSeat:Draw()
|
||||
end
|
||||
end
|
||||
end]]
|
||||
local function drawChildren(seatToCheck, depth)
|
||||
depth = (depth or 0) + 1
|
||||
for k,v in pairs(seatToCheck:GetChildren()) do
|
||||
@ -90,7 +90,7 @@ function ENT:Think()
|
||||
end
|
||||
end
|
||||
if not IsValid(holder) or not IsValid(targetPly) then return end
|
||||
local tPos, tAng = LocalToWorld(holder:GetTargetLocalPos(), holder:GetTargetLocalAng(), targetPly:GetPos(), targetPly:GetRenderAngles())
|
||||
local tPos, tAng = LocalToWorld(holder:GetTargetLocalPos(), holder:GetTargetLocalAng(), targetPly:GetPos(), targetPly:GetRenderAngles() or targetPly:GetAngles() or Angle())
|
||||
seat:SetRenderOrigin(tPos)
|
||||
seat:SetRenderAngles(tAng)
|
||||
|
||||
@ -127,7 +127,8 @@ function ENT:PhysicsSimulate(phys, deltatime)
|
||||
|
||||
local ent = self:GetTargetPlayer()
|
||||
if self:GetActivated() and IsValid(ent) and IsValid(self:GetSeat()) then
|
||||
tPos, tAng = LocalToWorld(self:GetTargetLocalPos(), self:GetTargetLocalAng(), ent.GetRenderOrigin and ent:GetRenderOrigin() or ent:GetPos(), ent:GetRenderAngles())
|
||||
local targetAng = (ent.GetRenderAngles and ent:GetRenderAngles() or ent:GetAngles())
|
||||
tPos, tAng = LocalToWorld(self:GetTargetLocalPos(), self:GetTargetLocalAng(), ent.GetRenderOrigin and ent:GetRenderOrigin() or ent:GetPos(), targetAng or Angle())
|
||||
end
|
||||
|
||||
phys:Wake()
|
||||
@ -138,10 +139,19 @@ function ENT:PhysicsSimulate(phys, deltatime)
|
||||
|
||||
return phys:ComputeShadowControl(self.PhysShadowControl)
|
||||
end
|
||||
function ENT:CanTool() return false end
|
||||
|
||||
if CLIENT then
|
||||
function ENT:Draw()
|
||||
|
||||
end
|
||||
end
|
||||
--easylua.EndEntity()
|
||||
--easylua.EndEntity()
|
||||
|
||||
if SERVER then
|
||||
local function disallow(ent)
|
||||
if IsValid(ent) and ent:GetClass() == "sit_holder" then return false end
|
||||
end
|
||||
hook.Add("GravGunPickupAllowed", "SitAnywhereHolder", function(_, ent) return disallow(ent) end)
|
||||
hook.Add("PhysgunPickup", "SitAnywhereHolder", function(_, ent) return disallow(ent) end)
|
||||
end
|
@ -7,6 +7,10 @@ SitAnywhere.ClassBlacklist = {
|
||||
["gmod_wire_keyboard"] = true,
|
||||
["prop_combine_ball"] = true
|
||||
}
|
||||
|
||||
SitAnywhere.DoNotParent = {
|
||||
["yava_chunk"] = true
|
||||
}
|
||||
SitAnywhere.ModelBlacklist = {
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ local function Sit(ply, pos, ang, parent, parentbone, func, exit)
|
||||
local r = math.rad(ang.yaw + 90)
|
||||
vehicle.plyposhack = vehicle:WorldToLocal(pos + Vector(math.cos(r) * 2, math.sin(r) * 2, 2))
|
||||
|
||||
if parent:IsPlayer() then
|
||||
if parent:IsPlayer() or SitAnywhere.DoNotParent[parent:GetClass()] then
|
||||
vehicle.holder = ents.Create("sit_holder")
|
||||
vehicle.holder:SetPos(pos)
|
||||
vehicle.holder:SetAngles(ang)
|
||||
|
Loading…
Reference in New Issue
Block a user