function GM:PhysgunPickup( ply, ent )
if string.find( BadClass, ent:GetClass()) then
return false //That is how you eliminate that bunch of lines below, buddy.
end
/*
if(ent:GetClass() == "player") then
return false // Don't allow them to pick up players!!
elseif string.find( ent:GetClass(), "door_" ) then
return false //No physgunning doors here
elseif string.find( ent:GetClass(), "prop_ragdoll" ) then
return false //Nobody should be using ragdolls anyway
elseif string.find( ent:GetClass(), "func_" ) then
return false //Functional entities shouldn't be moved
elseif string.find( ent:GetClass(), "npc_" ) then
return false //Npcs are kinda important, don't move them please
end
*/
ConstrainedEntities = constraint.GetAllConstrainedEntities( ent )
//As much as you all might be confused by this, I admit I'm more confused, I'll attempt to clarfy my theory
//This code makes physgunned props nocollide and change color to semi-transparent
//GROUP_NONE is conventional props, GROUP_WORLD is nocollide all.
//Using a MUCH safer system now so that color is never manipulated via this file, instead the material changes, and even includes oversight for modified materials
//redtbl[1000], greentbl[1000], bluetbl[1000], alphatbl[1000] = ent:GetColor( ) Respectful Code to keep players color changes the same, that's nice of me
//ent:SetColor(255, 255, 255, 125)
for k, v in pairs( ConstrainedEntities ) do // Get all entities constrained by the picked up entity, and make them nocollide all as well
entmat[v:EntIndex()] = v:GetMaterial()
if(v:IsValid()) then// Aparantely the main prop is part of constrained entities, so I only need this loop rather then a loop and a half for the first prop
v:SetCollisionGroup(COLLISION_GROUP_WORLD)
v.CollisionGroup=COLLISION_GROUP_WORLD
v:SetMaterial("Models/effects/splodearc_sheet")
//This was removed below due to bugs with nocollide all, instead we will be targetting the nocollide tool directly.
/*
if v:GetCollisionGroup()==COLLISION_GROUP_WORLD then// Targets each entity of a contraption and nocollides it
game.ConsoleCommand("say Nocollided props can't be picked up until they're recollided.\n")//This has been removed since I don't want players to be able to hit people with solid props via the physgun, and I can't find a way to save it in memory via the collision group
//v:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
//v.CollisionGroup=COLLISION_GROUP_DEBRIS
return false
else
//game.ConsoleCommand("say COLLISION_GROUP_NONE\n")//Just test stuff so I could get this perfect
v:SetCollisionGroup(COLLISION_GROUP_WORLD)
v.CollisionGroup=COLLISION_GROUP_WORLD
end
*/
//redtbl[v], greentbl[v], bluetbl[v], alphatbl[v] = v:GetColor( )// Respectful Code to keep players color changes the same, that's nice of me
end
end
return true
end
function GM:PhysgunDrop( ply, ent )
ConstrainedEntities = constraint.GetAllConstrainedEntities( ent )
//ent:SetColor(255, 255, 255, 255)
// Loop through all the entities in the constraint system to recollide them
for k, v in pairs( ConstrainedEntities ) do
if(v:IsValid()) then
if v:GetCollisionGroup()==COLLISION_GROUP_WORLD then
v:SetCollisionGroup(COLLISION_GROUP_NONE)
v.CollisionGroup=COLLISION_GROUP_NONE
end
v:SetMaterial(entmat[v:EntIndex()])//This right here is awesome
//Removed, No reason to have extra code in here, even though these comments make it a bit longer, but that's what alpha is for :P
/*
else
//v:SetCollisionGroup(COLLISION_GROUP_WORLD)
//v.CollisionGroup=COLLISION_GROUP_WORLD
end
*/
end
end
end