From e561d17ecf3c8805e6b2fc22be975f1cea1b7ac1 Mon Sep 17 00:00:00 2001 From: PintTheDragon Date: Sat, 20 Jun 2020 23:14:48 -0700 Subject: [PATCH] Fixed guard/scientist combo --- BuddyPlugin.cs | 3 +++ RoundStartHandler.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/BuddyPlugin.cs b/BuddyPlugin.cs index 27a6d73..1ec63a0 100644 --- a/BuddyPlugin.cs +++ b/BuddyPlugin.cs @@ -67,6 +67,8 @@ public class BuddyPlugin : Plugin public Boolean forceExactRole = false; + public Boolean disallowGuardScientistCombo = true; + public Dictionary buddies = new Dictionary(); public Dictionary buddyRequests = new Dictionary(); @@ -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) diff --git a/RoundStartHandler.cs b/RoundStartHandler.cs index 13944c9..e4c4820 100644 --- a/RoundStartHandler.cs +++ b/RoundStartHandler.cs @@ -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