Skip to content

Commit e77f39d

Browse files
authored
fix sandbox clean removing faction reputations (#159)
* Some requested commands * Fix sandbox clean removing faction reputations. * fixed merger Co-authored-by: Olatide F <tide1988@live.com>
1 parent 90cebb6 commit e77f39d

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎Essentials/Commands/WorldModule.cs‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Threading.Tasks;
77
using NLog;
88
using Sandbox.Engine.Multiplayer;
9+
using Sandbox.Game;
910
using Sandbox.Game.Entities;
1011
using Sandbox.Game.Entities.Character;
1112
using Sandbox.Game.Gui;
@@ -27,7 +28,6 @@
2728
using VRage.Game;
2829
using VRage.Game.ModAPI;
2930
using VRage.Network;
30-
using Sandbox.Game;
3131

3232
namespace Essentials.Commands
3333
{
@@ -213,7 +213,7 @@ private static bool RemoveFromFaction_Internal(MyIdentity identity)
213213
var fac = MySession.Static.Factions.GetPlayerFaction(identity.IdentityId);
214214
if (fac == null)
215215
return false;
216-
216+
217217
/*
218218
* VisualScriptLogicProvider takes care of removal of faction if last
219219
* identity is kicked, and promotes the next player in line to Founder
@@ -446,6 +446,12 @@ private static int CleanupReputations()
446446
}
447447
}
448448

449+
//Add Factions with at least one member to valid identities
450+
foreach (var faction in MySession.Static.Factions.Factions.Where(x=>x.Value.Members.Count > 0))
451+
{
452+
validIdentities.Add(faction.Key);
453+
}
454+
449455

450456
//might not be necessary, but just in case
451457
validIdentities.Remove(0);
@@ -459,13 +465,15 @@ private static int CleanupReputations()
459465
if (validIdentities.Contains(pair.RelateeId1) && validIdentities.Contains(pair.RelateeId2))
460466
continue;
461467
collection.Remove(pair);
468+
result++;
462469
}
463470

464471
foreach (var pair in collection1List)
465472
{
466473
if (validIdentities.Contains(pair.RelateeId1) && validIdentities.Contains(pair.RelateeId2))
467474
continue;
468475
collection2.Remove(pair);
476+
result++;
469477
}
470478

471479

0 commit comments

Comments
 (0)