Skip to content

Commit 756274b

Browse files
committed
Cleanup for public release
1 parent 2192151 commit 756274b

28 files changed

+1159
-132
lines changed

.idea/.idea.Voxelfield/.idea/indexLayout.xml

+3-28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.Voxelfield/.idea/riderModule.iml

-7
This file was deleted.

Assets/Assets.index

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
{
2-
"name": "Assets",
2+
"name": "",
33
"type": "asset",
44
"roots": [],
55
"includes": [],
66
"excludes": [
77
"Temp/",
88
"External/"
99
],
10-
"baseScore": 100,
1110
"options": {
1211
"disabled": false,
13-
"files": true,
14-
"directories": false,
1512
"types": true,
1613
"properties": false,
14+
"extended": false,
1715
"dependencies": false
18-
}
16+
},
17+
"baseScore": 100
1918
}

Assets/Assets.index.meta

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/Voxelfield/Config.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public class Config : DefaultConfig
1313
{
1414
private static Lazy<PostProcessVolume> _volume;
1515

16-
[Config(ConfigType.Session)] public VoxelMapNameProperty mapName = new VoxelMapNameProperty("Castle");
16+
[Config(ConfigType.Session)] public VoxelMapNameProperty mapName = new("Castle");
1717

18-
[Config] public BoolProperty enableMiniMap = new BoolProperty();
19-
[Config] public BoolProperty authenticateSteam = new BoolProperty();
18+
[Config] public BoolProperty enableMiniMap = new();
19+
[Config] public BoolProperty authenticateSteam = new();
2020

21-
public SecureAreaConfig secureAreaConfig = new SecureAreaConfig();
21+
public SecureAreaConfig secureAreaConfig = new();
2222

2323
public new static Config Active => (Config) DefaultConfig.Active;
2424

Assets/Scripts/Voxelfield/Editor/FleetGenerator.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ namespace Voxelfield.Editor
1414
{
1515
public static class FleetGenerator
1616
{
17-
private const string AccessKey = @"AKIA354QE4UEK73BYOGL", SecretKey = @"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"; // shaweewoo.jo
18-
// const string accessKey = @"AKIAWKQVDVRWSC42QICS", secretKey = @"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"; // shaweewoo.codes
19-
private static readonly BasicAWSCredentials Credentials = new BasicAWSCredentials(AccessKey, SecretKey);
17+
private const string AccessKey = @"", SecretKey = @"";
18+
private static readonly BasicAWSCredentials Credentials = new(AccessKey, SecretKey);
2019

2120
[MenuItem("Build/Create Game Lift Fleet", priority = 300)]
2221
private static async void CreateFleet()
@@ -51,7 +50,7 @@ private static async void CreateFleet()
5150
Debug.Log("Marked active fleet for termination");
5251
}
5352

54-
IpPermission CreateIpPermission(IpProtocol protocol) => new IpPermission
53+
IpPermission CreateIpPermission(IpProtocol protocol) => new()
5554
{
5655
FromPort = SessionManager.DefaultPort, IpRange = "0.0.0.0/0", Protocol = protocol, ToPort = SessionManager.DefaultPort + 1
5756
};
@@ -67,7 +66,7 @@ private static async void CreateFleet()
6766
{
6867
GameSessionActivationTimeoutSeconds = 600, MaxConcurrentGameSessionActivations = 1,
6968
ServerProcesses = new List<ServerProcess>
70-
{new ServerProcess {ConcurrentExecutions = 1, LaunchPath = "/local/game/Voxelfield", Parameters = "-logFile /local/game/server.log"}}
69+
{new() {ConcurrentExecutions = 1, LaunchPath = "/local/game/Voxelfield", Parameters = "-logFile /local/game/server.log"}}
7170
},
7271
NewGameSessionProtectionPolicy = ProtectionPolicy.FullProtection
7372
};

Assets/Scripts/Voxelfield/Integration/GameLiftClientManager.cs

+4-7
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,9 @@ namespace Voxelfield.Integration
2424
{
2525
public static class GameLiftClientManager
2626
{
27-
// private const string FleetAlias = "alias-c6bbceef-6fe9-4f60-9949-5db6b26350a1"; // shaweewoo.codes
28-
// private static readonly BasicAWSCredentials Credentials = new BasicAWSCredentials(@"AKIAWKQVDVRWQMYAUBAV", @"62ixippCgELFUDKgPlGnWqtd0WEZ3w51YhEnMK8C"); // shaweewoo.codes
29-
30-
private const string FleetAlias = "alias-860fde8f-5f40-45bb-8f17-2b10a8ed1f34"; // shaweewoo.jo
31-
private static readonly BasicAWSCredentials Credentials = new BasicAWSCredentials(@"AKIA354QE4UEBBDFV2G2", @"Az53naLwz6/PxGfCRvOMeNQv1Au1lsCGrpvfXOIB"); // shaweewoo.jo
32-
private static readonly AmazonGameLiftConfig Config = new AmazonGameLiftConfig
27+
private const string FleetAlias = "", AccessKey = @"", SecretKey = @"";
28+
private static readonly BasicAWSCredentials Credentials = new(AccessKey, SecretKey);
29+
private static readonly AmazonGameLiftConfig Config = new()
3330
{
3431
#if VOXELFIELD_RELEASE_CLIENT
3532
RegionEndpoint = RegionEndpoint.USWest1
@@ -38,7 +35,7 @@ public static class GameLiftClientManager
3835
ServiceURL = $"http://localhost:{SessionManager.DefaultPort}"
3936
#endif
4037
};
41-
private static readonly AmazonGameLiftClient Client = new AmazonGameLiftClient(Credentials, Config);
38+
private static readonly AmazonGameLiftClient Client = new(Credentials, Config);
4239

4340
public static string PlayerSessionId { get; private set; }
4441
public static string placementId;

Assets/Scripts/Voxelfield/Item/SculptingItem.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class SculptingItem : MeleeModifier
2626
protected override void Swing(in SessionContext context, ItemComponent item)
2727
{
2828
base.Swing(context, item); // Melee damage
29-
if (!(context.session.Injector is ServerInjector server) || WithoutHit(context, m_EditDistance, out RaycastHit hit)) return;
29+
if (context.session.Injector is not ServerInjector server || WithoutHit(context, m_EditDistance, out RaycastHit hit)) return;
3030

3131
var position = (Position3Int) (hit.point - hit.normal * 0.1f);
3232
if (WithoutBreakableVoxel(context, position, out Voxel voxel)) return;
@@ -117,7 +117,7 @@ protected override bool CanSecondaryUse(in SessionContext context, ItemComponent
117117
protected override void SecondaryUse(in SessionContext context)
118118
{
119119
// TODO:feature add client side prediction for placing blocks
120-
if (!(m_CachedPosition is { } position) || !(context.session.Injector is ServerInjector server)) return;
120+
if (m_CachedPosition is not { } position || context.session.Injector is not ServerInjector server) return;
121121

122122
PlaceBlock(context, server, position);
123123
}
@@ -191,7 +191,7 @@ protected override bool CanTertiaryUse(in SessionContext context, ItemComponent
191191

192192
protected override void TertiaryUse(in SessionContext context, ItemComponent item)
193193
{
194-
if (!(m_CachedPosition is { } position) || !(context.session.Injector is ServerInjector server)) return;
194+
if (m_CachedPosition is not { } position || context.session.Injector is not ServerInjector server) return;
195195

196196
var change = new VoxelChange
197197
{

Assets/Scripts/Voxelfield/Session/ClientInjector.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ namespace Voxelfield.Session
1313
{
1414
public partial class ClientInjector : Injector
1515
{
16-
private readonly Pool<OrderedVoxelChangesProperty> m_ChangesPool = new Pool<OrderedVoxelChangesProperty>(1, () => new OrderedVoxelChangesProperty());
17-
private readonly UIntProperty m_Pointer = new UIntProperty();
18-
private readonly SortedDictionary<uint, OrderedVoxelChangesProperty> m_OrderedTickChanges = new SortedDictionary<uint, OrderedVoxelChangesProperty>();
19-
private readonly TouchedChunks m_TouchedChunks = new TouchedChunks();
16+
private readonly Pool<OrderedVoxelChangesProperty> m_ChangesPool = new(1, () => new OrderedVoxelChangesProperty());
17+
private readonly UIntProperty m_Pointer = new();
18+
private readonly SortedDictionary<uint, OrderedVoxelChangesProperty> m_OrderedTickChanges = new();
19+
private readonly TouchedChunks m_TouchedChunks = new();
2020

2121
public override NetDataWriter GetConnectWriter()
2222
{

Assets/Scripts/Voxelfield/Session/ServerInjector.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,16 @@ public class ServerInjector : Injector
4848
private const int OutsideBoundDamage = 75;
4949

5050
#if VOXELFIELD_RELEASE_SERVER
51-
private static readonly BasicAWSCredentials DynamoCredentials = new BasicAWSCredentials(@"AKIAWKQVDVRW5MFWZJMG", @"rPxMDaGjpBiaJ9OuT/he5XU4g6rft8ykzXJDgLYP");
51+
private const string AccessKey = @"", SecretKey = @"";
52+
private static readonly BasicAWSCredentials DynamoCredentials = new BasicAWSCredentials(AccessKey, SecretKey);
5253
private static readonly AmazonDynamoDBConfig DynamoConfig = new AmazonDynamoDBConfig {RegionEndpoint = RegionEndpoint.USWest1};
5354
private static readonly AmazonDynamoDBClient DynamoClient = new AmazonDynamoDBClient(DynamoCredentials, DynamoConfig);
5455

5556
private readonly DualDictionary<NetPeer, string> m_GameLiftPlayerSessionIds = new DualDictionary<NetPeer, string>();
5657
#endif
5758

58-
private readonly OrderedVoxelChangesProperty m_MasterChanges = new OrderedVoxelChangesProperty();
59-
private readonly DualDictionary<NetPeer, SteamId> m_SteamPlayerIds = new DualDictionary<NetPeer, SteamId>();
59+
private readonly OrderedVoxelChangesProperty m_MasterChanges = new();
60+
private readonly DualDictionary<NetPeer, SteamId> m_SteamPlayerIds = new();
6061

6162
private bool m_UseSteam;
6263

Assets/Sprites/Icons.psd.meta

+12-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/Swihoni.Sessions/Runtime/Config/ConsoleCommandExecutor.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ public static class ConsoleCommandExecutor
1414

1515
private const int MaxPreviousCommands = 48;
1616

17-
public static List<string> PreviousCommands { get; } = new List<string>(MaxPreviousCommands);
17+
public static List<string> PreviousCommands { get; } = new(MaxPreviousCommands);
1818

19-
private static readonly Dictionary<string, Action<string[]>> Commands = new Dictionary<string, Action<string[]>>
19+
private static readonly Dictionary<string, Action<string[]>> Commands = new()
2020
{
2121
["clear"] = arguments => ConsoleInterface.Singleton.ClearConsole(),
2222
["quit"] = _ => Application.Quit()

Packages/Swihoni.Sessions/Runtime/Interfaces/ConsoleInterface.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ private struct LogItem
1616
public LogType type;
1717
}
1818

19-
private static readonly Dictionary<LogType, string> LogColors = new Dictionary<LogType, string>
19+
private static readonly Dictionary<LogType, string> LogColors = new()
2020
{
2121
[LogType.Error] = "red",
2222
[LogType.Assert] = "green",
@@ -31,8 +31,8 @@ private struct LogItem
3131
[SerializeField] private Color m_AutocompleteColor = default;
3232

3333
private string m_AutocompleteColorHex;
34-
private readonly Queue<LogItem> m_LogItems = new Queue<LogItem>();
35-
private readonly StringBuilder m_LogBuilder = new StringBuilder();
34+
private readonly Queue<LogItem> m_LogItems = new();
35+
private readonly StringBuilder m_LogBuilder = new();
3636
private int m_CommandHistoryIndex;
3737
private string m_CurrentAutocomplete;
3838
private bool m_OpenedForCommand, m_NeedsTextUpdate;
@@ -167,7 +167,7 @@ private void ConsoleInputChange(string consoleInput)
167167
private string StripAutocomplete(string input, out int indexOfAutocomplete)
168168
{
169169
indexOfAutocomplete = input.IndexOf($"<color={m_AutocompleteColorHex}>", StringComparison.Ordinal);
170-
if (indexOfAutocomplete > 0) input = input.Substring(0, indexOfAutocomplete);
170+
if (indexOfAutocomplete > 0) input = input[..indexOfAutocomplete];
171171
return input;
172172
}
173173

Packages/Swihoni.Sessions/Runtime/Player/CharacterControllerListener.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace Swihoni.Sessions.Player
44
{
55
public class CharacterControllerListener : MonoBehaviour
66
{
7-
public ControllerColliderHit CachedControllerHit { get; private set; } = new ControllerColliderHit();
7+
public ControllerColliderHit CachedControllerHit { get; private set; } = new();
88

99
private void OnControllerColliderHit(ControllerColliderHit hit) => CachedControllerHit = hit;
1010
}

Packages/Swihoni.Sessions/Runtime/Player/Components/PlayerComponents.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public class InventoryComponent : ComponentBase
169169
{
170170
public ByteProperty equippedIndex, previousEquippedIndex;
171171
public ByteStatusComponent equipStatus, adsStatus;
172-
public ItemsArray items = new ItemsArray();
172+
public ItemsArray items = new();
173173

174174
[ClientNonChecked] public TimeUsProperty tracerTimeUs;
175175
[ClientNonChecked] public VectorProperty tracerStart, tracerEnd;

Packages/Swihoni.Sessions/Runtime/Player/Modifiers/PlayerItemManagerModiferBehavior.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void TryPickupItemFromCollider(Component itemCollider, bool fromNearby)
8282
var throwable = entity.Require<ThrowableComponent>();
8383
if (fromNearby && throwable.throwerId == context.playerId && throwable.thrownElapsedUs < 2_000_000u) return;
8484

85-
if (!(TryAddItem(inventory, checked((byte) (itemEntityModifier.id - 100))) is { } index)) return;
85+
if (TryAddItem(inventory, checked((byte) (itemEntityModifier.id - 100))) is not { } index) return;
8686

8787
var itemOnEntity = entity.Require<ItemComponent>();
8888
ItemComponent item = inventory[index];
@@ -205,7 +205,7 @@ private static void ModifyEquipStatus(in SessionContext context, InventoryCompon
205205
private static void ModifyAdsStatus(in SessionContext context, InventoryComponent inventory, InputFlagProperty inputs)
206206
{
207207
ItemModifierBase modifier = ItemAssetLink.GetModifier(inventory.EquippedItemComponent.id);
208-
if (!(modifier is GunModifierBase gunModifier)) return;
208+
if (modifier is not GunModifierBase gunModifier) return;
209209

210210
if (inputs.GetInput(PlayerInput.Ads))
211211
{
@@ -348,13 +348,13 @@ public static void RefillAllAmmo(InventoryComponent inventory)
348348
public static void SetAllItems(InventoryComponent inventory, params byte[] ids)
349349
{
350350
for (var i = 0; i < inventory.items.Length; i++)
351-
SetItemAtIndex(inventory, i < ids.Length ? ids[i] : (byte?) null, i);
351+
SetItemAtIndex(inventory, i < ids.Length ? ids[i] : null, i);
352352
}
353353

354354
public static void SetItemAtIndex(InventoryComponent inventory, byte? _itemId, int index, ushort count = 1)
355355
{
356356
ItemComponent item = inventory[index];
357-
if (!(_itemId is { } itemId))
357+
if (_itemId is not { } itemId)
358358
{
359359
item.Clear();
360360
if (inventory.equippedIndex == index)
@@ -373,7 +373,7 @@ public static void SetItemAtIndex(InventoryComponent inventory, byte? _itemId, i
373373
item.ammoInMag.Value = gunModifier.MagSize;
374374
item.ammoInReserve.Value = gunModifier.StartingAmmoInReserve;
375375
break;
376-
case ThrowableItemModifierBase _:
376+
case ThrowableItemModifierBase:
377377
item.ammoInReserve.Value = count;
378378
break;
379379
}

Packages/manifest.json

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
{
22
"dependencies": {
33
"com.unity.2d.sprite": "1.0.0",
4-
"com.unity.ide.rider": "2.0.7",
5-
"com.unity.ide.vscode": "1.2.3",
6-
"com.unity.postprocessing": "2.3.0",
7-
"com.unity.quicksearch": "2.0.2",
8-
"com.unity.test-framework": "1.1.20",
9-
"com.unity.textmeshpro": "3.0.3",
4+
"com.unity.ide.rider": "3.0.7",
5+
"com.unity.postprocessing": "3.1.1",
6+
"com.unity.test-framework": "1.1.29",
7+
"com.unity.textmeshpro": "3.0.6",
108
"com.unity.ugui": "1.0.0",
119
"com.unity.modules.ai": "1.0.0",
1210
"com.unity.modules.androidjni": "1.0.0",

0 commit comments

Comments
 (0)