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

The more Traitors, the less credits #158

Closed NickCloudAT closed 5 years ago

NickCloudAT commented 5 years ago

Describe the bug Normaly in TTT if you have more traitors, you start with less credits. So if you have set the default credits to say 3 and there are 2 Traitors, every traitor only has 2 Credits at the beginning. With 3 Traitors, everybody has 1. Of course if more then 3 traitors, then everybody has 1.

Edit: Okay I saw that this is still in, but with everything "+1" so it starts at 3 Traitors to have 2 credits for each (Would still be nice to have it like the old)

I'm not sure if it is meant to be removed in TTT2 or not, but I would like to have that back.

To Reproduce Steps to reproduce the behaviour: I think it's pretty clear.

NickCloudAT commented 5 years ago

Well, i'm pretty sure I found the cause. It's cause by the Cvar "ttt_credits_alonebonus". In the lua file "player_ext_main" where you give players their credits in the function "SetDefaultCredits". In this function you check for EVERY traitor if the is alone and then give him an extra credit if he is alone. But at the beginning, the first traitor IS alone and gets 1 extra credit.

Alf21 commented 5 years ago

Hmm that‘s true. We should set the credits externally again. This would be the best solution. Doin it in a second loop after every player got his role

NickCloudAT commented 5 years ago

https://github.com/TheNickSkater/TTT2/commit/f4a5444008b159d938daee886aac8c775e57f451 it's probably a "bad" solution xD. It works for me at least for now and brings me back the "old" system.

Alf21 commented 5 years ago

No, it‘s alright. Seems to be a good solution. Well done. But i will do some modifications and tests before, e.g. I found another related bug that would happen if you doing it in that way

NickCloudAT commented 5 years ago

Well okay, and what bug xD maybe i already encounterd it.

Alf21 commented 5 years ago

As I said, the SetDefaultCredits function needs to be moved into a new loop after every player got his role. Currently it‘s done directly after ply:SetRole(). As a result, the first Traitor will receive the alone bonus (because at this time, he is the only one).

NickCloudAT commented 5 years ago

Would that kinda work (well at least it works for me):

https://github.com/TheNickSkater/TTT2/commit/a811b101dc4825a56641196a87c63089c9c23dca

https://github.com/TheNickSkater/TTT2/commit/4204f388ec98fd39db55163d776218214d34e6fd

Alf21 commented 5 years ago

Sure, just create a pull request (PR) :)