Skip to content

Commit d7e3093

Browse files
committed
Minor improvements
1 parent 7ba62fd commit d7e3093

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

lua/fpp/sh_cppi.lua

+8-15
Original file line numberDiff line numberDiff line change
@@ -62,38 +62,33 @@ if SERVER then
6262

6363
function ENTITY:CPPISetOwnerUID(UID)
6464
local ply = UID and player.GetByUniqueID(tostring(UID)) or nil
65-
if UID and not IsValid(ply) then return false end
65+
if UID and not ply then return false end
6666
return self:CPPISetOwner(ply)
6767
end
6868

6969
function ENTITY:CPPICanTool(ply, tool)
7070
local cantool = FPP.Protect.CanTool(ply, nil, tool, self)
71-
if cantool == nil then cantool = true end
72-
return cantool
71+
return cantool == nil and true or cantool
7372
end
7473

7574
function ENTITY:CPPICanPhysgun(ply)
7675
local canphysgun = FPP.Protect.PhysgunPickup(ply, self)
77-
if canphysgun == nil then canphysgun = true end
78-
return canphysgun
76+
return canphysgun == nil and true or canphysgun
7977
end
8078

8179
function ENTITY:CPPICanPickup(ply)
8280
local canpickup = FPP.Protect.CanGravGunPickup(ply, self)
83-
if canpickup == nil then canpickup = true end
84-
return canpickup
81+
return canpickup == nil and true or canpickup
8582
end
8683

8784
function ENTITY:CPPICanPunt(ply)
8885
local canpunt = FPP.Protect.GravGunPunt(ply, self)
89-
if canpunt == nil then canpunt = true end
90-
return canpunt
86+
return canpunt == nil and true or canpunt
9187
end
9288

9389
function ENTITY:CPPICanUse(ply)
9490
local canuse = FPP.Protect.PlayerUse(ply, self)
95-
if canuse == nil then canuse = true end
96-
return canuse
91+
return canuse == nil and true or canuse
9792
end
9893

9994
function ENTITY:CPPICanDamage(ply)
@@ -107,14 +102,12 @@ if SERVER then
107102

108103
function ENTITY:CPPIDrive(ply)
109104
local candrive = FPP.Protect.CanDrive(ply, self)
110-
if candrive == nil then candrive = true end
111-
return candrive
105+
return candrive == nil and true or candrive
112106
end
113107

114108
function ENTITY:CPPICanProperty(ply, property)
115109
local canproperty = FPP.Protect.CanProperty(ply, property, self)
116-
if canproperty == nil then canproperty = true end
117-
return canproperty
110+
return canproperty == nil and true or canproperty
118111
end
119112

120113
function ENTITY:CPPICanEditVariable(ply, key, val, editTbl)

0 commit comments

Comments
 (0)