New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTT: Force all players to innocents on preparing #1280

Merged
merged 1 commit into from Nov 28, 2016

Conversation

Projects
None yet
7 participants
@markusmarkusz
Contributor

markusmarkusz commented Nov 19, 2016

Advantage:
Traitor things can't be accessed by users that aren't traitor anymore. (Some traitor things (like rooms or secrets) are made with ttt_logic_role. This entity only checks the role and not if the round is active.)

Disadvantage:
There is a very small chance that some addons could use this. But I'm not sure at the moment.

@end360

This comment has been minimized.

Contributor

end360 commented Nov 19, 2016

An example of rooms that use ttt_logic_role that can be used if you were traitor on the last round is the door to the vending machine on ttt_waterworld

@svdm

This comment has been minimized.

Collaborator

svdm commented Nov 20, 2016

This change would break the role selection when the round begins. See https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/terrortown/gamemode/init.lua#L853
The currently assigned role is used in the selection process to lower the chances of being traitor multiple rounds in a row.

Perhaps an alternative fix would be to change ttt_logic_role to consider every player to be innocent if the round is preparing.

@@ -24,7 +24,7 @@ end
function ENT:AcceptInput(name, activator)
if name == "TestActivator" then
if IsValid(activator) and activator:IsPlayer() and (self.Role == ROLE_ANY or activator:IsRole(self.Role)) then
if IsValid(activator) and activator:IsPlayer() and (self.Role == ROLE_ANY or activator:IsActiveRole(self.Role)) then

This comment has been minimized.

@svdm

svdm Nov 20, 2016

Collaborator

Just using IsActiveRole was my first thought as well, but it's not ideal. It will return false even if the ttt_logic_role is checking for ROLE_INNOCENT, if it's during the prep or post round. Similarly a check for traitors will be false if it's post round, so a traitor in a traitor-room would be stuck in there for the whole post-round phase.

Perhaps something like this

local activator_role = (GetRoundState() == ROUND_PREP) and ROLE_INNOCENT or activator:GetRole()

Which you could then compare to self.Role. Of course you'd also need to do the IsPlayer check before that.

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 20, 2016

It should work. (I tested it and it worked for me.)

@robotboy655 robotboy655 added the TTT label Nov 20, 2016

@Faerachnidendro

Faerachnidendro suggested changes Nov 21, 2016 edited

Change:
local activator_role = (GetRoundState() == ROUND_PREP) and ROLE_INNOCENT or activator:GetRole()

To:
local activator_role = (GetRoundState() != ROUND_ACTIVE) and ROLE_INNOCENT or activator:GetRole()

Reason:
So that waiting, preparing and finished round states are all taken into account, instead of just preparing.

(excuse my posting this as a 'changes' review, clicked the wrong thing)

@mcNuggets1

This comment has been minimized.

Contributor

mcNuggets1 commented Nov 21, 2016

This change is needed.
Because TargetID shows detectives on preparing and a traitor mark in the scoreboard, even a red or blue crosshair.

@svdm

This comment has been minimized.

Collaborator

svdm commented Nov 21, 2016

@Faerachnidendro We don't actually want the finished/post-round phase to be handled the same way. Players who were traitor during the round should still be able to operate e.g. traitor-only doors in the post-round phase. That's why I specifically suggested the check on prep. Ideally it would be a check for waiting or prep, but that makes it more involved for very little benefit (during waiting everyone should be spectator'd anyway).

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 21, 2016

That traitors are displayed in the scoreboard as traitors is a wanted behavior, isn't it?
I can change that players which were detectives aren't shown as detectives in preparing. Should I do that?

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 21, 2016

Now everyone should be happy. I squashed the commits together.

@bmwalters

This comment has been minimized.

Contributor

bmwalters commented Nov 21, 2016

You seemed to miss the commit message there. Can't say I've seen that 😂

@markusmarkusz

This comment has been minimized.

Contributor

markusmarkusz commented Nov 21, 2016

Google translator has eaten the message. Sorry. 🙄

@Faerachnidendro

This comment has been minimized.

Contributor

Faerachnidendro commented Nov 21, 2016

@svdm Aah, makes sense I guess. Doesn't really change much to use a traitor button during post-round anyway, the round being over and all.

@bmwalters

This comment has been minimized.

Contributor

bmwalters commented Nov 21, 2016

@markusmarkusz

git checkout patch-3
git commit --amend
# edit the commit message in the editor
git push -f
@mcNuggets1

This comment has been minimized.

Contributor

mcNuggets1 commented Nov 27, 2016

Will this be merged :L?

@svdm svdm merged commit 0a904ad into Facepunch:master Nov 28, 2016

@markusmarkusz markusmarkusz deleted the markusmarkusz:patch-3 branch Feb 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment