Trouble in Terrorist Town - C4 (FIXED PLANTED C4 OUTSIDE CONTDOWN TIMER)

Hi Guys,

Thanks to the help of my_hat_stinks we have fixed the planted C4 so it now shows a timer on the outside just as it used to.

Enjoy

DEMO: http://youtu.be/OlBzNarbULI
DOWNLOAD: https://mega.co.nz/#!IlMQBYIB!L1m0O3O8bm1GWTK5z2QzcVntf4l7LZ6NeW7g3IvHWvg

To Install

Browse to: gamemodes/terrortown/entities/entities

Replace the files in the ttt_c4 with the contents of the attached zip file.

Nice. I made a fix for this, but yours is much tidier, since it doesn’t use an invisible Hula doll to get the world coordinates of the faceplate corner =p.

Will be replacing mine with this.

Brilliant! Thanks for sharing this!

Confirmed working

Make a pull request on GitHub?

I somehow can’t get this to work properly :C.

I put it in the gamemodes/terrortown/entities/entities/ttt_c4 folder, the three files. Overwrote the old ones. To no avail.

I’m getting reports that c4 can’t be disarmed after this, you can cut the wire and it will still count down.

Yeah, another issue,at 0 it blows but doesn’t explode or cause damage. It vanishes and leaves a burn mark.

This is on a different server where it worked from the start.

And Eclid’s report on it not defusing is accurate.

What version of TTT are you running? This fully tested and working on TTT base code version 37, are you getting any errors on the server console? Because no changes we’re made to the way the timer works, the adjustments I made only changed how the timer was displayed on the outside.

Version 37 has been out of date since july. That would most likely be running TTT 2013-07-28?

Only update related to c4 between 37 and the latest is;

TTT 2013-07-21
Fixed exploit where C4 could be teleported using map-based teleporters. It is now disarmed if that occurs.

How do I tell which version it’s running?

This is the only related looking line: Build: 5354

On that note, how would one go about updating it?

It would tell you in chat everytime a round starts. I’m currently on my mobile at the moment, but restore back your original C4 and ii’ll provide a detailed post on what was changed for trouble shooting purposes.

My Best Guess for those who are having issues with the C4 would be because of the different versions of TTT that they could possibly be running. As i have seen some servers running very old gamemodes.

In shared.lua of the ttt_c4 entity, you will see something like this. Approx line 584


if self:GetArmed() then
         local angpos_ur = self:GetAttachment(self:LookupAttachment("controlpanel0_ur"))
         if angpos_ur then
            cam.Start3D2D(angpos_ur.Pos, angpos_ur.Ang, 0.2)
            draw.DrawText(strtime(max(0, self:GetExplodeTime() - CurTime()), "%02i:%02i"), "C4ModelTimer", -1, 1, COLOR_RED, TEXT_ALIGN_RIGHT)
            cam.End3D2D()
         end
      end

Change that to this.


if self:GetArmed() then
         local ang = self:GetAngles() ang:RotateAroundAxis(self:GetUp(),-90)
         local angpos_ur = self:GetAttachment(self:LookupAttachment("controlpanel0_ur")) or
		{Pos=self:GetPos()+self:GetForward()*4.5+self:GetUp()*8.8+self:GetRight()*7.8,Ang=ang}

         if angpos_ur then
            cam.Start3D2D(angpos_ur.Pos, angpos_ur.Ang, 0.2)
            draw.DrawText(strtime(max(0, self:GetExplodeTime() - CurTime()), "%02i:%02i"), "C4ModelTimer", -1, 1, COLOR_RED, TEXT_ALIGN_RIGHT)
            cam.End3D2D()
         end
      end

For those that wish to do this manually.

Done. Fist time I’ve done a pull request, not sure if I did it right, though

You did it correctly

and it was added

Finally this problem has been fixed, good job :slight_smile:

Will this fix the defusing issue?

If you revert your C4 back to how it was and then follow those instructions then yes. That code does not touch anything to do with defusing at all.

You should use the updated one on github, and the fix will be in the next gmod update.
https://raw.github.com/garrynewman/garrysmod/master/garrysmod/gamemodes/terrortown/entities/entities/ttt_c4/shared.lua