Skip to content

Commit

Permalink
Made it so the setting copscanunweld does not define whether cops can…
Browse files Browse the repository at this point in the history
… open fading doors. This was confusing and lead people to believe it didn't work. This closes #189.

I also made it that the door ram doesn't hit the door when a door warrant is required.
  • Loading branch information
FPtje committed Dec 4, 2012
1 parent b7e997b commit 0fc2215
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions entities/weapons/door_ram/shared.lua
Expand Up @@ -91,8 +91,6 @@ function SWEP:PrimaryAttack()
if (trace.Entity:IsVehicle() and self.Owner:EyePos():Distance(trace.HitPos) > 100) then if (trace.Entity:IsVehicle() and self.Owner:EyePos():Distance(trace.HitPos) > 100) then
return return
end end
self.Owner:SetAnimation(PLAYER_ATTACK1)
self.Owner:EmitSound(self.Sound)
local a = GAMEMODE.Config.copscanunfreeze local a = GAMEMODE.Config.copscanunfreeze
Expand Down Expand Up @@ -136,35 +134,43 @@ function SWEP:PrimaryAttack()
trace.Entity:Fire("setanimation", "open", .6) trace.Entity:Fire("setanimation", "open", .6)
else else
GAMEMODE:Notify(self.Owner, 1, 5, "You need a warrant in order to be able to unlock this door.") GAMEMODE:Notify(self.Owner, 1, 5, "You need a warrant in order to be able to unlock this door.")
return
end end
elseif (trace.Entity:IsVehicle()) then elseif (trace.Entity:IsVehicle()) then
trace.Entity:Fire("unlock", "", .5) trace.Entity:Fire("unlock", "", .5)
local driver = trace.Entity:GetDriver() local driver = trace.Entity:GetDriver()
if driver and driver.ExitVehicle then if driver and driver.ExitVehicle then
driver:ExitVehicle() driver:ExitVehicle()
end end
elseif a and b and (not trace.Entity:GetPhysicsObject():IsMoveable() or trace.Entity.isFadingDoor) and self.Owner:EyePos():Distance(trace.HitPos) < 100 then elseif trace.Entity.isFadingDoor and self.Owner:EyePos():Distance(trace.HitPos) < 100 then
if c then if not c then
if trace.Entity.isFadingDoor and trace.Entity.fadeActivate then GAMEMODE:Notify(self.Owner, 1, 5,"You need a warrant in order to be able to open the fading door.")
if not trace.Entity.fadeActive then return
trace.Entity:fadeActivate() end
timer.Simple(5, function() if trace.Entity.fadeActive then trace.Entity:fadeDeactivate() end end)
end if trace.Entity.isFadingDoor and trace.Entity.fadeActivate and not trace.Entity.fadeActive then
else trace.Entity:fadeActivate()
trace.Entity:GetPhysicsObject( ):EnableMotion( true ) timer.Simple(5, function() if trace.Entity.fadeActive then trace.Entity:fadeDeactivate() end end)
end
else
local FadingProp = (trace.Entity.isFadingDoor and "open fading door.") or "unfreeze this prop"
GAMEMODE:Notify(self.Owner, 1, 5,"You need a warrant in order to be able to "..FadingProp)
end end
elseif a and b and not trace.Entity:GetPhysicsObject():IsMoveable() and self.Owner:EyePos():Distance(trace.HitPos) < 100 then
if not c then
GAMEMODE:Notify(self.Owner, 1, 5, "You need a warrant in order to be able to unfreeze this prop")
return
end
trace.Entity:GetPhysicsObject():EnableMotion(true)
end end
if d and b and self.Owner:EyePos():Distance(trace.HitPos) < 100 then if d and b and self.Owner:EyePos():Distance(trace.HitPos) < 100 then
if c then if not c then
constraint.RemoveConstraints( trace.Entity, "Weld")
else
GAMEMODE:Notify(self.Owner, 1, 5,"You need a warrant in order to be able to unweld this prop.") GAMEMODE:Notify(self.Owner, 1, 5,"You need a warrant in order to be able to unweld this prop.")
return
end end
constraint.RemoveConstraints(trace.Entity, "Weld")
end end
self.Owner:SetAnimation(PLAYER_ATTACK1)
self.Owner:EmitSound(self.Sound)
self.Owner:ViewPunch(Angle(-10, math.random(-5, 5), 0)) self.Owner:ViewPunch(Angle(-10, math.random(-5, 5), 0))
end end
Expand Down

1 comment on commit 0fc2215

@CoolOppo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"I also made it that the door ram doesn't hit the door when a door warrant is required."

That's actually pretty awesome!

Please sign in to comment.