Garry's Mod

Garry's Mod

TTT Grav Nade
foodflare 19 Jan, 2019 @ 7:53pm
Credits, stuck in environment, passive equipment
@@ -67,9 +67,12 @@ local ragdoll = ents.Create( "prop_ragdoll" ) local GIMNade = {} GIMNade.Weapons = weps + GIMNade.EquipmentItems = player:GetEquipmentItems() GIMNade.Player = player GIMNade.Health = player:Health() GIMNade.UnfreezeTime = CurTime() + FreezeTime + GIMNade.Credits = player:GetCredits() + GIMNade.StartPos = player:GetPos() FloatingEntities[ragdoll] = GIMNade @@ -98,9 +101,9 @@ if t.Health <= 0 or t.UnfreezeTime <= CurTime() then player:SetParent() player:UnSpectate() - local pos = ent:GetPos() - pos.z = pos.z + 10 player:Spawn() + local tr = util.TraceHull({ start = t.StartPos, endpos = ent:GetPos(), mins = player:OBBMins(), maxs = player:OBBMaxs(), filter = player,}) + local pos = tr.HitPos player:SetHealth(t.Health) player:SetPos( pos ) player:SetVelocity( ent:GetVelocity() ) @@ -118,6 +121,8 @@ end end) else + player:AddEquipmentItem(t.EquipmentItems) + player:AddCredits(t.Credits) if t.Weapons then timer.Simple(.1,function() if player:IsValid() then @@ -201,7 +206,10 @@ local un for k, v in pairs(en) do - local velocity = (Vector(BlastRadius,BlastRadius,BlastRadius)-(v:GetPos()-self:GetPos()))*0.2 + local dir = v:GetPos() - self:GetPos() + local Ratio = (BlastRadius - dir:Length()) / BlastRadius + local Magnitude = Ratio * 50 + local velocity = dir:GetNormal() * Magnitude + Vector(0, 0, 10) local phys_obj = v:GetPhysicsObject() if FloatingEntities[v] then FloatingEntities[v].UnfreezeTime = CurTime() + FreezeTime

Here's some modifications to fix issues mentioned in title.
Last edited by foodflare; 19 Jan, 2019 @ 7:56pm
< >
Showing 1-3 of 3 comments
ForgetfulCat  [developer] 29 Jan, 2019 @ 3:28pm 
This is certainly helpful, man, thanks! I had already patched in the same solution you had for the traitor/detective credits though; that's been patched for a while.
Didn't even think of the passive equipment glitch, so that is helpful.
The last fix didn't work when I added your code to my server; the person still gets stuck in walls like before.

Regardless, it is very nice to have someone posting fixes like this; since I'm not a hard-core developer and it would never get fixed without people like you.
Last edited by ForgetfulCat; 29 Jan, 2019 @ 3:29pm
foodflare 1 Feb, 2019 @ 10:52pm 
How peculiar, I only subscribed less than a week before I posted this, so it's weird I don't have the credits version. As far as the still getting stuck in walls part, I was only able to get stuck one time after changing it, in several environments. I'm wondering if there was something different about the wall collision you were testing with than I had tested with.

Also, I didn't mention in the title that the bottom part was related to explosion velocity since the existing logic generally threw all the hit targets in the same direction. That last bit was to make the velocity outward from the explosion epicenter with a slight upward addition.
ForgetfulCat  [developer] 3 Feb, 2019 @ 3:48pm 
Oh well the credits fix didn't get implemented last update even though it was supposed to, that's why you didn't have it. So uhhh... that's awkward.
I just tested it on 67th way, so a pretty basic map.
And I see, I see.
< >
Showing 1-3 of 3 comments
Per page: 1530 50