Dinkleberg's GMod

Full Version: limit c4's to 1 purchase per player
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
c4's just lag the server too much, it's genuinely pathetic that dinks wont upgrade the server beyond a 1994 pentium 2 laptop so this is the next alternative to having the server not become completely unplayable when eamtomlinson/A0 decides to plant 7 c4's in 1 round

it's also not fun gameplay to have someone plant c4's in every t room/unreachable location (i.e. innomotel) but i'm used to playing versus cringe at this point, i'd just like a functioning server
bro might be onto something
(08-31-2025, 09:25 PM)aaaaaaaa Wrote: [ -> ]c4's just lag the server too much, it's genuinely pathetic that dinks wont upgrade the server beyond a 1994 pentium 2 laptop so this is the next alternative to having the server not become completely unplayable when eamtomlinson/A0 decides to plant 7 c4's in 1 round

it's also not fun gameplay to have someone plant c4's in every t room/unreachable location (i.e. innomotel) but i'm used to playing versus cringe at this point, i'd just like a functioning server
i guarantee there is more than a handful of people who would pay 20+ bucks to kickstart a better machine for the server
(08-31-2025, 10:28 PM)Nelluc9 Wrote: [ -> ]
(08-31-2025, 09:25 PM)aaaaaaaa Wrote: [ -> ]c4's just lag the server too much, it's genuinely pathetic that dinks wont upgrade the server beyond a 1994 pentium 2 laptop so this is the next alternative to having the server not become completely unplayable when eamtomlinson/A0 decides to plant 7 c4's in 1 round

it's also not fun gameplay to have someone plant c4's in every t room/unreachable location (i.e. innomotel) but i'm used to playing versus cringe at this point, i'd just like a functioning server
i guarantee there is more than a handful of people who would pay 20+ bucks to kickstart a better machine for the server
I would
the 1 c4 limit is an OK suggestion, but if you really want to get to the root of the issue, you need to edit the base C4 entity that applies force to prop_physics, weapons, ammo crates, etc.

I tested out a solution myself and it seemed to work pretty well.

In the \ttt_c4\shared.lua, remove the line "dmginfo:SetDamageForce(center - ent:GetPos()" in the ENT:SphereDamage function. C4 will still hurt people through walls exactly as it did before, but it won't apply force to the entities surrounding it.

The only downside is that C4s feel less fun and realistic, but given how much lag and how often the server crashes because of c4s, it might be worth it.

I made a video demo of this in action:




edit: there could be better ways of doing this, this is just a quick fix focused purely on optimization. I'll look into other solutions, like maybe only pushing actual props and ragdolls while ignoring no-collide objects like grenade, ammo, and weapon drops (which are probably causing most of the lag since a lot of maps like Eclipse have a thousand pickups)
(09-01-2025, 11:04 PM)murl Wrote: [ -> ]the 1 c4 limit is an OK suggestion, but if you really want to get to the root of the issue, you need to edit the base C4 entity that applies force to prop_physics, weapons, ammo crates, etc.

I tested out a solution myself and it seemed to work pretty well.

In the \ttt_c4\shared.lua, remove the line "dmginfo:SetDamageForce(center - ent:GetPos()" in the ENT:SphereDamage function. C4 will still hurt people through walls exactly as it did before, but it won't apply force to the entities surrounding it.

The only downside is that C4s feel less fun and realistic, but given how much lag and how often the server crashes because of c4s, it might be worth it.

I made a video demo of this in action:




edit: there could be better ways of doing this, this is just a quick fix focused purely on optimization. I'll look into other solutions, like maybe only pushing actual props and ragdolls while ignoring no-collide objects like grenade, ammo, and weapon drops (which are probably causing most of the lag since a lot of maps like Eclipse have a thousand pickups)

wow murl is so cool and epic

Something like this or this should be considered!!!
(09-02-2025, 06:35 AM)anxelic Wrote: [ -> ]
(09-01-2025, 11:04 PM)murl Wrote: [ -> ]the 1 c4 limit is an OK suggestion, but if you really want to get to the root of the issue, you need to edit the base C4 entity that applies force to prop_physics, weapons, ammo crates, etc.

I tested out a solution myself and it seemed to work pretty well.

In the \ttt_c4\shared.lua, remove the line "dmginfo:SetDamageForce(center - ent:GetPos()" in the ENT:SphereDamage function. C4 will still hurt people through walls exactly as it did before, but it won't apply force to the entities surrounding it.

The only downside is that C4s feel less fun and realistic, but given how much lag and how often the server crashes because of c4s, it might be worth it.

I made a video demo of this in action:




edit: there could be better ways of doing this, this is just a quick fix focused purely on optimization. I'll look into other solutions, like maybe only pushing actual props and ragdolls while ignoring no-collide objects like grenade, ammo, and weapon drops (which are probably causing most of the lag since a lot of maps like Eclipse have a thousand pickups)

wow murl is so cool and epic

Something like this or this should be considered!!!

Considered
(09-02-2025, 06:35 AM)anxelic Wrote: [ -> ]
(09-01-2025, 11:04 PM)murl Wrote: [ -> ]the 1 c4 limit is an OK suggestion, but if you really want to get to the root of the issue, you need to edit the base C4 entity that applies force to prop_physics, weapons, ammo crates, etc.

I tested out a solution myself and it seemed to work pretty well.

In the \ttt_c4\shared.lua, remove the line "dmginfo:SetDamageForce(center - ent:GetPos()" in the ENT:SphereDamage function. C4 will still hurt people through walls exactly as it did before, but it won't apply force to the entities surrounding it.

The only downside is that C4s feel less fun and realistic, but given how much lag and how often the server crashes because of c4s, it might be worth it.

I made a video demo of this in action:




edit: there could be better ways of doing this, this is just a quick fix focused purely on optimization. I'll look into other solutions, like maybe only pushing actual props and ragdolls while ignoring no-collide objects like grenade, ammo, and weapon drops (which are probably causing most of the lag since a lot of maps like Eclipse have a thousand pickups)

wow murl is so cool and epic

Something like this or this should be considered!!!

Weridly SetDamageForce doesn't actually apply force to players. https://wiki.facepunch.com/gmod/CTakeDam...amageForce See note on the wiki
 Likely it would be best to just remove it since the ENT:SphereDamage function only affects players since it uses player.Iterator() 
Entities appear to be shoved by the PhsyExplosion
https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/terrortown/entities/entities/ttt_c4/shared.lua#L255


Asked over in the Garry's Mod discord to see if there is some reason this is even called. Since it honestly makes no sense at all to apply the damage force to players when it says it doesn't affect players. (And the loop only goes thru players.) 



EDIT: According to someone over on the Gmod Discord its used to make sure players rag dolls fly out from the explosion. Otherwise it doesn't actual affect the players and also never touches the props (since the loop only goes thru players)
(09-02-2025, 08:54 PM)chibill Wrote: [ -> ]Weridly SetDamageForce doesn't actually apply force to players. https://wiki.facepunch.com/gmod/CTakeDam...amageForce See note on the wiki
 Likely it would be best to just remove it since the ENT:SphereDamage function only affects players since it uses player.Iterator() 
Entities appear to be shoved by the PhsyExplosion
https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/terrortown/entities/entities/ttt_c4/shared.lua#L255


Asked over in the Garry's Mod discord to see if there is some reason this is even called. Since it honestly makes no sense at all to apply the damage force to players when it says it doesn't affect players. (And the loop only goes thru players.) 



EDIT: According to someone over on the Gmod Discord its used to make sure players rag dolls fly out from the explosion. Otherwise it doesn't actual affect the players and also never touches the props (since the loop only goes thru players)
Yeah I tested murl's fix and from my experience (and what intuition is telling me) its definitely the env_physexplosion. it's the same entity that causes discombobulators to push props. the problem is if you remove the physexplosion players don't get jostled around by the c4 anymore. working on a potential fix rn

https://steamcommunity.com/sharedfiles/f...3561317852

feel free anyone to subscribe to this and test it out.

Beforehand C4 created a giant physics explosion with a magnitude of 200 for all props within a 1000-unit radius that ignored LOS
this attempts to alleviate the problem by lowering the magnitude to 1.
essentially this means that players still get the aimpunch effect when they're within 750-1000 units of a c4 (non-damaging/knockback range) Props within the 750-unit explosion range still get pushed by the explosion but only if they are within LOS of the c4.

the only side effect that this might have besides potentially less cinematic explosions is players within this 750-1000 unit range will take less actual knockback from the c4 but that kind of seems like a non-issue
(09-02-2025, 08:54 PM)chibill Wrote: [ -> ]Weridly SetDamageForce doesn't actually apply force to players. https://wiki.facepunch.com/gmod/CTakeDam...amageForce See note on the wiki
 Likely it would be best to just remove it since the ENT:SphereDamage function only affects players since it uses player.Iterator() 
Entities appear to be shoved by the PhsyExplosion
https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/terrortown/entities/entities/ttt_c4/shared.lua#L255


Asked over in the Garry's Mod discord to see if there is some reason this is even called. Since it honestly makes no sense at all to apply the damage force to players when it says it doesn't affect players. (And the loop only goes thru players.) 



EDIT: According to someone over on the Gmod Discord its used to make sure players rag dolls fly out from the explosion. Otherwise it doesn't actual affect the players and also never touches the props (since the loop only goes thru players)


oops I forgot I removed this too, I just did a bad job at tracking changes. 
Code:
      -- extra push
      -- local phexp = ents.Create("env_physexplosion")
      -- phexp:SetPos(pos)
      -- phexp:SetKeyValue("magnitude", self:GetDmg())
      -- phexp:SetKeyValue("radius", r_outer)
      -- phexp:SetKeyValue("spawnflags", "19")
      -- phexp:Spawn()
      -- phexp:Fire("Explode", "", 0)