Permalink
Browse files

TTT: Clean up C4 timer positioning

Moved into a function. Tweaked numbers a bit to move the timer away from
the model slightly to fix a z-fighting issue.
  • Loading branch information...
1 parent a56b170 commit 05f256292aabdbf3d08fd4bc3b1323f3f12cca79 @svdm svdm committed Sep 18, 2013
@@ -576,15 +576,27 @@ if CLIENT then
antialias = false
})
+
+ function ENT:GetTimerPos()
+ local att = self:GetAttachment(self:LookupAttachment("controlpanel0_ur"))
+ if att then
+ return att
+ else
+ local ang = self:GetAngles()
+ ang:RotateAroundAxis(self:GetUp(), -90)
+ local pos = (self:GetPos() + self:GetForward() * 4.5 +
+ self:GetUp() * 9.0 + self:GetRight() * 7.8)
+ return { Pos = pos, Ang = ang }
+ end
+ end
+
local strtime = util.SimpleTime
local max = math.max
function ENT:Draw()
self:DrawModel()
if self:GetArmed() then
- local ang = self:GetAngles() ang:RotateAroundAxis(self:GetUp(),-90)
- local angpos_ur = self:GetAttachment(self:LookupAttachment("controlpanel0_ur")) or --Doesn't work, wrong attachment?
- {Pos=self:GetPos()+self:GetForward()*4.5+self:GetUp()*8.8+self:GetRight()*7.8,Ang=ang} --Relative position failsafe
+ local angpos_ur = self:GetTimerPos()
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)
@@ -40,7 +40,7 @@ GM.CRCs = {
["gamemode/resources.lua"] = "974358494",
["gamemode/scoring.lua"] = "1754869329",
["gamemode/scoring_shd.lua"] = "4152282892",
- ["gamemode/shared.lua"] = "3320564589",
+ ["gamemode/shared.lua"] = "3510677218",
["gamemode/tags.lua"] = "864385761",
["gamemode/traitor_state.lua"] = "910131773",
["gamemode/util.lua"] = "2325186707",
@@ -65,7 +65,7 @@ GM.CRCs = {
["entities/entities/ttt_basegrenade_proj/shared.lua"] = "3084636663",
["entities/entities/ttt_beacon/shared.lua"] = "2415542602",
["entities/entities/ttt_c4/cl_init.lua"] = "2724392396",
- ["entities/entities/ttt_c4/shared.lua"] = "1303776796",
+ ["entities/entities/ttt_c4/shared.lua"] = "4046507129",
["entities/entities/ttt_carry_handler/shared.lua"] = "118383479",
["entities/entities/ttt_confgrenade_proj/shared.lua"] = "1283583524",
["entities/entities/ttt_credit_adjust/init.lua"] = "2279125237",
@@ -3,7 +3,7 @@ GM.Author = "Bad King Urgrain"
GM.Email = "thegreenbunny@gmail.com"
GM.Website = "ttt.badking.net"
-- Date of latest changes (YYYY-MM-DD)
-GM.Version = "2013-08-31"
+GM.Version = "2013-09-18"
GM.Customized = false

0 comments on commit 05f2562

Please sign in to comment.