Skip to content
This repository has been archived by the owner on Feb 28, 2021. It is now read-only.

Commit

Permalink
Fixed guard/scientist combo
Browse files Browse the repository at this point in the history
  • Loading branch information
PintTheDragon committed Jun 21, 2020
1 parent 6624160 commit e561d17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions BuddyPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public class BuddyPlugin : Plugin

public Boolean forceExactRole = false;

public Boolean disallowGuardScientistCombo = true;

public Dictionary<string, Player> buddies = new Dictionary<string, Player>();

public Dictionary<string, Player> buddyRequests = new Dictionary<string, Player>();
Expand All @@ -88,6 +90,7 @@ public override void Register()
{
this.AddConfig(new ConfigSetting("buddy_enabled", enabled, true, "Enables/disables the plugin."));
this.AddConfig(new ConfigSetting("buddy_force_exact_role", forceExactRole, true, "Makes a player the exact role as their buddy."));
this.AddConfig(new ConfigSetting("buddy_disallow_guard_scientist_combo", disallowGuardScientistCombo, true, "If true, buddies will never spawn in as a guard and scientist. Only both a guard or both a scientist."));
this.enabled = this.GetConfigBool("buddy_enabled");
this.forceExactRole = this.GetConfigBool("buddy_force_exact_role");
if (!this.enabled)
Expand Down
4 changes: 2 additions & 2 deletions RoundStartHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public void OnRoundStart(RoundStartEvent ev)
buddyPlugin.buddies.TryGetValue(player.UserId, out buddy);
if (buddy == null) continue;
//take action if they have different roles
if(player.TeamRole.Role != buddy.TeamRole.Role ||
if(player.TeamRole.Role != buddy.TeamRole.Role &&
/* massive check for scientist/guard combo */
((player.TeamRole.Role == RoleType.FACILITY_GUARD && buddy.TeamRole.Role == RoleType.SCIENTIST) || (player.TeamRole.Role == RoleType.SCIENTIST && buddy.TeamRole.Role == RoleType.FACILITY_GUARD))
!(!buddyPlugin.disallowGuardScientistCombo && ((player.TeamRole.Role == RoleType.FACILITY_GUARD && buddy.TeamRole.Role == RoleType.SCIENTIST) || (player.TeamRole.Role == RoleType.SCIENTIST && buddy.TeamRole.Role == RoleType.FACILITY_GUARD)))
)
{
//if force exact role is on we can just set the buddy to the other player's role
Expand Down

0 comments on commit e561d17

Please sign in to comment.