gg.easy.airship 0.1.2137 → 0.1.2139

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/AirshipPrefabUtility.cs +9 -10
  2. package/Editor/CreateAssetBundles.cs +6 -1
  3. package/Runtime/Code/Authentication/EasyAuthenticator.cs +5 -2
  4. package/Runtime/Code/Authentication/TransferData.cs +1 -0
  5. package/Runtime/Code/Luau/BinaryBlob.cs +4 -258
  6. package/Runtime/Code/Luau/LuauCoreCallbacks.cs +5 -3
  7. package/Runtime/Code/LuauAPI/Bridge.cs +4 -0
  8. package/Runtime/Code/LuauAPI/ResourcesAPI.cs +1 -1
  9. package/Runtime/Code/Network/AirshipNetworkManager.cs +0 -2
  10. package/Runtime/Code/{RemoteConsole → Network}/ServerConsole.cs +159 -154
  11. package/Runtime/Code/{RemoteConsole → Network}/ServerConsole.cs.meta +2 -2
  12. package/Runtime/Code/Network/StateSystem/AirshipNetworkedStateManager.cs +6 -11
  13. package/Runtime/Code/Player/Character/MovementSystems/Character/CharacterMovement.cs +153 -16
  14. package/Runtime/Code/Player/Character/MovementSystems/Character/Structures/CharacterSnapshotData.cs +88 -19
  15. package/Runtime/Code/Player/PlayerInfo.cs +6 -2
  16. package/Runtime/Code/Player/PlayerManagerBridge.cs +3 -3
  17. package/Runtime/Code/Player/UserData.cs +1 -0
  18. package/Runtime/Code/TSCodeGen/TypeGenerator.cs +2 -1
  19. package/Runtime/Code/VoxelWorld/VoxelWorld.cs +0 -17
  20. package/Runtime/Plugins/Linux/libLuauPlugin.so +0 -0
  21. package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/Info.plist +1 -1
  22. package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
  23. package/Runtime/Plugins/Windows/x64/LuauPlugin.dll +0 -0
  24. package/Runtime/Plugins/Windows/x64/LuauPlugin.pdb +0 -0
  25. package/Runtime/Plugins/iOS/LuauPluginIos.a +0 -0
  26. package/package.json +1 -1
  27. package/Runtime/Code/RemoteConsole/Airship.RemoteConsole.asmdef +0 -26
  28. package/Runtime/Code/RemoteConsole/Airship.RemoteConsole.asmdef.meta +0 -3
  29. package/Runtime/Code/RemoteConsole.meta +0 -3
@@ -6,30 +6,29 @@ namespace Airship.Editor {
6
6
  internal static class AirshipPrefabUtility {
7
7
  internal static bool FindReconcilablePrefabComponent(AirshipComponent component, out AirshipComponent prefabComponent) {
8
8
  var isPrefab = PrefabUtility.IsPartOfAnyPrefab(component);
9
- prefabComponent = PrefabUtility.GetCorrespondingObjectFromOriginalSource(component);
10
-
11
9
  if (!isPrefab) {
12
10
  prefabComponent = null;
13
11
  return false;
14
12
  }
15
13
 
16
- if (prefabComponent.script == null) {
17
- prefabComponent = null;
18
- return false;
19
- }
20
-
21
- var networkIdentity = prefabComponent.gameObject.GetComponentInParent<NetworkIdentity>();
14
+ var networkIdentity = component.gameObject.GetComponentInParent<NetworkIdentity>();
22
15
  if (networkIdentity != null) {
23
16
  prefabComponent = null;
24
17
  return false;
25
18
  }
26
19
 
27
- var meshFilter = prefabComponent.GetComponentsInChildren<MeshFilter>(); // because of 'SendMessage' we can't force reconcile these
20
+ var meshFilter = component.GetComponentsInChildren<MeshFilter>(); // because of 'SendMessage' we can't force reconcile these
28
21
  if (meshFilter.Length > 0) {
29
22
  prefabComponent = null;
30
23
  return false;
31
24
  }
32
-
25
+
26
+ prefabComponent = PrefabUtility.GetCorrespondingObjectFromOriginalSource(component);
27
+ if (prefabComponent.script == null) {
28
+ prefabComponent = null;
29
+ return false;
30
+ }
31
+
33
32
  return true;
34
33
  }
35
34
  }
@@ -255,9 +255,14 @@ public static class CreateAssetBundles {
255
255
  layers.Add(layerName);
256
256
  }
257
257
  gameConfig.gameLayers = layers.ToArray();
258
-
259
258
  gameConfig.SerializeSettings();
260
259
 
260
+ // Local source packages set to forceLatest
261
+ foreach (var package in gameConfig.packages) {
262
+ if (package.localSource) {
263
+ package.forceLatestVersion = true;
264
+ }
265
+ }
261
266
 
262
267
  EditorUtility.SetDirty(gameConfig);
263
268
  AssetDatabase.SaveAssetIfDirty(gameConfig);
@@ -174,14 +174,16 @@ namespace Code.Authentication {
174
174
  tcs.SetResult(new UserData() {
175
175
  uid = InternalHttpManager.editorUserId,
176
176
  username = loginMessage.editorUsername,
177
- profileImageId = loginMessage.editorProfileImageId
177
+ orgRoleName = "Dev",
178
+ profileImageId = loginMessage.editorProfileImageId,
178
179
  });
179
180
  return await tcs.Task;
180
181
  }
181
182
  tcs.SetResult(new UserData() {
182
183
  uid = this.connectionCounter + "",
183
184
  username = "Player" + this.connectionCounter,
184
- profileImageId = "",
185
+ orgRoleName = "Dev",
186
+ profileImageId = string.Empty,
185
187
  fullTransferPacket = "{}"
186
188
  });
187
189
  return await tcs.Task;
@@ -210,6 +212,7 @@ namespace Code.Authentication {
210
212
  uid = transferData.user.uid,
211
213
  username = transferData.user.username,
212
214
  profileImageId = transferData.user.profileImageId,
215
+ orgRoleName = transferData.user.orgRoleName,
213
216
  fullTransferPacket = fullTransferPacket
214
217
  });
215
218
  }).Catch((err) => {
@@ -12,6 +12,7 @@ public class User {
12
12
  public string usernameLower;
13
13
  public string lastUsernameChangeTime;
14
14
  public string profileImageId;
15
+ public string orgRoleName;
15
16
  }
16
17
 
17
18
 
@@ -16,270 +16,16 @@ namespace Assets.Luau {
16
16
  }
17
17
 
18
18
  public BinaryBlob(byte[] bytes) {
19
+ if (bytes.Length > uint.MaxValue) {
20
+ throw new Exception("Length of binary blob data exceeds " + int.MaxValue + " bytes.");
21
+ }
19
22
  dataSize = bytes.Length;
20
23
  data = bytes;
21
24
  }
22
25
 
23
- public long dataSize;
26
+ public int dataSize;
24
27
  public byte[] data;
25
28
 
26
- private Dictionary<object, object> m_cachedDictionary = null;
27
-
28
- public Dictionary<object, object> GetDictionary() {
29
- if (m_cachedDictionary != null) {
30
- return m_cachedDictionary;
31
- }
32
-
33
- var readPos = 1; // skip the first byte, it's a magic key to let us know it's a blob
34
- m_cachedDictionary = Decode(data, ref readPos);
35
-
36
- return m_cachedDictionary;
37
- }
38
-
39
- enum keyTypes : byte {
40
- KEY_TERMINATOR = 0,
41
- KEY_TABLE = 1,
42
- KEY_BYTENUMBER = 2,
43
- KEY_SHORTNUMBER = 3,
44
- KEY_INTNUMBER = 4,
45
- KEY_FLOATNUMBER = 5,
46
- KEY_DOUBLENUMBER = 6,
47
- KEY_SHORTSTRING = 7,
48
- KEY_LONGSTRING = 8,
49
- KEY_VECTOR3 = 9,
50
- KEY_BOOLEANTRUE = 10,
51
- KEY_BOOLEANFALSE = 11,
52
- KEY_PODTYPE = 12,
53
- };
54
-
55
- private static Dictionary<object, object> Decode(byte[] bufferRaw, ref int readPos) {
56
- var isCompressed = bufferRaw.Length > 0 && bufferRaw[0] == 1;
57
-
58
- // Skip the first byte, which is the compressed/decompressed flag:
59
- var bufferMaybeCompressed = new ArraySegment<byte>(bufferRaw).Slice(1, bufferRaw.Length - 1);
60
-
61
- // Decompress the buffer if needed:
62
- var buffer = isCompressed ? Zstd.DecompressData(bufferMaybeCompressed.Array) : bufferMaybeCompressed.Array;
63
-
64
- Dictionary<object, object> dictionary = new();
65
-
66
- while (true) {
67
- byte keyType = readByte(buffer, ref readPos);
68
-
69
-
70
- if (keyType == (byte)keyTypes.KEY_TERMINATOR) {
71
- //All done
72
- return dictionary;
73
- }
74
-
75
- object key = null;
76
- object value = null;
77
-
78
- //All the supported key types ONLY
79
- switch ((keyTypes)keyType) {
80
- case keyTypes.KEY_SHORTSTRING: {
81
- key = decodeShortStringToLua(buffer, ref readPos);
82
- break;
83
- }
84
- case keyTypes.KEY_LONGSTRING: {
85
- key = decodeLongStringToLua(buffer, ref readPos);
86
- break;
87
- }
88
- case keyTypes.KEY_BYTENUMBER: {
89
- key = readByte(buffer, ref readPos);
90
- break;
91
- }
92
- case keyTypes.KEY_SHORTNUMBER: {
93
- key = readShort(buffer, ref readPos);
94
- break;
95
- }
96
- case keyTypes.KEY_INTNUMBER: {
97
- key = readInt(buffer, ref readPos);
98
- break;
99
- }
100
- case keyTypes.KEY_FLOATNUMBER: {
101
- key = readFloat(buffer, ref readPos);
102
- break;
103
- }
104
- case keyTypes.KEY_DOUBLENUMBER: {
105
- key = readDouble(buffer, ref readPos);
106
- break;
107
- }
108
- case keyTypes.KEY_VECTOR3: {
109
- key = readVector3(buffer, ref readPos);
110
- break;
111
- }
112
- default: {
113
- Debug.LogError("[AirshipNet] Format problem decoding buffer - unknown key type. keyType=" + keyType);
114
- return null;
115
- }
116
- }
117
-
118
- byte valueType = readByte(buffer, ref readPos);
119
- //All the value types
120
- switch ((keyTypes)valueType) {
121
- case keyTypes.KEY_SHORTSTRING: {
122
- value = decodeShortStringToLua(buffer, ref readPos);
123
- break;
124
- }
125
- case keyTypes.KEY_LONGSTRING: {
126
- value = decodeLongStringToLua(buffer, ref readPos);
127
- break;
128
- }
129
- case keyTypes.KEY_BYTENUMBER: {
130
- value = readByte(buffer, ref readPos);
131
- break;
132
- }
133
- case keyTypes.KEY_SHORTNUMBER: {
134
- value = readShort(buffer, ref readPos);
135
- break;
136
- }
137
- case keyTypes.KEY_INTNUMBER: {
138
- value = readInt(buffer, ref readPos);
139
- break;
140
- }
141
- case keyTypes.KEY_FLOATNUMBER: {
142
- value = readFloat(buffer, ref readPos);
143
- break;
144
- }
145
- case keyTypes.KEY_DOUBLENUMBER: {
146
- value = readDouble(buffer, ref readPos);
147
- break;
148
- }
149
- case keyTypes.KEY_VECTOR3: {
150
- value = readVector3(buffer, ref readPos);
151
- break;
152
- }
153
- case keyTypes.KEY_BOOLEANTRUE: {
154
- value = true;
155
- break;
156
- }
157
- case keyTypes.KEY_BOOLEANFALSE: {
158
- value = false;
159
- break;
160
- }
161
- case keyTypes.KEY_TABLE: {
162
- value = Decode(buffer, ref readPos);
163
- break;
164
- }
165
- case keyTypes.KEY_PODTYPE: {
166
- value = readPodType(buffer, ref readPos);
167
- break;
168
- }
169
- default: {
170
- Debug.LogError("[AirshipNet] Format problem decoding buffer - unknown value type. valueType=" + valueType);
171
- return null;
172
- }
173
- }
174
-
175
- //store it
176
- dictionary.Add(key, value);
177
- }
178
- }
179
-
180
- //Read a byte
181
- private static byte readByte(byte[] buffer, ref int readPos) {
182
- byte value = buffer[readPos];
183
- readPos += 1;
184
- return value;
185
- }
186
-
187
- private static short readShort(byte[] buffer, ref int readPos) {
188
- short value = BitConverter.ToInt16(buffer, readPos);
189
- readPos += 2;
190
- return value;
191
- }
192
-
193
- private static int readInt(byte[] buffer, ref int readPos) {
194
- int value = BitConverter.ToInt32(buffer, readPos);
195
- readPos += 4;
196
- return value;
197
- }
198
-
199
- private static float readFloat(byte[] buffer, ref int readPos) {
200
- float value = BitConverter.ToSingle(buffer, readPos);
201
- readPos += 4;
202
- return value;
203
- }
204
-
205
- private static double readDouble(byte[] buffer, ref int readPos) {
206
- double value = BitConverter.ToDouble(buffer, readPos);
207
- readPos += 8;
208
- return value;
209
- }
210
-
211
- private static Vector3 readVector3(byte[] buffer, ref int readPos) {
212
- Vector3 value = new();
213
- value.x = readFloat(buffer, ref readPos);
214
- value.y = readFloat(buffer, ref readPos);
215
- value.z = readFloat(buffer, ref readPos);
216
- return value;
217
- }
218
-
219
- private static object decodeShortStringToLua(byte[] buffer, ref int readPos) {
220
- byte stringLength = readByte(buffer, ref readPos);
221
- string value = Encoding.UTF8.GetString(buffer, readPos, stringLength);
222
- readPos += stringLength;
223
- return value;
224
- }
225
-
226
- private static object decodeLongStringToLua(byte[] buffer, ref int readPos) {
227
- short stringLength = readShort(buffer, ref readPos);
228
- string value = Encoding.UTF8.GetString(buffer, readPos, stringLength);
229
- readPos += stringLength;
230
- return value;
231
- }
232
-
233
- private static unsafe object readPodType(byte[] buffer, ref int readPos) {
234
- int podType = readByte(buffer, ref readPos);
235
- fixed (byte* pData = buffer) {
236
- IntPtr data = (IntPtr)pData + readPos;
237
-
238
- switch ((PODTYPE)podType) {
239
- default: {
240
- Debug.LogError("[AirshipNet] Unhandled pod type encountered during decode");
241
- return null;
242
- }
243
-
244
- case PODTYPE.POD_RAY: {
245
- readPos += LuauCore.RaySize();
246
- return LuauCore.NewRayFromPointer(data);
247
- }
248
- case PODTYPE.POD_PLANE: {
249
- readPos += LuauCore.PlaneSize();
250
- return LuauCore.NewPlaneFromPointer(data);
251
- }
252
- case PODTYPE.POD_MATRIX: {
253
- readPos += LuauCore.MatrixSize();
254
- return LuauCore.NewMatrixFromPointer(data);
255
- }
256
- case PODTYPE.POD_QUATERNION: {
257
- readPos += LuauCore.QuaternionSize();
258
- return LuauCore.NewQuaternionFromPointer(data);
259
- }
260
- case PODTYPE.POD_VECTOR2: {
261
- readPos = LuauCore.Vector2Size();
262
- return LuauCore.NewVector2FromPointer(data);
263
- }
264
- case PODTYPE.POD_VECTOR4: {
265
- readPos = LuauCore.Vector4Size();
266
- return LuauCore.NewVector4FromPointer(data);
267
- }
268
- case PODTYPE.POD_COLOR: {
269
- readPos += LuauCore.ColorSize();
270
- return LuauCore.NewColorFromPointer(data);
271
- }
272
- case PODTYPE.POD_BINARYBLOB: {
273
- int sizeOfBlob = readInt(buffer, ref readPos);
274
- byte[] blobBuffer = new byte[sizeOfBlob + 4];
275
- Marshal.Copy(data, blobBuffer, 0, sizeOfBlob + 4);
276
-
277
- return new BinaryBlob(blobBuffer);
278
- }
279
- }
280
- }
281
- }
282
-
283
29
  public bool Equals(BinaryBlob other) {
284
30
  return this.dataSize == other?.dataSize;
285
31
  }
@@ -63,6 +63,7 @@ public partial class LuauCore : MonoBehaviour {
63
63
  public Delegate GetProperty;
64
64
  public bool HasGetPropertyFunc;
65
65
  public bool IsNativeClass;
66
+ public bool IsStruct;
66
67
  }
67
68
 
68
69
  // Hopefully faster dictionary comparison / hash time
@@ -659,7 +660,7 @@ public partial class LuauCore : MonoBehaviour {
659
660
  }
660
661
 
661
662
  private static T GetValue<T>(object instance, PropertyGetReflectionCache cacheData) {
662
- if (typeof(T) == typeof(object) || cacheData.IsNativeClass) {
663
+ if (typeof(T) == typeof(object) || cacheData.IsNativeClass || cacheData.IsStruct) {
663
664
  return (T) cacheData.propertyInfo.GetMethod.Invoke(instance, null);
664
665
  }
665
666
 
@@ -671,7 +672,7 @@ public partial class LuauCore : MonoBehaviour {
671
672
  .MethodHandle
672
673
  .GetFunctionPointer()
673
674
  .ToPointer();
674
-
675
+
675
676
  // Create a delegate that wraps the function pointer
676
677
  var getter = new Getter<T>(obj => {
677
678
  unsafe {
@@ -1670,7 +1671,8 @@ public partial class LuauCore : MonoBehaviour {
1670
1671
  t = propertyInfo.PropertyType,
1671
1672
  propertyInfo = propertyInfo,
1672
1673
  IsNativeClass = propertyInfo.DeclaringType.GetCustomAttributes(false)
1673
- .Any(attr => attr.GetType().Name == "NativeClassAttribute")
1674
+ .Any(attr => attr.GetType().Name == "NativeClassAttribute"),
1675
+ IsStruct = propertyInfo.DeclaringType.IsValueType && !propertyInfo.DeclaringType.IsPrimitive,
1674
1676
  };
1675
1677
  LuauCore.propertyGetCache[new PropertyCacheKey(objectType, propName)] = cacheData;
1676
1678
  return cacheData;
@@ -448,6 +448,10 @@ public static class Bridge {
448
448
  return scenes.ToArray();
449
449
  }
450
450
 
451
+ public static void SetSkyboxMaterial(Material material) {
452
+ RenderSettings.skybox = material;
453
+ }
454
+
451
455
  public static float[] MakeFloatArray(int size) {
452
456
  return new float[size];
453
457
  }
@@ -1,6 +1,6 @@
1
1
  using System;
2
2
 
3
- [LuauAPI]
3
+ [LuauAPI(LuauContext.Protected)]
4
4
  public class ResourcesAPI : BaseLuaAPIClass
5
5
  {
6
6
  public override Type GetAPIType()
@@ -1,6 +1,4 @@
1
1
  using System;
2
- using System.Collections;
3
- using System.Collections.Generic;
4
2
  using System.Threading.Tasks;
5
3
  using Assets.Luau.Network;
6
4
  using Code.Bootstrap;