mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
precautions for role configs
This commit is contained in:
1 parent
1428c629b8
commit
84651b90ea
2 files changed
+18
-18
No files matched your search
@@ -9,9 +9,9 @@ public class FreezerRole : ImpostorRole, ICustomRole
|
|||||||
{
|
{
|
||||||
public string RoleName => "Freezer";
|
public string RoleName => "Freezer";
|
||||||
public string RoleLongDescription => "Freeze another player for a duration of time.";
|
public string RoleLongDescription => "Freeze another player for a duration of time.";
|
||||||
public string RoleDescription => RoleLongDescription;
|
public string RoleDescription => this.RoleLongDescription;
|
||||||
public Color RoleColor => Palette.Blue;
|
public Color RoleColor => Palette.Blue;
|
||||||
public ModdedRoleTeams Team => ModdedRoleTeams.Impostor;
|
public ModdedRoleTeams Team => ModdedRoleTeams.Impostor;
|
||||||
public LoadableAsset<Sprite> OptionsScreenshot => ExampleAssets.Banner;
|
public LoadableAsset<Sprite> OptionsScreenshot => ExampleAssets.Banner;
|
||||||
public int MaxPlayers => 2;
|
public int MaxPlayers => 2;
|
||||||
}
|
}
|
||||||
@@ -30,29 +30,29 @@ public interface ICustomRole
|
|||||||
|
|
||||||
LoadableAsset<Sprite> Icon => MiraAssets.Empty;
|
LoadableAsset<Sprite> Icon => MiraAssets.Empty;
|
||||||
|
|
||||||
ConfigDefinition NumConfigDefinition => new("Roles", $"Num{RoleName}");
|
ConfigDefinition NumConfigDefinition => new("Roles", $"Num {this.GetType().FullName}");
|
||||||
|
|
||||||
ConfigDefinition ChanceConfigDefinition => new("Roles", $"Chance{RoleName}");
|
ConfigDefinition ChanceConfigDefinition => new("Roles", $"Chance {this.GetType().FullName}");
|
||||||
|
|
||||||
bool AffectedByLight => Team == ModdedRoleTeams.Crewmate;
|
bool AffectedByLight => this.Team == ModdedRoleTeams.Crewmate;
|
||||||
|
|
||||||
bool CanGetKilled => Team == ModdedRoleTeams.Crewmate;
|
bool CanGetKilled => this.Team == ModdedRoleTeams.Crewmate;
|
||||||
|
|
||||||
bool IsNeutral => Team == ModdedRoleTeams.Neutral;
|
bool IsNeutral => this.Team == ModdedRoleTeams.Neutral;
|
||||||
|
|
||||||
bool CanKill => Team == ModdedRoleTeams.Impostor;
|
bool CanKill => this.Team == ModdedRoleTeams.Impostor;
|
||||||
|
|
||||||
bool CanUseVent => Team == ModdedRoleTeams.Impostor;
|
bool CanUseVent => this.Team == ModdedRoleTeams.Impostor;
|
||||||
|
|
||||||
bool TasksCount => Team == ModdedRoleTeams.Crewmate;
|
bool TasksCount => this.Team == ModdedRoleTeams.Crewmate;
|
||||||
|
|
||||||
bool IsGhostRole => false;
|
bool IsGhostRole => false;
|
||||||
|
|
||||||
bool CreateCustomTab => true;
|
bool CreateCustomTab => true;
|
||||||
|
|
||||||
bool HideSettings => IsGhostRole;
|
bool HideSettings => this.IsGhostRole;
|
||||||
|
|
||||||
RoleTypes GhostRole => Team == ModdedRoleTeams.Crewmate ? RoleTypes.CrewmateGhost : RoleTypes.ImpostorGhost;
|
RoleTypes GhostRole => this.Team == ModdedRoleTeams.Crewmate ? RoleTypes.CrewmateGhost : RoleTypes.ImpostorGhost;
|
||||||
|
|
||||||
MiraPluginInfo ParentMod => CustomRoleManager.FindParentMod(this);
|
MiraPluginInfo ParentMod => CustomRoleManager.FindParentMod(this);
|
||||||
|
|
||||||
@@ -68,9 +68,9 @@ public interface ICustomRole
|
|||||||
/// <param name="hudManager">Reference to HudManager instance</param>
|
/// <param name="hudManager">Reference to HudManager instance</param>
|
||||||
void HudUpdate(HudManager hudManager) { }
|
void HudUpdate(HudManager hudManager) { }
|
||||||
|
|
||||||
string GetCustomEjectionMessage(NetworkedPlayerInfo player)
|
string? GetCustomEjectionMessage(NetworkedPlayerInfo player)
|
||||||
{
|
{
|
||||||
return Team == ModdedRoleTeams.Impostor ? $"{player.PlayerName} was The {RoleName}" : null;
|
return this.Team == ModdedRoleTeams.Impostor ? $"{player.PlayerName} was The {this.RoleName}" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder SetTabText()
|
StringBuilder SetTabText()
|
||||||
@@ -86,9 +86,9 @@ public interface ICustomRole
|
|||||||
|
|
||||||
NetData GetNetData()
|
NetData GetNetData()
|
||||||
{
|
{
|
||||||
ParentMod.PluginConfig.TryGetEntry<int>(NumConfigDefinition, out var numEntry);
|
this.ParentMod.PluginConfig.TryGetEntry<int>(this.NumConfigDefinition, out var numEntry);
|
||||||
ParentMod.PluginConfig.TryGetEntry<int>(ChanceConfigDefinition, out var chanceEntry);
|
this.ParentMod.PluginConfig.TryGetEntry<int>(this.ChanceConfigDefinition, out var chanceEntry);
|
||||||
|
|
||||||
return new NetData(RoleId.Get(GetType()), BitConverter.GetBytes(numEntry.Value).AddRangeToArray(BitConverter.GetBytes(chanceEntry.Value)));
|
return new NetData(RoleId.Get(this.GetType()), BitConverter.GetBytes(numEntry.Value).AddRangeToArray(BitConverter.GetBytes(chanceEntry.Value)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user