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
@@ -2,8 +2,7 @@ using System;
2
2
  using Assets.Luau;
3
3
  using Code.Network.StateSystem;
4
4
  using Code.Network.StateSystem.Structures;
5
- using Code.Player.Character.Net;
6
- using Mirror.BouncyCastle.Asn1.X9;
5
+ using Mirror;
7
6
  using UnityEngine;
8
7
 
9
8
  namespace Code.Player.Character.MovementSystems.Character
@@ -11,24 +10,23 @@ namespace Code.Player.Character.MovementSystems.Character
11
10
  [LuauAPI]
12
11
  public class CharacterSnapshotData : StateSnapshot
13
12
  {
14
- public Vector3 position;
15
- public Vector3 velocity;
16
- public Vector3 lookVector;
17
-
18
- public float currentSpeed;
19
- public float speedModifier = 1; // Not used yet
20
13
  public bool inputDisabled;
21
14
  public bool isFlying;
22
15
  public bool isSprinting;
23
- public int jumpCount;
24
16
  public bool airborneFromImpulse;
25
- public bool alreadyJumped; //Only lets the character jump once until the jump key is released
26
-
17
+ public bool alreadyJumped;
27
18
  public bool isCrouching;
28
19
  public bool prevStepUp;
29
20
  public bool isGrounded;
21
+
22
+ public Vector3 position;
23
+ public Vector3 velocity;
24
+ public Vector3 lookVector;
25
+
26
+ public float currentSpeed;
27
+ public float speedModifier = 1; // Not used yet
28
+ public byte jumpCount;
30
29
  public CharacterState state = CharacterState.Idle;
31
- public CharacterState prevState = CharacterState.Idle;
32
30
  public float timeSinceBecameGrounded;
33
31
  public float timeSinceWasGrounded;
34
32
  public float timeSinceJump;
@@ -73,7 +71,6 @@ namespace Code.Player.Character.MovementSystems.Character
73
71
  if (isGrounded != other.isGrounded)
74
72
  message += $"prevGrounded: {isGrounded} != {other.isGrounded}\n";
75
73
  if (state != other.state) message += $"state: {state} != {other.state}\n";
76
- if (prevState != other.prevState) message += $"prevState: {prevState} != {other.prevState}\n";
77
74
 
78
75
  var same = this.lastProcessedCommand == other.lastProcessedCommand && this.position == other.position &&
79
76
  this.velocity == other.velocity && this.currentSpeed == other.currentSpeed && this.speedModifier == other.speedModifier &&
@@ -82,8 +79,7 @@ namespace Code.Player.Character.MovementSystems.Character
82
79
  airborneFromImpulse == other.airborneFromImpulse &&
83
80
  alreadyJumped == other.alreadyJumped
84
81
  && isCrouching == other.isCrouching && prevStepUp == other.prevStepUp &&
85
- isGrounded == other.isGrounded && state == other.state
86
- && prevState == other.prevState;
82
+ isGrounded == other.isGrounded && state == other.state;
87
83
 
88
84
  if (same)
89
85
  {
@@ -110,7 +106,6 @@ namespace Code.Player.Character.MovementSystems.Character
110
106
  this.timeSinceJump = copySnapshot.timeSinceJump;
111
107
  this.timeSinceWasGrounded = copySnapshot.timeSinceWasGrounded;
112
108
  this.timeSinceBecameGrounded = copySnapshot.timeSinceBecameGrounded;
113
- this.prevState = copySnapshot.prevState;
114
109
  this.state = copySnapshot.state;
115
110
  this.isGrounded = copySnapshot.isGrounded;
116
111
  this.prevStepUp = copySnapshot.prevStepUp;
@@ -133,7 +128,7 @@ namespace Code.Player.Character.MovementSystems.Character
133
128
 
134
129
  public override string ToString()
135
130
  {
136
- return "Pos: " + this.position + " Vel: " + velocity;
131
+ return "Last cmd#" + this.lastProcessedCommand + " time: " + this.time + "Pos: " + this.position + " Vel: " + velocity;
137
132
  }
138
133
 
139
134
  public override object Clone()
@@ -149,8 +144,7 @@ namespace Code.Player.Character.MovementSystems.Character
149
144
  timeSinceJump = timeSinceJump,
150
145
  timeSinceWasGrounded = timeSinceWasGrounded,
151
146
  timeSinceBecameGrounded = timeSinceBecameGrounded,
152
- prevState = prevState,
153
- state = state,
147
+ state = state,
154
148
  isGrounded = isGrounded,
155
149
  prevStepUp = prevStepUp,
156
150
  isCrouching = isCrouching,
@@ -169,4 +163,79 @@ namespace Code.Player.Character.MovementSystems.Character
169
163
  };
170
164
  }
171
165
  }
166
+
167
+ public static class CharacterSnapshotDataSerializer {
168
+ public static void WriteCharacterSnapshotData(this NetworkWriter writer, CharacterSnapshotData value) {
169
+ byte bools = 0;
170
+ SetBit(ref bools, 0, value.inputDisabled);
171
+ SetBit(ref bools, 1, value.isFlying);
172
+ SetBit(ref bools, 2, value.isSprinting);
173
+ SetBit(ref bools, 3, value.airborneFromImpulse);
174
+ SetBit(ref bools, 4, value.alreadyJumped);
175
+ SetBit(ref bools, 5, value.isCrouching);
176
+ SetBit(ref bools, 6, value.prevStepUp);
177
+ SetBit(ref bools, 7, value.isGrounded);
178
+ writer.Write(bools);
179
+
180
+ writer.WriteInt(value.customData.dataSize);
181
+ writer.WriteBytes(value.customData.data, 0, value.customData.data.Length);
182
+
183
+ writer.Write(value.time);
184
+ writer.Write(value.lastProcessedCommand);
185
+ writer.Write(value.position);
186
+ writer.Write(value.velocity);
187
+ writer.Write((short)(value.lookVector.x * 1000f));
188
+ writer.Write((short)(value.lookVector.y * 1000f));
189
+ writer.Write((short)(value.lookVector.z * 1000f));
190
+ writer.Write(value.currentSpeed);
191
+ // This makes our max speed modifier 65.535 with a 0.001 precision.
192
+ writer.Write((ushort) Math.Clamp(value.speedModifier * 1000f, 0, ushort.MaxValue));
193
+ writer.Write((byte) Math.Min(Math.Floor(value.timeSinceJump / Time.fixedDeltaTime), 255));
194
+ writer.Write((byte) Math.Min(Math.Floor(value.timeSinceWasGrounded / Time.fixedDeltaTime), 255));
195
+ writer.Write((byte) Math.Min(Math.Floor(value.timeSinceBecameGrounded / Time.fixedDeltaTime), 255));
196
+ writer.Write((byte) value.state);
197
+ writer.Write(value.jumpCount);
198
+ }
199
+
200
+ public static CharacterSnapshotData ReadCharacterSnapshotData(this NetworkReader reader) {
201
+ var bools = reader.Read<byte>();
202
+ var customDataSize = reader.ReadInt();
203
+ var customDataArray = reader.ReadBytes(customDataSize);
204
+ var customData = new BinaryBlob(customDataArray);
205
+ return new CharacterSnapshotData() {
206
+ inputDisabled = GetBit(bools, 0),
207
+ isFlying = GetBit(bools, 1),
208
+ isSprinting = GetBit(bools, 2),
209
+ airborneFromImpulse = GetBit(bools, 3),
210
+ alreadyJumped = GetBit(bools, 4),
211
+ isCrouching = GetBit(bools, 5),
212
+ prevStepUp = GetBit(bools, 6),
213
+ isGrounded = GetBit(bools, 7),
214
+
215
+ time = reader.Read<double>(),
216
+ lastProcessedCommand = reader.Read<int>(),
217
+ position = reader.Read<Vector3>(),
218
+ velocity = reader.Read<Vector3>(),
219
+ lookVector = new Vector3(reader.Read<short>() / 1000f, reader.Read<short>() / 1000f, reader.Read<short>() / 1000f),
220
+ currentSpeed = reader.Read<float>(),
221
+ speedModifier = reader.Read<ushort>() / 1000f,
222
+ timeSinceJump = reader.Read<byte>() * Time.fixedDeltaTime,
223
+ timeSinceWasGrounded = reader.Read<byte>() * Time.fixedDeltaTime,
224
+ timeSinceBecameGrounded = reader.Read<byte>() * Time.fixedDeltaTime,
225
+ state = (CharacterState) reader.Read<byte>(),
226
+ jumpCount = reader.Read<byte>(),
227
+ customData = customData,
228
+ };
229
+ }
230
+
231
+ private static bool GetBit(byte bools, int bit) => (bools & (1 << bit)) != 0;
232
+
233
+ private static void SetBit(ref byte bools, int bit, bool value)
234
+ {
235
+ if (value)
236
+ bools |= (byte)(1 << bit);
237
+ else
238
+ bools &= (byte)~(1 << bit);
239
+ }
240
+ }
172
241
  }
@@ -10,6 +10,7 @@ public class PlayerInfoDto {
10
10
  public string userId;
11
11
  public string username;
12
12
  public string profileImageId;
13
+ public string orgRoleName;
13
14
  public GameObject gameObject;
14
15
  }
15
16
 
@@ -19,6 +20,7 @@ public class PlayerInfo : NetworkBehaviour {
19
20
  [SyncVar] public string username;
20
21
  [SyncVar] public int connectionId;
21
22
  [SyncVar] public string profileImageId;
23
+ [SyncVar] public string orgRoleName;
22
24
  public AudioSource voiceChatAudioSource;
23
25
 
24
26
  private void Start() {
@@ -26,13 +28,14 @@ public class PlayerInfo : NetworkBehaviour {
26
28
  PlayerManagerBridge.Instance.AddPlayer(this);
27
29
  }
28
30
 
29
- public void Init(int connectionId, string userId, string username, string profileImageId) {
31
+ public void Init(int connectionId, string userId, string username, string profileImageId, string orgRoleName) {
30
32
  this.gameObject.name = "Player_" + username;
31
33
  this.connectionId = connectionId;
32
34
  this.userId = userId;
33
35
  this.username = username;
34
36
  this.profileImageId = profileImageId;
35
-
37
+ this.orgRoleName = orgRoleName;
38
+
36
39
  this.InitVoiceChat();
37
40
  }
38
41
 
@@ -74,6 +77,7 @@ public class PlayerInfo : NetworkBehaviour {
74
77
  userId = this.userId,
75
78
  username = this.username,
76
79
  profileImageId = this.profileImageId,
80
+ orgRoleName = this.orgRoleName,
77
81
  gameObject = this.gameObject,
78
82
  };
79
83
  }
@@ -28,7 +28,7 @@ namespace Code.Player {
28
28
  public PlayerInfo localPlayer;
29
29
  public bool localPlayerReady = false;
30
30
 
31
- private List<PlayerInfo> players = new();
31
+ public List<PlayerInfo> players = new();
32
32
 
33
33
  private int botPlayerIdCounter = 1;
34
34
 
@@ -175,7 +175,7 @@ namespace Code.Player {
175
175
  var go = Instantiate(this.playerPrefab, Instance.transform.parent);
176
176
 
177
177
  var playerInfo = go.GetComponent<PlayerInfo>();
178
- playerInfo.Init(connectionId, userId, username, profilePictureId);
178
+ playerInfo.Init(connectionId, userId, username, profilePictureId, string.Empty);
179
179
 
180
180
  // var identity = go.GetComponent<NetworkIdentity>();
181
181
  NetworkServer.Spawn(go);
@@ -210,7 +210,7 @@ namespace Code.Player {
210
210
  // #if UNITY_SERVER || true
211
211
  // Debug.Log($"Initializing Player as {userData.username} owned by " + conn);
212
212
  // #endif
213
- playerInfo.Init(conn.connectionId, userData.uid, userData.username, userData.profileImageId);
213
+ playerInfo.Init(conn.connectionId, userData.uid, userData.username, userData.profileImageId, userData.orgRoleName);
214
214
  } else {
215
215
  #if UNITY_SERVER || true
216
216
  Debug.Log("Missing UserData for " + conn);
@@ -3,5 +3,6 @@ public class UserData
3
3
  public string uid;
4
4
  public string username;
5
5
  public string profileImageId;
6
+ public string orgRoleName;
6
7
  public string fullTransferPacket;
7
8
  }
@@ -334,7 +334,8 @@ public class TypeGenerator : MonoBehaviour
334
334
  "\\.MonoBehaviour$",
335
335
  "\\.InternalCameraScreenshotRecorder$",
336
336
  "\\.OcclusionCam$",
337
- "\\.AirshipUniVoiceNetwork$"
337
+ "\\.AirshipUniVoiceNetwork$",
338
+ "\\.ServerConsole$",
338
339
  };
339
340
 
340
341
  var options = new TypeScriptOptions
@@ -343,23 +343,6 @@ public partial class VoxelWorld : MonoBehaviour {
343
343
  return affectedChunk;
344
344
  }
345
345
 
346
- public void WriteVoxelGroupAtTS(object blob, bool priority) {
347
- var data = ((BinaryBlob)blob).GetDictionary();
348
- Vector3[] positions = new Vector3[data.Count]; ;
349
- double[] nums = new double[data.Count];
350
-
351
- // Parse binaryblob
352
- int i = 0;
353
- foreach (var kvp in data) {
354
- var values = kvp.Value as Dictionary<object, object>;
355
- positions[i] = (Vector3)values["pos"];
356
- nums[i] = Convert.ToDouble((byte)values["blockId"]);
357
- i++;
358
- }
359
-
360
- this.WriteVoxelGroupAt(positions, nums, priority);
361
- }
362
-
363
346
  public ushort[] BulkReadVoxels(Vector3[] positions) {
364
347
  var result = new ushort[positions.Length];
365
348
  for (var i = 0; i < positions.Length; i++) {
@@ -3,7 +3,7 @@
3
3
  <plist version="1.0">
4
4
  <dict>
5
5
  <key>BuildMachineOSBuild</key>
6
- <string>23H527</string>
6
+ <string>23H626</string>
7
7
  <key>CFBundleDevelopmentRegion</key>
8
8
  <string>en</string>
9
9
  <key>CFBundleExecutable</key>
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg.easy.airship",
3
- "version": "0.1.2137",
3
+ "version": "0.1.2139",
4
4
  "displayName": "Airship",
5
5
  "unity": "2021.3",
6
6
  "unityRelease": "12f1",
@@ -1,26 +0,0 @@
1
- {
2
- "name": "Airship.RemoteConsole",
3
- "rootNamespace": "",
4
- "references": [
5
- "GUID:7c88a4a7926ee5145ad2dfa06f454c67",
6
- "GUID:8db43d2f2329593428db90e3b3a6034c",
7
- "GUID:3b7e0a4d14cc4c4b98380d63986903e1",
8
- "GUID:5a902c5989fd2e74c9e7050e78d83db3",
9
- "GameKit.Dependencies",
10
- "GameKit.Utilities",
11
- "GUID:894a6cc6ed5cd2645bb542978cbed6a9",
12
- "GUID:33b0850c3f930a440abe6b01a9898921",
13
- "GUID:103be11cab738ef4d849a96eca5df2eb",
14
- "GUID:30817c1a0e6d646d99c048fc403f5979",
15
- "GUID:325984b52e4128546bc7558552f8b1d2"
16
- ],
17
- "includePlatforms": [],
18
- "excludePlatforms": [],
19
- "allowUnsafeCode": false,
20
- "overrideReferences": false,
21
- "precompiledReferences": [],
22
- "autoReferenced": true,
23
- "defineConstraints": [],
24
- "versionDefines": [],
25
- "noEngineReferences": false
26
- }
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 35d89efae802460782fb13c0912a2c45
3
- timeCreated: 1688947058
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: dce635ecf77446489a0b657fac1d3bf9
3
- timeCreated: 1688947007