mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b6d6209b0 |
No files matched your search
@@ -1,12 +1,13 @@
|
|||||||
using System;
|
using AmongUs.GameOptions;
|
||||||
using AmongUs.GameOptions;
|
|
||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
using MiraAPI.Utilities;
|
|
||||||
using MiraAPI.Utilities.Assets;
|
|
||||||
using System.Text;
|
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using MiraAPI.Networking;
|
using MiraAPI.Networking;
|
||||||
using MiraAPI.PluginLoading;
|
using MiraAPI.PluginLoading;
|
||||||
|
using MiraAPI.Teams.Teams;
|
||||||
|
using MiraAPI.Utilities;
|
||||||
|
using MiraAPI.Utilities.Assets;
|
||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace MiraAPI.Roles;
|
namespace MiraAPI.Roles;
|
||||||
@@ -21,7 +22,7 @@ public interface ICustomRole
|
|||||||
|
|
||||||
Color RoleColor { get; }
|
Color RoleColor { get; }
|
||||||
|
|
||||||
ModdedRoleTeams Team { get; }
|
Type Team { get; }
|
||||||
|
|
||||||
LoadableAsset<Sprite> OptionsScreenshot => MiraAssets.Empty;
|
LoadableAsset<Sprite> OptionsScreenshot => MiraAssets.Empty;
|
||||||
|
|
||||||
@@ -31,17 +32,15 @@ public interface ICustomRole
|
|||||||
|
|
||||||
ConfigDefinition ChanceConfigDefinition => new("Roles", $"Chance{RoleName}");
|
ConfigDefinition ChanceConfigDefinition => new("Roles", $"Chance{RoleName}");
|
||||||
|
|
||||||
bool AffectedByLight => Team == ModdedRoleTeams.Crewmate;
|
bool AffectedByLight => Team == typeof(CrewmateTeam);
|
||||||
|
|
||||||
bool CanGetKilled => Team == ModdedRoleTeams.Crewmate;
|
bool CanGetKilled => Team == typeof(CrewmateTeam);
|
||||||
|
|
||||||
bool IsNeutral => Team == ModdedRoleTeams.Neutral;
|
bool CanKill => Team == typeof(ImpostorTeam);
|
||||||
|
|
||||||
bool CanKill => Team == ModdedRoleTeams.Impostor;
|
bool CanUseVent => Team == typeof(ImpostorTeam);
|
||||||
|
|
||||||
bool CanUseVent => Team == ModdedRoleTeams.Impostor;
|
bool TasksCount => Team == typeof(CrewmateTeam);
|
||||||
|
|
||||||
bool TasksCount => Team == ModdedRoleTeams.Crewmate;
|
|
||||||
|
|
||||||
bool IsGhostRole => false;
|
bool IsGhostRole => false;
|
||||||
|
|
||||||
@@ -51,17 +50,17 @@ public interface ICustomRole
|
|||||||
|
|
||||||
bool HideSettings => IsGhostRole;
|
bool HideSettings => IsGhostRole;
|
||||||
|
|
||||||
RoleTypes GhostRole => Team == ModdedRoleTeams.Crewmate ? RoleTypes.CrewmateGhost : RoleTypes.ImpostorGhost;
|
RoleTypes GhostRole => Team == typeof(CrewmateRole) ? RoleTypes.CrewmateGhost : RoleTypes.ImpostorGhost;
|
||||||
|
|
||||||
MiraPluginInfo ParentMod => CustomRoleManager.FindParentMod(this);
|
MiraPluginInfo ParentMod => CustomRoleManager.FindParentMod(this);
|
||||||
|
|
||||||
void PlayerControlFixedUpdate(PlayerControl playerControl) { }
|
void PlayerControlFixedUpdate(PlayerControl playerControl) { }
|
||||||
|
|
||||||
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 Team == typeof(ImpostorTeam) ? $"{player.PlayerName} was The {RoleName}" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder SetTabText()
|
StringBuilder SetTabText()
|
||||||
@@ -69,12 +68,12 @@ public interface ICustomRole
|
|||||||
var taskStringBuilder = Helpers.CreateForRole(this);
|
var taskStringBuilder = Helpers.CreateForRole(this);
|
||||||
return taskStringBuilder;
|
return taskStringBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetData GetNetData(RoleBehaviour roleBehaviour)
|
NetData GetNetData(RoleBehaviour roleBehaviour)
|
||||||
{
|
{
|
||||||
ParentMod.PluginConfig.TryGetEntry<int>(NumConfigDefinition, out var numEntry);
|
ParentMod.PluginConfig.TryGetEntry<int>(NumConfigDefinition, out var numEntry);
|
||||||
ParentMod.PluginConfig.TryGetEntry<int>(ChanceConfigDefinition, out var chanceEntry);
|
ParentMod.PluginConfig.TryGetEntry<int>(ChanceConfigDefinition, out var chanceEntry);
|
||||||
|
|
||||||
return new NetData((uint)roleBehaviour.Role, BitConverter.GetBytes(numEntry.Value).AddRangeToArray(BitConverter.GetBytes(chanceEntry.Value)));
|
return new NetData((uint)roleBehaviour.Role, BitConverter.GetBytes(numEntry.Value).AddRangeToArray(BitConverter.GetBytes(chanceEntry.Value)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MiraAPI.Teams;
|
||||||
|
public abstract class BaseTeam
|
||||||
|
{
|
||||||
|
public abstract string TeamName { get; }
|
||||||
|
public abstract string TeamDescription { get; }
|
||||||
|
public abstract Color TeamColor { get; }
|
||||||
|
public abstract RoleTeamTypes BaseRole { get; }
|
||||||
|
|
||||||
|
public abstract bool DidWin(GameOverReason reason);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MiraAPI.Teams.Teams;
|
||||||
|
public class CrewmateTeam : BaseTeam
|
||||||
|
{
|
||||||
|
public override string TeamName => "Crewmate";
|
||||||
|
|
||||||
|
public override string TeamDescription => "Do your tasks";
|
||||||
|
|
||||||
|
public override Color TeamColor => Palette.CrewmateBlue;
|
||||||
|
|
||||||
|
public override RoleTeamTypes BaseRole => RoleTeamTypes.Crewmate;
|
||||||
|
|
||||||
|
public override bool DidWin(GameOverReason reason)
|
||||||
|
{
|
||||||
|
return GameManager.Instance.DidHumansWin(reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MiraAPI.Teams.Teams;
|
||||||
|
public class ImpostorTeam : BaseTeam
|
||||||
|
{
|
||||||
|
public override string TeamName => "Impostor";
|
||||||
|
|
||||||
|
public override string TeamDescription => "Kill and sabotage";
|
||||||
|
|
||||||
|
public override Color TeamColor => Palette.ImpostorRed;
|
||||||
|
|
||||||
|
public override RoleTeamTypes BaseRole => RoleTeamTypes.Impostor;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MiraAPI.Teams.Teams;
|
||||||
|
public class NeutralTeam : BaseTeam
|
||||||
|
{
|
||||||
|
public override string TeamName => "Neutral";
|
||||||
|
|
||||||
|
public override string TeamDescription => "You're on your own";
|
||||||
|
|
||||||
|
public override Color TeamColor => Palette.DisabledGrey;
|
||||||
|
|
||||||
|
public override RoleTeamTypes BaseRole => RoleTeamTypes.Crewmate;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user