Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- ____ ____ _ _ _
- | _ \ _ __ ___ _ __ | _ \ _ __ ___ | |_ ___ ___ | |_ (_) ___ _ __
- | |_) | | '__| / _ \ | '_ \ | |_) | | '__| / _ \ | __| / _ \ / __| | __| | | / _ \ | '_ \
- | __/ | | | (_) | | |_) | | __/ | | | (_) | | |_ | __/ | (__ | |_ | | | (_) | | | | |
- |_| |_| \___/ | .__/ |_| |_| \___/ \__| \___| \___| \__| |_| \___/ |_| |_|
- |_|
- ]]--
- --------------------
- // Prop Blacklist
- --------------------
- hook.Add("PlayerSpawnedProp", "OsirisPropBlacklist", function(ply, mdl, ent)
- if OSIRIS_PP_CONFIG.PropBlacklist then
- if table.HasValue( OSIRIS_PP_CONFIG.PropBlacklistModels, ent:GetModel() ) then
- ent:Remove()
- ply:ChatPrint(OSIRIS_PP_CONFIG.PropBlacklistMessage)
- else
- return
- end
- end
- end)
- --------------------
- // Prop Count
- --------------------
- hook.Add("PlayerSpawnProp", "OsirisPropCount", function(ply)
- if OSIRIS_PP_CONFIG.PropCount then
- if ply:GetCount( "props" ) >= OSIRIS_PP_CONFIG.PropSpawnLimit and !ply.OnTimer then
- if OSIRIS_PP_CONFIG.CaughtMessage then
- ply:ChatPrint( OSIRIS_PP_CONFIG.PropSpawnCooldownInitialNotification )
- for k, v in pairs(player.GetAll()) do
- for i = 1, 1 do
- v:ChatPrint( string.format( OSIRIS_PP_CONFIG.PropSpawnCaught, ply:Name() ) )
- end
- end
- ply.OnTimer = true
- timer.Simple(OSIRIS_PP_CONFIG.PropSpawnTimer, function()
- ply.OnTimer = false
- ply:ChatPrint( OSIRIS_PP_CONFIG.PropSpawnCooldownInactiveNotification )
- end)
- else
- ply:ChatPrint( OSIRIS_PP_CONFIG.PropSpawnCooldownInitialNotification )
- ply.OnTimer = true
- timer.Simple(OSIRIS_PP_CONFIG.PropSpawnTimer, function()
- ply.OnTimer = false
- ply:ChatPrint( OSIRIS_PP_CONFIG.PropSpawnCooldownInactiveNotification )
- end)
- end
- end
- if ply.OnTimer then
- if OSIRIS_PP_CONFIG.RemoveProps then
- for _,ent in pairs(ents.FindByClass("prop_physics")) do
- ent:Remove()
- end
- ply:ChatPrint( OSIRIS_PP_CONFIG.PropSpawnCooldownActiveNotification )
- --ply:ChatPrint( OSIRIS_PP_CONFIG.PropRemovealMessage )
- return false
- else
- ply:ChatPrint( OSIRIS_PP_CONFIG.PropSpawnCooldownActiveNotification )
- return false
- end
- end
- else
- return
- end
- end)
- --------------------
- // Prop Collide
- --------------------
- local IsValid = IsValid
- local props = {
- prop_physics = true,
- prop_physics_multiplayer = true,
- prop_dynamic = true,
- prop_physics_override = true,
- prop_dynamic_override = true
- }
- local function HandleCollision(self, coldata)
- if not IsValid(self) or not IsValid(coldata.HitEntity) then return end
- if not props[coldata.HitEntity:GetClass()] then return end
- local pos = coldata.HitPos
- local td = util.TraceLine({
- start = pos,
- ["end"] = pos,
- filter = self,
- })
- if not IsValid(td.Entity) or td.Entity != self then return end
- td = util.TraceLine({
- start = pos,
- ["end"] = pos,
- filter = coldata.HitEntity,
- })
- if not IsValid(td.Entity) or td.Entity != coldata.HitEntity then return end
- timer.Simple(0, function()
- constraint.NoCollide(td.Entity, coldata.HitEntity, 0, 0 )
- end)
- end
- hook.Add("PlayerSpawnedProp", "OsirisPropCollision", function(ply, mdl, ent)
- if OSIRIS_PP_CONFIG.PropCollosionProtection then
- ent:AddCallback("PhysicsCollide", HandleCollision)
- else
- return
- end
- end)
- --------------------
- // Unfreeze All
- --------------------
- hook.Add("CanPlayerUnfreeze", "OsirisUnfreeze", function(ply, ent, phys)
- if OSIRIS_PP_CONFIG.DisableUnfreezeAll then
- return false
- end
- end)
- --------------------
- // Prop Ghosting
- --------------------
- hook.Add("PlayerSpawnedProp", "OsirisPropGhosting", function(ply, model, ent)
- if OSIRIS_PP_CONFIG.EnableSpawnPropGhosted == true then
- ent:SetMaterial("models/props_combine/com_shield001a")
- ent:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
- end
- end)
- --------------------
- // Physgun Ghosting
- --------------------
- --{ Physgun Pickup }--
- hook.Add("PhysgunPickup", "OsirisNoCollideOnPickup", function(ply, ent)
- if OSIRIS_PP_CONFIG.EnablePropFreezing == true then
- if ent:GetCollisionGroup() == COLLISION_GROUP_DEBRIS then
- return
- end
- ent:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
- ent:SetMaterial("models/props_combine/com_shield001a")
- else
- retrun ""
- end
- end)
- --{ Freeze Prop In Player }--
- hook.Add("PhysgunDrop", "OsirisNoCollideNearPlayer", function(ply, ent)
- if OSIRIS_PP_CONFIG.EnablePropFreezing == true then
- for _,v in pairs(ents.GetAll()) do
- for _,ply in pairs(player.GetAll()) do
- if v:GetClass() == "prop_physics"and ply:GetPos():Distance(v:GetPos()) < 100 then
- ent:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
- ent:SetMaterial("models/props_combine/com_shield001a")
- ply:ChatPrint(OSIRIS_PP_CONFIG.PropFreezingMessage)
- else
- ent:SetCollisionGroup(0)
- ent:SetMaterial("")
- ent:GetPhysicsObject():EnableMotion(false)
- end
- end
- end
- else
- return
- end
- end)
- --{ Freeze on Drop }--
- hook.Add("PhysgunDrop", "OsirisFreezeOnDrop", function(ply, ent)
- if OSIRIS_PP_CONFIG.EnablePropFreezingOnDrop then
- for _,v in pairs(ents.GetAll()) do
- for _,ply in pairs(player.GetAll()) do
- if v:GetClass() == "prop_physics"and ply:GetPos():Distance(v:GetPos()) < 100 then
- ent:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
- ent:SetMaterial("models/props_combine/com_shield001a")
- return
- end
- end
- end
- if OSIRIS_PP_CONFIG.EnablePropFrozenMessage == true then
- ply:ChatPrint(OSIRIS_PP_CONFIG.PropFrozenMessage)
- end
- ent:SetCollisionGroup(0)
- ent:SetMaterial("")
- ent:GetPhysicsObject():EnableMotion(false)
- else
- return
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement