Garry's Mod

Garry's Mod

TTT Grav Nade
foodflare 2019 年 1 月 19 日 下午 7:53
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.
最后由 foodflare 编辑于; 2019 年 1 月 19 日 下午 7:56
< >
正在显示第 1 - 3 条,共 3 条留言
ForgetfulCat  [开发者] 2019 年 1 月 29 日 下午 3:28 
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.
最后由 ForgetfulCat 编辑于; 2019 年 1 月 29 日 下午 3:29
foodflare 2019 年 2 月 1 日 下午 10:52 
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  [开发者] 2019 年 2 月 3 日 下午 3:48 
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.
< >
正在显示第 1 - 3 条,共 3 条留言
每页显示数: 1530 50