Skip to content

Commit

Permalink
Update to latest unturned libs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pustalorc committed Aug 7, 2021
1 parent d9fe5f1 commit bc39fa1
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 76 deletions.
1 change: 0 additions & 1 deletion AutoTurnOff.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Buildable.cs" />
<Compile Include="Configuration\AutoTurnOffConfiguration.cs" />
<Compile Include="AutoTurnOffPlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
29 changes: 9 additions & 20 deletions AutoTurnOffPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

namespace Pustalorc.Plugins.AutoTurnOff
{
// This references the original objects. Changes done to them should be reflected in the property accessors here.
public class AutoTurnOffPlugin : RocketPlugin<AutoTurnOffConfiguration>
public sealed class AutoTurnOffPlugin : RocketPlugin<AutoTurnOffConfiguration>
{
protected override void Load()
{
Expand All @@ -32,24 +31,15 @@ private void Disconnected([NotNull] UnturnedPlayer player)
if (BarricadeManager.regions == null)
return;

var regions = BarricadeManager.regions.Cast<BarricadeRegion>().Concat(BarricadeManager.vehicleRegions)
.ToList();
var drops = regions.SelectMany(k => k.drops).ToList();
var data = regions.SelectMany(k => k.barricades).ToList();
var buildables = data.Select((k, i) =>
{
if (!Configuration.Instance.ItemsToDisable.Contains(k.barricade.asset.id))
return null;
var buildables = BarricadeManager.regions.Cast<BarricadeRegion>().Concat(BarricadeManager.vehicleRegions)
.SelectMany(k => k.drops)
.Select(k =>
!Configuration.Instance.ItemsToDisable.Contains(k.asset.id) ||
k.GetServersideData().owner != playerId
? null
: k.interactable).Where(k => k != null).ToList();

if (k.owner != playerId)
return null;

var drop = drops.ElementAt(i);
return drop == null ? null : new Buildable(k, drop);
}).Where(k => k != null).ToList();

foreach (var interactable in buildables.Select(build => build.Interactable))
{
foreach (var interactable in buildables)
switch (interactable)
{
case InteractableSafezone saf:
Expand All @@ -74,7 +64,6 @@ private void Disconnected([NotNull] UnturnedPlayer player)
BarricadeManager.ServerSetStereoTrack(stereo, Guid.Empty);
break;
}
}

Logger.Log($"Turned off {buildables.Count} barricades.");
}
Expand Down
50 changes: 0 additions & 50 deletions Buildable.cs

This file was deleted.

8 changes: 5 additions & 3 deletions Configuration/AutoTurnOffConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Rocket.API;

namespace Pustalorc.Plugins.AutoTurnOff.Configuration
{
[Serializable]
public sealed class AutoTurnOffConfiguration : IRocketPluginConfiguration
{
public List<ushort> ItemsToDisable;
public HashSet<ushort> ItemsToDisable;

public void LoadDefaults()
{
ItemsToDisable = new List<ushort>
ItemsToDisable = new HashSet<ushort>
{
458, 1230, 362, 459, 1050, 1466, 1250, 1261, 359, 360, 361, 1049, 1222
};
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("6F6CE51E-2501-4717-8948-CEC7028F79AA")]
[assembly: AssemblyVersion("1.1.2")]
[assembly: AssemblyFileVersion("1.1.2")]
[assembly: AssemblyVersion("1.2.0")]
[assembly: AssemblyFileVersion("1.2.0")]
Binary file modified lib/Assembly-CSharp.dll
Binary file not shown.
Binary file modified lib/Rocket.Unturned.dll
Binary file not shown.
Binary file modified lib/SDG.NetTransport.dll
Binary file not shown.
Binary file modified lib/Steamworks.NET.dll
Binary file not shown.
Binary file modified lib/UnityEngine.CoreModule.dll
Binary file not shown.
Binary file modified lib/UnityEngine.PhysicsModule.dll
Binary file not shown.
Binary file modified lib/UnityEngine.dll
Binary file not shown.

0 comments on commit bc39fa1

Please sign in to comment.