@@ -141,13 +141,13 @@ end)
141
141
FPP .Protect = {}
142
142
143
143
-- Physgun Pickup
144
- function FPP .Protect .PhysgunPickup (ply , ent , internal )
145
- if not tobool (FPP .Settings .FPP_PHYSGUN1 .toggle ) then if not internal and FPP .UnGhost then FPP .UnGhost (ply , ent ) end return end
144
+ function FPP .Protect .PhysgunPickup (ply , ent )
145
+ if not tobool (FPP .Settings .FPP_PHYSGUN1 .toggle ) then if FPP .UnGhost then FPP .UnGhost (ply , ent ) end return end
146
146
if not ent :IsValid () then return end
147
147
local cantouch
148
148
local skipReturn = false
149
149
150
- if not internal and isfunction (ent .PhysgunPickup ) then
150
+ if isfunction (ent .PhysgunPickup ) then
151
151
cantouch = ent :PhysgunPickup (ply , ent )
152
152
-- Do not return the value, the gamemode will do this
153
153
-- Allows other hooks to run
@@ -159,7 +159,7 @@ function FPP.Protect.PhysgunPickup(ply, ent, internal)
159
159
skipReturn = ent :IsPlayer ()
160
160
end
161
161
162
- if cantouch and not internal and FPP .UnGhost then FPP .UnGhost (ply , ent ) end
162
+ if cantouch and FPP .UnGhost then FPP .UnGhost (ply , ent ) end
163
163
if not cantouch and not skipReturn then return false end
164
164
end
165
165
hook .Add (" PhysgunPickup" , " FPP.Protect.PhysgunPickup" , FPP .Protect .PhysgunPickup )
205
205
hook .Add (" OnPhysgunFreeze" , " FPP.Protect.PhysgunFreeze" , FPP .PhysgunFreeze )
206
206
207
207
-- Gravgun pickup
208
- function FPP .Protect .GravGunPickup (ply , ent , internal )
208
+ function FPP .Protect .GravGunPickup (ply , ent )
209
209
if not tobool (FPP .Settings .FPP_GRAVGUN1 .toggle ) then return end
210
210
211
211
if not IsValid (ent ) then return end -- You don't want a cross when looking at the floor while holding right mouse
@@ -214,23 +214,23 @@ function FPP.Protect.GravGunPickup(ply, ent, internal)
214
214
215
215
local cantouch
216
216
217
- if not internal and isfunction (ent .GravGunPickup ) then
217
+ if isfunction (ent .GravGunPickup ) then
218
218
cantouch = ent :GravGunPickup (ply , ent )
219
219
elseif ent .GravGunPickup ~= nil then
220
220
cantouch = ent .GravGunPickup
221
221
else
222
222
cantouch = not ent :IsPlayer () and FPP .plyCanTouchEnt (ply , ent , " Gravgun" )
223
223
end
224
224
225
- if cantouch and not internal and FPP .UnGhost then FPP .UnGhost (ply , ent ) end
226
- if cantouch == false and not internal then DropEntityIfHeld (ent ) end
225
+ if cantouch and FPP .UnGhost then FPP .UnGhost (ply , ent ) end
226
+ if cantouch == false then DropEntityIfHeld (ent ) end
227
227
end
228
228
hook .Add (" GravGunOnPickedUp" , " FPP.Protect.GravGunPickup" , FPP .Protect .GravGunPickup )
229
229
230
- function FPP .Protect .CanGravGunPickup (ply , ent , internal )
230
+ function FPP .Protect .CanGravGunPickup (ply , ent )
231
231
if not tobool (FPP .Settings .FPP_GRAVGUN1 .toggle ) or not IsValid (ent ) then return end
232
232
233
- if not internal and isfunction (ent .GravGunPickup ) then
233
+ if isfunction (ent .GravGunPickup ) then
234
234
-- Function name different than gamemode's (GravGunPickup vs GravGunPickupAllowed)
235
235
-- Override FPP's behavior when implemented
236
236
local val = ent :GravGunPickup (ply , ent )
@@ -250,17 +250,17 @@ end
250
250
hook .Add (" GravGunPickupAllowed" , " FPP.Protect.CanGravGunPickup" , FPP .Protect .CanGravGunPickup )
251
251
252
252
-- Gravgun punting
253
- function FPP .Protect .GravGunPunt (ply , ent , internal )
254
- if tobool (FPP .Settings .FPP_GRAVGUN1 .noshooting ) then if not internal then DropEntityIfHeld (ent ) end return false end
253
+ function FPP .Protect .GravGunPunt (ply , ent )
254
+ if tobool (FPP .Settings .FPP_GRAVGUN1 .noshooting ) then DropEntityIfHeld (ent ) return false end
255
255
-- Do not reason further if gravgun protection is disabled.
256
256
if not tobool (FPP .Settings .FPP_GRAVGUN1 .toggle ) then return end
257
257
258
- if not IsValid (ent ) then if not internal then DropEntityIfHeld (ent ) end return end
258
+ if not IsValid (ent ) then DropEntityIfHeld (ent ) return end
259
259
260
260
local cantouch
261
261
local skipReturn = false
262
262
263
- if not internal and isfunction (ent .GravGunPunt ) then
263
+ if isfunction (ent .GravGunPunt ) then
264
264
cantouch = ent :GravGunPunt (ply , ent )
265
265
-- Do not return the value, the gamemode will do this
266
266
-- Allows other hooks to run
@@ -271,22 +271,22 @@ function FPP.Protect.GravGunPunt(ply, ent, internal)
271
271
cantouch = not ent :IsPlayer () and FPP .plyCanTouchEnt (ply , ent , " Gravgun" )
272
272
end
273
273
274
- if cantouch and not internal and FPP .UnGhost then FPP .UnGhost (ply , ent ) end
275
- if not cantouch and not internal then DropEntityIfHeld (ent ) end
274
+ if cantouch and FPP .UnGhost then FPP .UnGhost (ply , ent ) end
275
+ if not cantouch then DropEntityIfHeld (ent ) end
276
276
if not cantouch and not skipReturn then return false end
277
277
end
278
278
hook .Add (" GravGunPunt" , " FPP.Protect.GravGunPunt" , FPP .Protect .GravGunPunt )
279
279
280
280
-- PlayerUse
281
- function FPP .Protect .PlayerUse (ply , ent , internal )
281
+ function FPP .Protect .PlayerUse (ply , ent )
282
282
if not tobool (FPP .Settings .FPP_PLAYERUSE1 .toggle ) then return end
283
283
284
284
if not IsValid (ent ) then return end
285
285
286
286
local cantouch
287
287
local skipReturn = false
288
288
289
- if not internal and isfunction (ent .PlayerUse ) then
289
+ if isfunction (ent .PlayerUse ) then
290
290
cantouch = ent :PlayerUse (ply , ent )
291
291
-- Do not return the value, the gamemode will do this
292
292
-- Allows other hooks to run
@@ -297,20 +297,20 @@ function FPP.Protect.PlayerUse(ply, ent, internal)
297
297
cantouch = not ent :IsPlayer () and FPP .plyCanTouchEnt (ply , ent , " PlayerUse" )
298
298
end
299
299
300
- if cantouch and not internal and FPP .UnGhost then FPP .UnGhost (ply , ent ) end
300
+ if cantouch and FPP .UnGhost then FPP .UnGhost (ply , ent ) end
301
301
if not cantouch and not skipReturn then return false end
302
302
end
303
303
hook .Add (" PlayerUse" , " FPP.Protect.PlayerUse" , FPP .Protect .PlayerUse )
304
304
305
305
-- EntityDamage
306
- function FPP .Protect .EntityDamage (ent , dmginfo , internal )
306
+ function FPP .Protect .EntityDamage (ent , dmginfo )
307
307
if not IsValid (ent ) then return end
308
308
309
309
local inflictor = dmginfo :GetInflictor ()
310
310
local attacker = dmginfo :GetAttacker ()
311
311
local amount = dmginfo :GetDamage ()
312
312
313
- if not internal and isfunction (ent .EntityDamage ) then
313
+ if isfunction (ent .EntityDamage ) then
314
314
local val = ent :EntityDamage (ent , inflictor , attacker , amount , dmginfo )
315
315
-- Do not return the value, the gamemode will do this
316
316
if val ~= nil then return end
@@ -549,13 +549,15 @@ end
549
549
hook .Add (" CanTool" , " FPP.Protect.CanTool" , FPP .Protect .CanTool )
550
550
551
551
function FPP .Protect .CanEditVariable (ent , ply , key , varVal , editTbl )
552
+ if not tobool (FPP .Settings .FPP_TOOLGUN1 .toggle ) then return true end
552
553
local val = FPP .Protect .CanProperty (ply , " editentity" , ent )
553
554
if val ~= nil then return val end
554
555
end
555
556
hook .Add (" CanEditVariable" , " FPP.Protect.CanEditVariable" , FPP .Protect .CanEditVariable )
556
557
557
558
function FPP .Protect .CanProperty (ply , property , ent )
558
559
-- Use Toolgun because I'm way too lazy to make a new type
560
+ if not tobool (FPP .Settings .FPP_TOOLGUN1 .toggle ) then return true end
559
561
local cantouch = FPP .plyCanTouchEnt (ply , ent , " Toolgun" )
560
562
561
563
if not cantouch then return false end
@@ -564,6 +566,7 @@ hook.Add("CanProperty", "FPP.Protect.CanProperty", FPP.Protect.CanProperty)
564
566
565
567
function FPP .Protect .CanDrive (ply , ent )
566
568
-- Use Toolgun because I'm way too lazy to make a new type
569
+ if not tobool (FPP .Settings .FPP_TOOLGUN1 .toggle ) then return true end
567
570
local cantouch = FPP .plyCanTouchEnt (ply , ent , " Toolgun" )
568
571
569
572
if not cantouch then return false end
0 commit comments