Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
dad1a19
Now we're cooking
N1Ran Jan 27, 2019
617f8a4
Voting updated with reset for admins
N1Ran Feb 2, 2019
93e01e5
This is the percentage limiter for voting system...derp
N1Ran Feb 2, 2019
c2cd494
funsies
N1Ran Feb 3, 2019
b21be2d
?
N1Ran Feb 3, 2019
fedea70
voting module updated
N1Ran Feb 6, 2019
1591f95
voting module updated
N1Ran Feb 7, 2019
8347c1f
voting module updated.
N1Ran Feb 7, 2019
77dc054
Merge branch 'Patron' into ToPatron
N1Ran Feb 9, 2019
aeb591a
GPS Marker for grids list command
N1Ran Feb 9, 2019
b9239dc
some faction functions
N1Ran Feb 9, 2019
514ea6e
List players online
N1Ran Feb 9, 2019
1ba4878
Faction functions
N1Ran Feb 10, 2019
a33e369
New method to calculate vote
N1Ran Feb 10, 2019
6592cbe
new method to calculate votes
N1Ran Feb 10, 2019
86af0de
twe
N1Ran Feb 10, 2019
72d72e0
tweak
N1Ran Feb 10, 2019
b44e4df
Booyah
N1Ran Feb 11, 2019
0160488
Added command to list players online with admin command (useful for d…
N1Ran Feb 11, 2019
e8a59a6
Added GPS marker option to Grids list command
N1Ran Feb 11, 2019
5cb7f03
added faction list and faction remove option to faction command
N1Ran Feb 11, 2019
a528dc1
Resolving conflict before uploading
N1Ran Feb 11, 2019
7271434
Rex's faction removal merged
N1Ran Feb 11, 2019
cb3d6c7
updated with patrol Torch
N1Ran Feb 11, 2019
3c4d312
comma makes a major difference
N1Ran Feb 13, 2019
e602ea5
Resolve
N1Ran Feb 14, 2019
57f4262
Merger
N1Ran Feb 14, 2019
cecb2de
New Faction feation
N1Ran Feb 15, 2019
3115e8d
AutoCommands revamp in progress
N1Ran Feb 16, 2019
9722ca0
Yet another fix for the damned voting module
N1Ran Feb 17, 2019
3a71685
AutoCommands major tweaks and another go at fixing the damned voting …
N1Ran Feb 17, 2019
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
?
  • Loading branch information
N1Ran committed Feb 3, 2019
commit b21be2d439fc33796e2ffae9de2f3095353eae75
2 changes: 1 addition & 1 deletion Essentials/AutoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public string VoteDuration
public int Percentage
{
get => _votepercentage;
set => SetValue(ref _votepercentage, Math.Abs(Math.Min(value, 100)));
set => SetValue(ref _votepercentage, Math.Min(value, 100));
}

[Display(Name = "Day of week", GroupName = "Schedule", Description = "Combined with Scheduled Time, will run the command on the given day of the week at the set time.")]
Expand Down
20 changes: 0 additions & 20 deletions Essentials/Commands/AdminModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,6 @@ public void PlayerCount(int count = -1)
MyMultiplayer.Static.MemberLimit = count;
Context.Respond($"Max player count: {MyMultiplayer.Static.MemberLimit}. Current online players: {MyMultiplayer.Static.MemberCount - 1}");
}
[Command("playerlist", "Lists all online players on the server")]
[Permission(MyPromoteLevel.Admin)]
public void PlayerList()
{
if(MyMultiplayer.Static.MemberCount < 2)
{
Context.Respond("No players online");
return;
}
StringBuilder sb = new StringBuilder();
foreach(var player in MySession.Static.Players.GetOnlinePlayers())
{
if (!MySession.Static.Players.IdentityIsNpc(player.Identity.IdentityId))
{
sb.Append($"{player.DisplayName}, ");
}
}

Context.Respond(sb.ToString());
}

[Command("runauto", "Runs the auto command with the given name immediately")]
[Permission(MyPromoteLevel.Admin)]
Expand Down
25 changes: 5 additions & 20 deletions Essentials/Commands/VotingModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Sandbox.Game.World;
using Sandbox.Engine.Multiplayer;
using Torch.API.Managers;
using Torch.Commands;
using Torch.Commands.Permissions;
Expand Down Expand Up @@ -183,7 +183,7 @@ public void VoteCount()
StringBuilder sb = new StringBuilder();
sb.AppendLine($"Current vote: {voteInProgress}");
sb.AppendLine($"vote Status: {VoteStatus.ToString()}");
sb.AppendLine($"vote count: {_voteReg.Count} / player count: {MySession.Static.Players.GetOnlinePlayerCount()}");
sb.AppendLine($"vote count: {_voteReg.Count} / player count: {MyMultiplayer.Static.MemberCount - 1}");
sb.AppendLine($"vote percent: {votePercent}");
Context.Respond(sb.ToString());

Expand All @@ -202,7 +202,7 @@ private IEnumerable VoteCountdown(TimeSpan time)
{
Context.Torch.CurrentSession.Managers.GetManager<IChatManagerClient>()
.SendMessageAsSelf($"Vote for {voteInProgress} cancelled");
VoteClear();
VoteReset();
yield break;
}

Expand All @@ -222,7 +222,7 @@ private IEnumerable VoteCountdown(TimeSpan time)
}
else
{
votePercent = (int)Math.Round((double)100 * (_voteReg.Count / (MySession.Static.Players.GetOnlinePlayerCount())));
votePercent = (int)Math.Round((double)100 * (_voteReg.Count / (MyMultiplayer.Static.MemberCount - 1)));

if (votePercent >= command.Percentage)
{
Expand All @@ -235,28 +235,13 @@ private IEnumerable VoteCountdown(TimeSpan time)
Context.Torch.CurrentSession.Managers.GetManager<IChatManagerClient>()
.SendMessageAsSelf($"Vote for {voteInProgress} failed");
}
VoteClear();
VoteReset();
yield break;
}
}
}

[Command("vote reset", "Reset all vote logs")]
[Permission(MyPromoteLevel.Admin)]
public void VoteReset()
{
if (VoteStatus == Status.VoteInProgress)
{
VoteCancel();
}
else
VoteClear();
VoteClear();
votePercent = 0;
_votetimeout.Clear();
}

public void VoteClear()
{
Random rnd = new Random();
_cooldown = rnd.Next(5, 30);
Expand Down
28 changes: 0 additions & 28 deletions Essentials/Commands/WorldModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,34 +96,6 @@ public void CleanFactions(int memberCount = 1)
Context.Respond($"Removed {count} factions with fewer than {memberCount} members.");
}

[Command("faction delete", "Remove faction by designated tag.")]
public void DeleteFaction(string factionName)
{
foreach(var faction in MySession.Static.Factions.ToList())
{
if (faction.Value.Tag == factionName)
{
RemoveFaction(faction.Value);
Context.Respond($"{factionName} has been removed");
return;
}

}
Context.Respond($"Could not find any faction with the tag, {factionName}");

}

[Command("faction list", "List all current factions")]
public void ListFactions()
{
StringBuilder sb = new StringBuilder();
foreach (var faction in MySession.Static.Factions.ToList())
{
sb.Append($" {faction.Value.Tag}({faction.Value.Members.Count}) ");
}
Context.Respond($"{sb.ToString()}");
}

private static void RemoveEmptyFactions()
{
CleanFaction_Internal(1);
Expand Down