gg.easy.airship 0.1.2135 → 0.1.2137

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/Editor/Artifacts/AirshipLocalArtifactDatabase.cs +5 -1
  2. package/Editor/Artifacts/AirshipPrefabUtility.cs +36 -0
  3. package/Editor/Artifacts/AirshipPrefabUtility.cs.meta +3 -0
  4. package/Editor/Artifacts/AirshipReconciliationService.cs +7 -5
  5. package/Editor/TypescriptServices/Compiler/TypescriptCompilationService.cs +30 -6
  6. package/Editor/TypescriptServices/TypescriptServices.cs +6 -0
  7. package/Runtime/Code/Core/RunCore.cs +1 -1
  8. package/Runtime/Code/Luau/AirshipScript.cs +2 -0
  9. package/Runtime/Code/Network/Simulation/AirshipSimulationManager.cs +13 -15
  10. package/Runtime/Code/Network/StateSystem/AirshipNetworkedStateManager.cs +5 -4
  11. package/Runtime/Code/Player/Character/MovementSystems/Character/CharacterMovement.cs +534 -658
  12. package/Runtime/Code/Player/Character/MovementSystems/Character/CharacterPhysics.cs +1 -1
  13. package/Runtime/Code/VoxelWorld/Airship.VoxelWorld.asmdef +2 -1
  14. package/Runtime/Code/VoxelWorld/VoxelCompressUtil.cs +26 -3
  15. package/Runtime/Code/VoxelWorld/VoxelWorldChunk.cs +1 -1
  16. package/Runtime/Code/VoxelWorld/WorldSaveFile.cs +8 -6
  17. package/Runtime/Code/Zstd/Zstd.cs +125 -47
  18. package/Runtime/Code/Zstd/ZstdCompressStream.cs +147 -0
  19. package/Runtime/Code/Zstd/ZstdCompressStream.cs.meta +3 -0
  20. package/Runtime/Code/Zstd/ZstdDecompressStream.cs +196 -0
  21. package/Runtime/Code/Zstd/ZstdDecompressStream.cs.meta +3 -0
  22. package/Runtime/Code/Zstd/ZstdNative.cs +5 -5
  23. package/Runtime/Plugins/Android/libLuauPlugin.so +0 -0
  24. package/Runtime/Plugins/Linux/libLuauPlugin.so +0 -0
  25. package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
  26. package/Runtime/Plugins/Windows/x64/LuauPlugin.dll +0 -0
  27. package/Runtime/Plugins/Windows/x64/LuauPlugin.pdb +0 -0
  28. package/Runtime/Plugins/iOS/LuauPluginIos.a +0 -0
  29. package/package.json +1 -1
@@ -150,7 +150,11 @@ namespace Airship.Editor {
150
150
  /// Will try to get the script asset data associated with the specified script (if applicable)
151
151
  /// </summary>
152
152
  internal bool TryGetScriptAssetData(AirshipScript script, out ComponentScriptAssetData assetData) {
153
- var item = scripts.FirstOrDefault(f => f.script == script.assetPath);
153
+ return TryGetScriptAssetDataFromPath(script.assetPath, out assetData);
154
+ }
155
+
156
+ internal bool TryGetScriptAssetDataFromPath(string path, out ComponentScriptAssetData assetData) {
157
+ var item = scripts.FirstOrDefault(f => f.script == path);
154
158
  if (item != null) {
155
159
  assetData = item;
156
160
  return true;
@@ -0,0 +1,36 @@
1
+ using Mirror;
2
+ using UnityEditor;
3
+ using UnityEngine;
4
+
5
+ namespace Airship.Editor {
6
+ internal static class AirshipPrefabUtility {
7
+ internal static bool FindReconcilablePrefabComponent(AirshipComponent component, out AirshipComponent prefabComponent) {
8
+ var isPrefab = PrefabUtility.IsPartOfAnyPrefab(component);
9
+ prefabComponent = PrefabUtility.GetCorrespondingObjectFromOriginalSource(component);
10
+
11
+ if (!isPrefab) {
12
+ prefabComponent = null;
13
+ return false;
14
+ }
15
+
16
+ if (prefabComponent.script == null) {
17
+ prefabComponent = null;
18
+ return false;
19
+ }
20
+
21
+ var networkIdentity = prefabComponent.gameObject.GetComponentInParent<NetworkIdentity>();
22
+ if (networkIdentity != null) {
23
+ prefabComponent = null;
24
+ return false;
25
+ }
26
+
27
+ var meshFilter = prefabComponent.GetComponentsInChildren<MeshFilter>(); // because of 'SendMessage' we can't force reconcile these
28
+ if (meshFilter.Length > 0) {
29
+ prefabComponent = null;
30
+ return false;
31
+ }
32
+
33
+ return true;
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 49673f97bd5f43a184a49c4379fb4786
3
+ timeCreated: 1748391009
@@ -5,6 +5,7 @@ using System.Collections.Generic;
5
5
  using System.Linq;
6
6
  using Editor.EditorInternal;
7
7
  using Luau;
8
+ using Mirror;
8
9
  using Mirror.SimpleWeb;
9
10
  using Newtonsoft.Json;
10
11
  using UnityEditor;
@@ -251,7 +252,7 @@ namespace Airship.Editor {
251
252
  status = ReconcileStatus.Unsuccessful;
252
253
  return false;
253
254
  }
254
-
255
+
255
256
  var artifactData = AirshipLocalArtifactDatabase.instance;
256
257
 
257
258
  // Ensure we have the script asset data first, if not we'll just have to queue it for the compiler to process...
@@ -334,10 +335,7 @@ namespace Airship.Editor {
334
335
 
335
336
  if (ReconcilerVersion == ReconcilerVersion.Version2) {
336
337
  var component = eventData.Component;
337
-
338
- var isPrefab = PrefabUtility.IsPartOfAnyPrefab(component);
339
- var prefabOriginalComponent = PrefabUtility.GetCorrespondingObjectFromOriginalSource(component);
340
- if (isPrefab && prefabOriginalComponent.script != null) {
338
+ if (AirshipPrefabUtility.FindReconcilablePrefabComponent(component, out var prefabOriginalComponent)) {
341
339
  // If it's a instance component:
342
340
  // - We need to reconcile the source component first:
343
341
  // - If successful: We can then reconcile the instance
@@ -365,6 +363,9 @@ namespace Airship.Editor {
365
363
  break;
366
364
  }
367
365
  }
366
+
367
+
368
+
368
369
  }
369
370
  else {
370
371
  // It's just an orphaned instance, or we're reconciling the original component, we can just reconcile it outright. No silly business required.
@@ -372,6 +373,7 @@ namespace Airship.Editor {
372
373
  }
373
374
  }
374
375
  else {
376
+
375
377
  var component = eventData.Component;
376
378
  ReconcileComponent(component);
377
379
  //component.componentHash = component.scriptHash;
@@ -57,7 +57,7 @@ using Object = UnityEngine.Object;
57
57
  // [InitializeOnLoad]
58
58
  public static class TypescriptCompilationService {
59
59
  private const int ExitCodeKill = 137;
60
- private const string TsCompilerService = "Typescript Compilation Service";
60
+ private const string TsCompilerService = "Compiling Scripts";
61
61
 
62
62
  /// <summary>
63
63
  /// True if the compiler is running in watch mode
@@ -225,18 +225,42 @@ using Object = UnityEngine.Object;
225
225
  return;
226
226
  }
227
227
 
228
+ var artifacts = AirshipLocalArtifactDatabase.instance;
229
+ var modifiedDatabase = false;
230
+
228
231
  try {
229
232
  AssetDatabase.StartAssetEditing();
230
233
  var compileFileList = CompiledFileQueue.ToArray();
234
+
231
235
  foreach (var file in compileFileList) {
232
- // var asset = AssetDatabase.LoadAssetAtPath<AirshipScript>(file);
233
- AssetDatabase.ImportAsset(file, ImportAssetOptions.Default);
236
+ var outFileHash = TypescriptProjectsService.Project.GetOutputFileHash(file);
237
+
238
+ if (artifacts.TryGetScriptAssetDataFromPath(PosixPath.ToPosix(file), out var data)) {
239
+ if (outFileHash != data.metadata.compiledHash) {
240
+ AssetDatabase.ImportAsset(file, ImportAssetOptions.Default);
241
+ data.metadata.compiledHash = outFileHash;
242
+ modifiedDatabase = true;
243
+ }
244
+ }
245
+ else {
246
+ var scriptData = artifacts.GetOrCreateScriptAssetData(AssetDatabase.LoadAssetAtPath<AirshipScript>(file));
247
+ scriptData.metadata = new TypescriptCompilerMetadata() {
248
+ compiledHash = outFileHash
249
+ };
250
+
251
+ AssetDatabase.ImportAsset(file, ImportAssetOptions.Default);
252
+ modifiedDatabase = true;
253
+ }
234
254
  }
255
+
235
256
  AssetDatabase.Refresh();
236
257
  } catch (Exception ex) {
237
- Debug.LogError("[Airship] Failed to reimport compiled files: " + ex);
258
+ Debug.LogException(ex);
238
259
  } finally {
239
260
  AssetDatabase.StopAssetEditing();
261
+ if (modifiedDatabase) {
262
+ artifacts.Modify();
263
+ }
240
264
  }
241
265
 
242
266
  EditorApplication.update -= ReimportCompiledFiles;
@@ -389,7 +413,7 @@ using Object = UnityEngine.Object;
389
413
  try
390
414
  {
391
415
  if (fullClean) {
392
- UpdateCompilerProgressBarText($"Install packages for '{packageInfo.Name}'...");
416
+ UpdateCompilerProgressBarText($"Preparing TypeScript project");
393
417
  var success = RunNpmInstall(packageDir);
394
418
  if (!success)
395
419
  {
@@ -407,7 +431,7 @@ using Object = UnityEngine.Object;
407
431
  while (!compilerProcess.HasExited) {
408
432
  if (compilationState.FilesToCompileCount == 0) continue;
409
433
  UpdateCompilerProgressBar(
410
- compilationState.CompiledFileCount / (float)compilationState.FilesToCompileCount, $"Compiling {compilationState.CompiledFileCount}/{project.CompilationState.FilesToCompileCount}");
434
+ compilationState.CompiledFileCount / (float)compilationState.FilesToCompileCount, $"Compiling TypeScript files {compilationState.CompiledFileCount}/{project.CompilationState.FilesToCompileCount}...");
411
435
  }
412
436
 
413
437
  // compilerProcess.WaitForExit();
@@ -64,6 +64,12 @@ namespace Airship.Editor {
64
64
  Debug.LogWarning("[TypescriptServices] Skipped, in Airship Player mode");
65
65
  return;
66
66
  #endif
67
+ // On project load we'll force a full compile to try and get all the refs up to date
68
+ if (!SessionState.GetBool("TypescriptInitialBoot", false) && IsValidEditor) {
69
+ SessionState.SetBool("TypescriptInitialBoot", true);
70
+ TypescriptCompilationService.BuildTypescript(TypeScriptCompileFlags.FullClean | TypeScriptCompileFlags.Setup | TypeScriptCompileFlags.DisplayProgressBar);
71
+ }
72
+
67
73
  // If a server or clone - ignore
68
74
  if (!IsValidEditor) return;
69
75
  EditorApplication.delayCall += OnLoadDeferred;
@@ -10,7 +10,7 @@ using Unity.Multiplayer.Playmode;
10
10
  [LuauAPI]
11
11
  public class RunCore {
12
12
  // Launch params
13
- public static bool launchInDedicatedServerMode = true;
13
+ public static bool launchInDedicatedServerMode = false;
14
14
 
15
15
  private static bool isServer = false;
16
16
  private static bool isClient = false;
@@ -18,6 +18,8 @@ namespace Luau {
18
18
  /// The file hash at the compile time
19
19
  /// </summary>
20
20
  public string hash;
21
+
22
+ public string compiledHash;
21
23
  /// <summary>
22
24
  /// The timestamp when this was compiled
23
25
  /// </summary>
@@ -102,12 +102,10 @@ namespace Code.Network.Simulation
102
102
  */
103
103
  public event Action<int, double, double> OnLagCompensationCheck;
104
104
 
105
- /**
106
- * This action tells all watching components that they need to perform a tick.
107
- * A Physics.Simulate() call will be made after PerformTick completes.
108
- */
109
- public event Action<double, bool> OnPerformTick;
110
-
105
+ /// <summary>
106
+ /// This action tells all watching components that they need to perform a tick.
107
+ /// A Physics.Simulate() call will be made after PerformTick completes.
108
+ /// </summary>
111
109
  public event Action<object, object> OnTick;
112
110
 
113
111
  /**
@@ -184,7 +182,6 @@ namespace Code.Network.Simulation
184
182
  if (resimBackTo != time) this.PerformResimulation(resimBackTo);
185
183
 
186
184
  // Perform the standard tick behavior
187
- OnPerformTick?.Invoke(time, false);
188
185
  OnTick?.Invoke(time, false);
189
186
  // Debug.Log("Simulate call. Main Tick: " + NetworkTime.time);
190
187
  Physics.Simulate(Time.fixedDeltaTime);
@@ -310,13 +307,14 @@ namespace Code.Network.Simulation
310
307
  this.ScheduleResimulation((resim => resim(time)));
311
308
  }
312
309
 
313
- /**
314
- * Requests a simulation based on the provided time. Requesting a simulation will roll back the physics
315
- * world to the snapshot just before or at the base time provided. Calling the returned tick function
316
- * will advance the simulation and re-simulate the calls to OnPerformTick, Physics.Simulate(), and OnCaptureSnapshot
317
- *
318
- * This function is used internally to implement the scheduled resimulations.
319
- */
310
+ /// <summary>
311
+ /// Requests a simulation based on the provided time. Requesting a simulation will roll back the physics
312
+ /// world to the snapshot just before or at the base time provided. Calling the returned tick function
313
+ /// will advance the simulation and re-simulate the calls to <see cref="OnTick"/>, Physics.Simulate,
314
+ /// and <see cref="OnCaptureSnapshot"/>
315
+ ///
316
+ /// This function is used internally to implement the scheduled resimulations.
317
+ /// </summary>
320
318
  private void PerformResimulation(double baseTime)
321
319
  {
322
320
  Debug.Log($"T:{Time.unscaledTimeAsDouble} Resimulating from {baseTime}");
@@ -343,7 +341,7 @@ namespace Code.Network.Simulation
343
341
 
344
342
  while (tickIndex < this.tickTimes.Count)
345
343
  {
346
- OnPerformTick?.Invoke(this.tickTimes[tickIndex], true);
344
+ OnTick?.Invoke(this.tickTimes[tickIndex], true);
347
345
  // Debug.Log("Simulate call. Replay Tick: " + this.tickTimes[tickIndex]);
348
346
  Physics.Simulate(Time.fixedDeltaTime);
349
347
  OnCaptureSnapshot?.Invoke(this.tickTimes[tickIndex], true);
@@ -165,7 +165,7 @@ namespace Code.Network.StateSystem
165
165
  private void Awake()
166
166
  {
167
167
  AirshipSimulationManager.Instance.ActivateSimulationManager();
168
- AirshipSimulationManager.Instance.OnPerformTick += this.OnPerformTick;
168
+ AirshipSimulationManager.Instance.OnTick += this.OnTick;
169
169
  AirshipSimulationManager.Instance.OnSetSnapshot += this.OnSetSnapshot;
170
170
  AirshipSimulationManager.Instance.OnCaptureSnapshot += this.OnCaptureSnapshot;
171
171
  AirshipSimulationManager.Instance.OnLagCompensationCheck += this.OnLagCompensationCheck;
@@ -195,7 +195,7 @@ namespace Code.Network.StateSystem
195
195
 
196
196
  public void OnDestroy()
197
197
  {
198
- AirshipSimulationManager.Instance.OnPerformTick -= this.OnPerformTick;
198
+ AirshipSimulationManager.Instance.OnTick -= this.OnTick;
199
199
  AirshipSimulationManager.Instance.OnSetSnapshot -= this.OnSetSnapshot;
200
200
  AirshipSimulationManager.Instance.OnCaptureSnapshot -= this.OnCaptureSnapshot;
201
201
  AirshipSimulationManager.Instance.OnLagCompensationCheck -= this.OnLagCompensationCheck;
@@ -282,8 +282,9 @@ namespace Code.Network.StateSystem
282
282
 
283
283
  #region Top Level Event Functions
284
284
 
285
- private void OnPerformTick(double time, bool replay)
286
- {
285
+ private void OnTick(object timeObj, object replayObj) {
286
+ if (timeObj is not double time || replayObj is not bool replay) return;
287
+
287
288
  // We are in shared mode
288
289
  if (isServer && isClient)
289
290
  {