mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 11:39:45 +00:00
voting API improvements
This commit is contained in:
1 parent
bad6648f44
commit
0b9e54eb50
9 files changed
+70
-46
No files matched your search
@@ -1,5 +1,4 @@
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using MiraAPI.Events;
|
||||
using MiraAPI.Events.Mira;
|
||||
using MiraAPI.Events.Vanilla.Gameplay;
|
||||
@@ -43,7 +42,7 @@ public static class ExampleEventHandlers
|
||||
{
|
||||
if (plr.Data.Role is MayorRole)
|
||||
{
|
||||
plr.GetVoteData().AddVotes(1);
|
||||
plr.GetVoteData().IncreaseRemainingVotes(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,9 +51,9 @@ public static class ExampleEventHandlers
|
||||
[RegisterEvent(15)]
|
||||
public static void HandleVoteEvent(HandleVoteEvent @event)
|
||||
{
|
||||
if (@event.VoteData.Owner?.Data.Role is not NeutralKillerRole) return;
|
||||
if (@event.VoteData.Owner.Data.Role is not NeutralKillerRole) return;
|
||||
|
||||
@event.VoteData.SetVotesRemaining(0);
|
||||
@event.VoteData.SetRemainingVotes(0);
|
||||
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
@@ -63,7 +62,7 @@ public static class ExampleEventHandlers
|
||||
|
||||
foreach (var plr in PlayerControl.AllPlayerControls.ToArray().Where(player => player != @event.VoteData.Owner))
|
||||
{
|
||||
plr.GetVoteData().VotedPlayers.Clear();
|
||||
plr.GetVoteData().Votes.Clear();
|
||||
plr.GetVoteData().VotesRemaining = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user