Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lua/map_scripts/maps/gm_darkfusion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,22 @@ local entIDs = {

hook.Add( "CFC_MapScripts_PostMapEntsSpawn", "CFC_MapScripts_darkfusion_removeadminbuttons", function()
MapScripts.Utils.RemoveButtonsByID( entIDs )
end )


-- only allow pvpers to mess with the map for maximum LARP
if not CFCPvp then return end

local tooFarDistanceSqr = 200^2

hook.Add( "PlayerUse", "CFC_MapScripts_darkfusion_BlockBuilderUseOnMapButtons", function( ply, ent )
if ent:MapCreationID() == -1 then return end
if not string.find( ent:GetClass(), "button" ) then return end -- not a button? who cares!

if ply:IsInBuild() then ply:ChatPrint( "You must be in PVP to press darkfusion map buttons!" ) return false end -- pvpers only!

local plyPos = ply:GetPos()
if plyPos:DistToSqr( ent:GetPos() ) > tooFarDistanceSqr then return false end -- too far away, probably a wire user, etc

-- all good, let them use the button
end )