Skip to content

Commit 844c25d

Browse files
committed
Added NoUnitName custom flag and Team check for UnitName
1 parent c8c124b commit 844c25d

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

UncomplicatedCustomRoles/API/Features/CustomInfo.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,13 @@ public void UpdateInfo(Player player)
142142
}
143143
}
144144

145-
if (!string.IsNullOrEmpty(rawRole)
146-
&& NamingRulesManager.TryGetNamingRule(summonedCustomRole.Role.Role.GetTeam(), out UnitNamingRule unitNamingRule)
145+
Team roleTeam = summonedCustomRole.Role.Role.GetTeam();
146+
if (DisguiseTeam.List.TryGetValue(player.PlayerId, out Team fakeTeam))
147+
roleTeam = fakeTeam;
148+
149+
if (!string.IsNullOrEmpty(rawRole) && !summonedCustomRole.HasModule<NoUnitName>()
150+
&& roleTeam is Team.FoundationForces
151+
&& NamingRulesManager.TryGetNamingRule(roleTeam, out UnitNamingRule unitNamingRule)
147152
&& !string.IsNullOrEmpty(unitNamingRule.LastGeneratedName))
148153
rawRole = $"{rawRole} ({unitNamingRule.LastGeneratedName})";
149154
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* This file is a part of the UncomplicatedCustomRoles project.
3+
*
4+
* Copyright (c) 2023-present FoxWorn3365 (Federico Cosma) <me@fcosma.it>
5+
*
6+
* This file is licensed under the GNU Affero General Public License v3.0.
7+
* You should have received a copy of the AGPL license along with this file.
8+
* If not, see <https://www.gnu.org/licenses/>.
9+
*/
10+
11+
namespace UncomplicatedCustomRoles.API.Features.CustomModules
12+
{
13+
public class NoUnitName : CustomModule
14+
{ }
15+
}

0 commit comments

Comments
 (0)