calafex / HPW_Rewrite

Main repository for Harry Potter Magic Wand Rewrite.
MIT License
8 stars 14 forks source link

Physics crash #53

Open baristaner opened 5 years ago

baristaner commented 5 years ago

I have a hogwarts roleplay server and my problem is when the server is crowded like 55 players, physics get crashed randomly because I guess high amounts of spells thrown. Props fell through ground, collision things not work and much more. I cant find the reason why does it happen.

Heres my all related 'ShouldCollide' hooks. What should I look for?

hook.Add("ShouldCollide", "hpwrewrite_spell_oldangvel", function(self, v)ifnot ignore_ents[v:GetClass()] thenlocal phys = v:GetPhysicsObject()
            if phys:IsValid() then v.HpwRewriteOldVelocity = phys:GetAngleVelocity() endendend)

--

    hook.Add("ShouldCollide", "hpwrewrite_protego_physhandler" .. s:EntIndex(), function(ent1, ent2)if IsValid(s) thenif ent1 == s thenif ent2:IsWorld() thenreturnfalseendif ent2.SpellData and ent2.SpellData.Unforgivable thenreturnfalseendif ent2:IsPlayer() thenreturnfalseend

                sound.Play("weapons/physcannon/energy_bounce" .. math.random(1, 2) .. ".wav", ent2:GetPos(), 60, math.random(110, 150)) 
            endelse
            hook.Remove("ShouldCollide", "hpwrewrite_protego_physhandler" .. s:EntIndex())
        endend)

I tried removing protego spell, nothing changed so that means its not with the protego's hook. I cant see any problem with the top one too..