TTT-2 / TTT2

Trouble in Terrorist Town 2 for Garry's Mod (gmod)
https://steamcommunity.com/sharedfiles/filedetails/?id=1357204556
178 stars 74 forks source link

Manually drawing elements from HUD ForceElement #447

Closed timschumi closed 4 years ago

timschumi commented 4 years ago

Is your feature request related to a problem? Please describe. I'm trying to reenable TTT2 compatibility for a addon I use, TTT Spectator Deathmatch. As far as I can tell, it doesn't do any modifications on the HUD, however, the creator decided to draw some HUD elements manually.

Previously, this wasn't a problem, since the storage for WSWITCH and MSTACK (or rather, their Draw() function) was accessable publicly. However, it broke with commit 9427393ad065bc068ca3a634f767f110c894c3a5, where those HUD elements got converted to a new system.

Describe the solution you'd like Provide (or point out) a way to draw a single old_ttt_\* HUD element, preferrably by making the Draw() method accessible.

Describe alternatives you've considered If the above isn't possible, suggestions on how to rework the HUD system of the other addon to be compatible with TTT and TTT2 would be nice (I'll take some time to understand why those elements are drawn one-by-one to ease the effort).

TimGoll commented 4 years ago

@TheNickSkater and I looked through the code of this addon recently. Honestly, it is a mess. I don't know why, but he overrides a huge amount of gamemode hooks that therefore break many TTT2 features. Nick has fixed it in a hacky way, maybe you two can create a stable version together.

Here's his version: https://github.com/TheNickSkater/TTT_Spectator_Deathmatch

saibotk commented 4 years ago

I think we could make the playerinfo element a bit more modular as to split up the single elements draw functions so they can be called by elements deriving from it. As just saw that multiple elements are nearly just a copy of the main element instead of a subclass.

saibotk commented 4 years ago

I looked further into this and i do not see any chance/need to adjust the playerinfo element anymore.