gg.easy.airship 0.1.2140 → 0.1.2143
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.
- package/Editor/LuauPluginUpdateCheck.cs +1 -1
- package/Editor/TypescriptServices/Editor/TypescriptLogService.cs +1 -2
- package/Runtime/Code/Bundles/SystemRoot.cs +14 -7
- package/Runtime/Code/Luau/LuauCoreReflection.cs +7 -0
- package/Runtime/Code/Network/ServerConsole.cs +1 -1
- package/Runtime/Code/Network/Simulation/AirshipSimulationManager.cs +5 -1
- package/Runtime/Code/Network/StateSystem/AirshipNetworkedStateManager.cs +1 -1
- package/Runtime/Code/Player/Character/MovementSystems/Character/CharacterMovement.cs +33 -67
- package/Runtime/Code/Player/Character/MovementSystems/Character/Structures/CharacterSnapshotData.cs +103 -52
- package/Runtime/DevConsole/Runtime/DevConsoleMono.cs +0 -3
- package/Runtime/Plugins/Android/libLuauPlugin.so +0 -0
- package/Runtime/Plugins/Linux/libLuauPlugin.so +0 -0
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
- package/Runtime/Plugins/Windows/x64/LuauPlugin.dll +0 -0
- package/Runtime/Plugins/Windows/x64/LuauPlugin.pdb +0 -0
- package/Runtime/Plugins/iOS/LuauPluginIos.a +0 -0
- package/ScriptableBuildPipeline/Editor/Tasks/CalculateAssetDependencyData.cs +7 -5
- package/ThirdParty/Mirror/Core/NetworkClient.cs +2 -0
- package/package.json +1 -1
|
@@ -57,7 +57,7 @@ public static class LuauPluginUpdateCheck {
|
|
|
57
57
|
if (lastHash != "") {
|
|
58
58
|
// Check if user wants to restart
|
|
59
59
|
var acceptsRestart = EditorUtility.DisplayDialog("Luau Plugin Updated",
|
|
60
|
-
"The Luau plugin has updated. Restart Unity to apply changes.", "Quit", "Cancel");
|
|
60
|
+
"The Luau plugin has updated. Restart Unity to apply changes. We're sorry for this..", "Quit", "Cancel");
|
|
61
61
|
if (acceptsRestart) {
|
|
62
62
|
// Verify any unsaved changes are saved
|
|
63
63
|
var confirmedSaveState = EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
|
|
@@ -267,20 +267,24 @@ public class SystemRoot : Singleton<SystemRoot> {
|
|
|
267
267
|
this.networkCollectionIdCounter = 1;
|
|
268
268
|
|
|
269
269
|
// sort packages by load order
|
|
270
|
-
List<List<IEnumerator>> loadLists = new(
|
|
270
|
+
List<List<IEnumerator>> loadLists = new(2);
|
|
271
271
|
for (int i = 0; i < loadLists.Capacity; i++) {
|
|
272
272
|
loadLists.Add(new());
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
List<IEnumerator> GetLoadList(AirshipPackage package) {
|
|
276
|
-
|
|
277
|
-
// if (package.id == "@Easy/CoreMaterials") {
|
|
276
|
+
// // Load core first because packages may depend them
|
|
277
|
+
// if (package.id == "@Easy/CoreMaterials" || package.id == "@Easy/Core") {
|
|
278
278
|
// return loadLists[0];
|
|
279
279
|
// }
|
|
280
|
-
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
|
|
281
|
+
// All packages first
|
|
282
|
+
if (package.packageType == AirshipPackageType.Package) {
|
|
283
|
+
return loadLists[0];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Games go last
|
|
287
|
+
return loadLists[1];
|
|
284
288
|
}
|
|
285
289
|
|
|
286
290
|
// Find packages to load
|
|
@@ -334,7 +338,10 @@ public class SystemRoot : Singleton<SystemRoot> {
|
|
|
334
338
|
}
|
|
335
339
|
#endif
|
|
336
340
|
|
|
341
|
+
Debug.Log("Loading packages...");
|
|
337
342
|
yield return this.WaitAll(loadLists[0].ToArray());
|
|
343
|
+
Debug.Log("Loading game...");
|
|
344
|
+
yield return this.WaitAll(loadLists[1].ToArray());
|
|
338
345
|
|
|
339
346
|
foreach (var ao in this.extraBundleLoadRequests) {
|
|
340
347
|
if (!ao.isDone) {
|
|
@@ -483,6 +483,13 @@ public partial class LuauCore : MonoBehaviour
|
|
|
483
483
|
return true;
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
+
if (t == byteType) {
|
|
487
|
+
byte byteVal = (byte)value;
|
|
488
|
+
System.Int32 integer = byteVal;
|
|
489
|
+
LuauPlugin.LuauPushValueToThread(thread, (int)PODTYPE.POD_INT32, new IntPtr(value: &integer), 0); // 0, because we know how big an intPtr is
|
|
490
|
+
return true;
|
|
491
|
+
}
|
|
492
|
+
|
|
486
493
|
if (t == longType) {
|
|
487
494
|
Int64 intVal = (Int64)value;
|
|
488
495
|
System.Int32 integer = unchecked((int)intVal);
|
|
@@ -157,7 +157,11 @@ namespace Code.Network.Simulation
|
|
|
157
157
|
G_ResimMonitor.FrameObserverBuffer = buffer;
|
|
158
158
|
|
|
159
159
|
if (!isActive) return;
|
|
160
|
-
if (Physics.simulationMode != SimulationMode.Script)
|
|
160
|
+
if (Physics.simulationMode != SimulationMode.Script) {
|
|
161
|
+
// reset the simulation mode if it changed for some reason. This seems to happen on the server when you change prefabs
|
|
162
|
+
// while in play mode with mppm.
|
|
163
|
+
Physics.simulationMode = SimulationMode.Script;
|
|
164
|
+
}
|
|
161
165
|
|
|
162
166
|
// Before running any commands, we perform any resimulation requests that were made during
|
|
163
167
|
// the last tick. This ensures that resimulations don't affect command processing and
|
|
@@ -518,7 +518,7 @@ namespace Code.Network.StateSystem
|
|
|
518
518
|
else
|
|
519
519
|
{
|
|
520
520
|
// Ensure that we always tick the system even if there's no command to process.
|
|
521
|
-
|
|
521
|
+
Debug.LogWarning("No commands left. Last command processed: " + this.lastProcessedCommand);
|
|
522
522
|
this.stateSystem.Tick(null, time, false);
|
|
523
523
|
}
|
|
524
524
|
} while (this.serverCommandBuffer.Count >
|
|
@@ -400,16 +400,24 @@ namespace Code.Player.Character.MovementSystems.Character {
|
|
|
400
400
|
|
|
401
401
|
if (grounded && !currentMoveSnapshot.isGrounded) {
|
|
402
402
|
currentMoveSnapshot.jumpCount = 0;
|
|
403
|
-
currentMoveSnapshot.
|
|
403
|
+
currentMoveSnapshot.canJump = 255;
|
|
404
404
|
OnImpactWithGround?.Invoke(currentVelocity, groundHit);
|
|
405
405
|
if (mode == NetworkedStateSystemMode.Authority && isServer) {
|
|
406
406
|
SAuthImpactEvent(currentVelocity, groundHit);
|
|
407
407
|
} else if (mode == NetworkedStateSystemMode.Authority && isClient) {
|
|
408
408
|
CAuthImpactEvent(currentVelocity, groundHit);
|
|
409
409
|
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// If we have transitioned to airborne
|
|
413
|
+
if (!grounded && currentMoveSnapshot.isGrounded) {
|
|
414
|
+
// Set canJump to the number of ticks of coyote time we have
|
|
415
|
+
currentMoveSnapshot.canJump = (byte) Math.Min(Math.Floor(movementSettings.jumpCoyoteTime / Time.fixedDeltaTime), 255);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
if (!grounded && !currentMoveSnapshot.isGrounded) {
|
|
419
|
+
// If we've now ticked once in the air, remove a tick of canJump time.
|
|
420
|
+
currentMoveSnapshot.canJump = (byte) Math.Max(currentMoveSnapshot.canJump - 1, 0);
|
|
413
421
|
}
|
|
414
422
|
|
|
415
423
|
var groundSlopeDir = detectedGround
|
|
@@ -463,8 +471,10 @@ namespace Code.Player.Character.MovementSystems.Character {
|
|
|
463
471
|
//In the air
|
|
464
472
|
// coyote jump
|
|
465
473
|
if (currentVelocity.y < 0f &&
|
|
466
|
-
currentMoveSnapshot.timeSinceWasGrounded <= movementSettings.jumpCoyoteTime &&
|
|
467
|
-
currentMoveSnapshot.timeSinceJump > movementSettings.jumpCoyoteTime
|
|
474
|
+
// currentMoveSnapshot.timeSinceWasGrounded <= movementSettings.jumpCoyoteTime &&
|
|
475
|
+
// currentMoveSnapshot.timeSinceJump > movementSettings.jumpCoyoteTime
|
|
476
|
+
currentMoveSnapshot.canJump > 0
|
|
477
|
+
) {
|
|
468
478
|
canJump = true;
|
|
469
479
|
}
|
|
470
480
|
//the first jump requires grounded, so if in the air bump the currentMoveState.jumpCount up
|
|
@@ -565,23 +575,6 @@ namespace Code.Player.Character.MovementSystems.Character {
|
|
|
565
575
|
currentMoveSnapshot.isSprinting = false;
|
|
566
576
|
}
|
|
567
577
|
|
|
568
|
-
/*
|
|
569
|
-
* Update Time Since:
|
|
570
|
-
*/
|
|
571
|
-
|
|
572
|
-
if (didJump) {
|
|
573
|
-
currentMoveSnapshot.timeSinceJump = 0f;
|
|
574
|
-
} else {
|
|
575
|
-
currentMoveSnapshot.timeSinceJump = Math.Min(currentMoveSnapshot.timeSinceJump + deltaTime, 100f);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
if (grounded) {
|
|
579
|
-
currentMoveSnapshot.timeSinceWasGrounded = 0f;
|
|
580
|
-
} else {
|
|
581
|
-
currentMoveSnapshot.timeSinceWasGrounded =
|
|
582
|
-
Math.Min(currentMoveSnapshot.timeSinceWasGrounded + deltaTime, 100f);
|
|
583
|
-
}
|
|
584
|
-
|
|
585
578
|
#region CROUCH
|
|
586
579
|
|
|
587
580
|
// Prevent falling off blocks while crouching
|
|
@@ -985,7 +978,7 @@ namespace Code.Player.Character.MovementSystems.Character {
|
|
|
985
978
|
var didStepUp = false;
|
|
986
979
|
if (movementSettings.detectStepUps && //Want to check step ups
|
|
987
980
|
(!command.crouch || !movementSettings.preventStepUpWhileCrouching) && //Not blocked by crouch
|
|
988
|
-
(movementSettings.assistedLedgeJump || currentMoveSnapshot.
|
|
981
|
+
(movementSettings.assistedLedgeJump || currentMoveSnapshot.canJump > 0) && //Grounded // Used to be currentMoveSnapshot.timeSinceBecameGrounded > .05
|
|
989
982
|
Mathf.Abs(newVelocity.x) + Mathf.Abs(newVelocity.z) > .05f) {
|
|
990
983
|
//Moveing
|
|
991
984
|
var (hitStepUp, onRamp, pointOnRamp, stepUpVel) = physics.StepUp(rootPosition,
|
|
@@ -1039,7 +1032,7 @@ namespace Code.Player.Character.MovementSystems.Character {
|
|
|
1039
1032
|
.1f);
|
|
1040
1033
|
}
|
|
1041
1034
|
|
|
1042
|
-
if (Physics.Raycast(projectedPosition + new Vector3(0, -.
|
|
1035
|
+
if (Physics.Raycast(projectedPosition + new Vector3(0, -.25f, 0), -normalizedVel,
|
|
1043
1036
|
out var cliffHit, distanceCheck,
|
|
1044
1037
|
movementSettings.groundCollisionLayerMask, QueryTriggerInteraction.Ignore)) {
|
|
1045
1038
|
|
|
@@ -1048,54 +1041,35 @@ namespace Code.Player.Character.MovementSystems.Character {
|
|
|
1048
1041
|
}
|
|
1049
1042
|
|
|
1050
1043
|
//Stop movement into this surface
|
|
1051
|
-
var colliderDot = 1 - Mathf.Max(0,
|
|
1052
|
-
|
|
1053
|
-
colliderDot
|
|
1044
|
+
// var colliderDot = 1 - Mathf.Max(0,
|
|
1045
|
+
// -Vector3.Dot(-cliffHit.normal, newVelocity));
|
|
1046
|
+
var colliderDot = Vector3.Dot(newVelocity, -cliffHit.normal);
|
|
1047
|
+
//colliderDot *= .9f;
|
|
1054
1048
|
//var colliderDot = 1 - -Vector3.Dot(forwardHit.normal, forwardVector);
|
|
1055
|
-
if (Mathf.Abs(colliderDot) < .01f || normalizedVel.sqrMagnitude < 1f) {
|
|
1056
|
-
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
colliderDot = 0;
|
|
1049
|
+
// if (Mathf.Abs(colliderDot) < .01f || normalizedVel.sqrMagnitude < 1f) {
|
|
1050
|
+
// colliderDot = 0;
|
|
1051
|
+
// }
|
|
1060
1052
|
var flatPoint = new Vector3(cliffHit.point.x, transform.position.y, cliffHit.point.z);
|
|
1061
|
-
if
|
|
1053
|
+
//If we are too close to the edge or if there is an obstruction in the way
|
|
1054
|
+
if (Vector3.Distance(flatPoint, transform.position) < bumpSize - forwardMargin
|
|
1055
|
+
|| Physics.Raycast(transform.position + new Vector3(0,.25f, 0), newVelocity, distanceCheck, movementSettings.groundCollisionLayerMask)) {
|
|
1062
1056
|
//Snap back to the bump distance so you never inch your way to the edge
|
|
1063
1057
|
//newVelocity = new Vector3(0, newVelocity.y, 0);
|
|
1064
1058
|
//var newPos = cliffHit.point - normalizedVel * (bumpSize-forwardMargin);
|
|
1065
1059
|
//transform.position = new Vector3(newPos.x, transform.position.y, newPos.z);
|
|
1066
|
-
|
|
1060
|
+
|
|
1067
1061
|
newVelocity = -normalizedVel;
|
|
1068
1062
|
} else {
|
|
1069
|
-
//limit movement dir based on how straight you are walking into the
|
|
1063
|
+
//limit movement dir based on how straight you are walking into the edge
|
|
1070
1064
|
characterMoveVelocity = Vector3.ProjectOnPlane(characterMoveVelocity, -cliffHit.normal);
|
|
1071
1065
|
characterMoveVelocity.y = 0;
|
|
1072
1066
|
characterMoveVelocity *= colliderDot;
|
|
1073
1067
|
normalizedMoveDir = characterMoveVelocity.normalized;
|
|
1074
1068
|
|
|
1075
|
-
newVelocity
|
|
1076
|
-
newVelocity *= colliderDot;
|
|
1069
|
+
newVelocity -= colliderDot * -cliffHit.normal;
|
|
1070
|
+
//newVelocity *= colliderDot;
|
|
1077
1071
|
}
|
|
1078
1072
|
}
|
|
1079
|
-
// Determine which direction we're mainly moving toward
|
|
1080
|
-
// var xFirst = Math.Abs(command.moveDir.x) > Math.Abs(command.moveDir.z);
|
|
1081
|
-
// Vector3[] vecArr = { new(command.moveDir.x, 0, 0), new(0, 0, command.moveDir.z) };
|
|
1082
|
-
// for (var i = 0; i < 2; i++) {
|
|
1083
|
-
// // We will try x dir first if x magnitude is greater
|
|
1084
|
-
// var index = (xFirst ? i : i + 1) % 2;
|
|
1085
|
-
// var safeDirection = vecArr[index];
|
|
1086
|
-
// var stepPosition = rootPosition + safeDirection.normalized * 0.2f;
|
|
1087
|
-
// (foundGroundedDir, _, _) =
|
|
1088
|
-
// physics.CheckIfGrounded(stepPosition, newVelocity, normalizedMoveDir);
|
|
1089
|
-
// if (foundGroundedDir) {
|
|
1090
|
-
// characterMoveVelocity = safeDirection;
|
|
1091
|
-
// break;
|
|
1092
|
-
// }
|
|
1093
|
-
// }
|
|
1094
|
-
|
|
1095
|
-
// Only if we didn't find a safe direction set move to 0
|
|
1096
|
-
// if (!foundGroundedDir) {
|
|
1097
|
-
// characterMoveVelocity = Vector3.zero;
|
|
1098
|
-
// }
|
|
1099
1073
|
}
|
|
1100
1074
|
}
|
|
1101
1075
|
|
|
@@ -1591,7 +1565,7 @@ namespace Code.Player.Character.MovementSystems.Character {
|
|
|
1591
1565
|
|
|
1592
1566
|
// TS listens to this to update the local camera.
|
|
1593
1567
|
// Position will update from reconcile, but we handle look direction manually.
|
|
1594
|
-
if (mode == NetworkedStateSystemMode.Authority && isServer) {
|
|
1568
|
+
if (mode == NetworkedStateSystemMode.Authority && isServer && !this.manager.serverGeneratesCommands) {
|
|
1595
1569
|
RpcSetLookVector(lookVector);
|
|
1596
1570
|
}
|
|
1597
1571
|
|
|
@@ -1654,14 +1628,6 @@ namespace Code.Player.Character.MovementSystems.Character {
|
|
|
1654
1628
|
return physics.ignoredColliders.ContainsKey(collider.GetInstanceID());
|
|
1655
1629
|
}
|
|
1656
1630
|
|
|
1657
|
-
public float GetTimeSinceWasGrounded() {
|
|
1658
|
-
return currentMoveSnapshot.timeSinceWasGrounded;
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
public float GetTimeSinceBecameGrounded() {
|
|
1662
|
-
return currentMoveSnapshot.timeSinceBecameGrounded;
|
|
1663
|
-
}
|
|
1664
|
-
|
|
1665
1631
|
public void SetVelocity(Vector3 velocity) {
|
|
1666
1632
|
if (mode == NetworkedStateSystemMode.Observer && isServer) {
|
|
1667
1633
|
RpcVelocity(velocity);
|
package/Runtime/Code/Player/Character/MovementSystems/Character/Structures/CharacterSnapshotData.cs
CHANGED
|
@@ -27,9 +27,8 @@ namespace Code.Player.Character.MovementSystems.Character
|
|
|
27
27
|
public float speedModifier = 1; // Not used yet
|
|
28
28
|
public byte jumpCount;
|
|
29
29
|
public CharacterState state = CharacterState.Idle;
|
|
30
|
-
|
|
31
|
-
public
|
|
32
|
-
public float timeSinceJump;
|
|
30
|
+
// > 0 means it is possible to jump. Value is the number of ticks they have left until they can no longer jump. byte.MaxValue when grounded.
|
|
31
|
+
public byte canJump;
|
|
33
32
|
|
|
34
33
|
public BinaryBlob customData;
|
|
35
34
|
|
|
@@ -50,36 +49,69 @@ namespace Code.Player.Character.MovementSystems.Character
|
|
|
50
49
|
|
|
51
50
|
string message = "";
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
var lastProcessedCommandEqual = this.lastProcessedCommand == other.lastProcessedCommand;
|
|
53
|
+
var positionEqual = this.position == other.position;
|
|
54
|
+
var velocityEqual = this.velocity == other.velocity;
|
|
55
|
+
var currentSpeedEqual = CharacterSnapshotDataSerializer.CompressToShort(this.currentSpeed) == CharacterSnapshotDataSerializer.CompressToShort(other.currentSpeed);
|
|
56
|
+
var speedModifierEqual = CharacterSnapshotDataSerializer.CompressToShort(this.speedModifier) == CharacterSnapshotDataSerializer.CompressToShort(other.speedModifier);
|
|
57
|
+
var inputDisabledEqual = inputDisabled == other.inputDisabled;
|
|
58
|
+
var isFlyingEqual = isFlying == other.isFlying;
|
|
59
|
+
var isSprintingEqual = isSprinting == other.isSprinting;
|
|
60
|
+
var jumpCountEqual = jumpCount == other.jumpCount;
|
|
61
|
+
var airborneFromImpulseEqual = airborneFromImpulse == other.airborneFromImpulse;
|
|
62
|
+
var alreadyJumpedEqual = alreadyJumped == other.alreadyJumped;
|
|
63
|
+
var isCrouchingEqual = isCrouching == other.isCrouching;
|
|
64
|
+
var prevStepUpEqual = prevStepUp == other.prevStepUp;
|
|
65
|
+
var isGroundedEqual = isGrounded == other.isGrounded;
|
|
66
|
+
var stateEqual = state == other.state;
|
|
67
|
+
|
|
68
|
+
if (!lastProcessedCommandEqual)
|
|
54
69
|
message += $"lastProcessedCommand: {this.lastProcessedCommand} != {other.lastProcessedCommand}\n";
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
70
|
+
if (!positionEqual)
|
|
71
|
+
message += $"position: {this.position} != {other.position}\n";
|
|
72
|
+
if (!velocityEqual)
|
|
73
|
+
message += $"velocity: {this.velocity} != {other.velocity}\n";
|
|
74
|
+
if (!currentSpeedEqual)
|
|
75
|
+
message += $"currentSpeed: {this.currentSpeed} != {other.currentSpeed}\n";
|
|
76
|
+
if (!speedModifierEqual)
|
|
77
|
+
message += $"speedModifier: {this.speedModifier} != {other.speedModifier}\n";
|
|
78
|
+
if (!inputDisabledEqual)
|
|
61
79
|
message += $"inputDisabled: {inputDisabled} != {other.inputDisabled}\n";
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
|
|
80
|
+
if (!isFlyingEqual)
|
|
81
|
+
message += $"isFlying: {isFlying} != {other.isFlying}\n";
|
|
82
|
+
if (!isSprintingEqual)
|
|
83
|
+
message += $"isSprinting: {isSprinting} != {other.isSprinting}\n";
|
|
84
|
+
if (!jumpCountEqual)
|
|
85
|
+
message += $"jumpCount: {jumpCount} != {other.jumpCount}\n";
|
|
86
|
+
if (!airborneFromImpulseEqual)
|
|
66
87
|
message += $"airborneFromImpulse: {airborneFromImpulse} != {other.airborneFromImpulse}\n";
|
|
67
|
-
if (
|
|
88
|
+
if (!alreadyJumpedEqual)
|
|
68
89
|
message += $"alreadyJumped: {alreadyJumped} != {other.alreadyJumped}\n";
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
if (
|
|
90
|
+
if (!isCrouchingEqual)
|
|
91
|
+
message += $"prevCrouch: {isCrouching} != {other.isCrouching}\n";
|
|
92
|
+
if (!prevStepUpEqual)
|
|
93
|
+
message += $"prevStepUp: {prevStepUp} != {other.prevStepUp}\n";
|
|
94
|
+
if (!isGroundedEqual)
|
|
72
95
|
message += $"prevGrounded: {isGrounded} != {other.isGrounded}\n";
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
96
|
+
if (!stateEqual)
|
|
97
|
+
message += $"state: {state} != {other.state}\n";
|
|
98
|
+
|
|
99
|
+
var same =
|
|
100
|
+
lastProcessedCommandEqual &&
|
|
101
|
+
positionEqual &&
|
|
102
|
+
velocityEqual &&
|
|
103
|
+
currentSpeedEqual &&
|
|
104
|
+
speedModifierEqual &&
|
|
105
|
+
inputDisabledEqual &&
|
|
106
|
+
isFlyingEqual &&
|
|
107
|
+
isSprintingEqual &&
|
|
108
|
+
jumpCountEqual &&
|
|
109
|
+
airborneFromImpulseEqual &&
|
|
110
|
+
alreadyJumpedEqual &&
|
|
111
|
+
isCrouchingEqual &&
|
|
112
|
+
prevStepUpEqual &&
|
|
113
|
+
isGroundedEqual &&
|
|
114
|
+
stateEqual;
|
|
83
115
|
|
|
84
116
|
if (same)
|
|
85
117
|
{
|
|
@@ -103,9 +135,7 @@ namespace Code.Player.Character.MovementSystems.Character
|
|
|
103
135
|
this.velocity = copySnapshot.velocity;
|
|
104
136
|
this.currentSpeed = copySnapshot.currentSpeed;
|
|
105
137
|
this.speedModifier = copySnapshot.speedModifier;
|
|
106
|
-
this.
|
|
107
|
-
this.timeSinceWasGrounded = copySnapshot.timeSinceWasGrounded;
|
|
108
|
-
this.timeSinceBecameGrounded = copySnapshot.timeSinceBecameGrounded;
|
|
138
|
+
this.canJump = copySnapshot.canJump;
|
|
109
139
|
this.state = copySnapshot.state;
|
|
110
140
|
this.isGrounded = copySnapshot.isGrounded;
|
|
111
141
|
this.prevStepUp = copySnapshot.prevStepUp;
|
|
@@ -141,9 +171,7 @@ namespace Code.Player.Character.MovementSystems.Character
|
|
|
141
171
|
velocity = velocity,
|
|
142
172
|
currentSpeed = currentSpeed,
|
|
143
173
|
speedModifier = speedModifier,
|
|
144
|
-
|
|
145
|
-
timeSinceWasGrounded = timeSinceWasGrounded,
|
|
146
|
-
timeSinceBecameGrounded = timeSinceBecameGrounded,
|
|
174
|
+
canJump = canJump,
|
|
147
175
|
state = state,
|
|
148
176
|
isGrounded = isGrounded,
|
|
149
177
|
prevStepUp = prevStepUp,
|
|
@@ -165,6 +193,23 @@ namespace Code.Player.Character.MovementSystems.Character
|
|
|
165
193
|
}
|
|
166
194
|
|
|
167
195
|
public static class CharacterSnapshotDataSerializer {
|
|
196
|
+
|
|
197
|
+
public static ushort CompressToUshort(float value) {
|
|
198
|
+
return (ushort)Math.Clamp(value * 1000f, 0, ushort.MaxValue);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
public static short CompressToShort(float value) {
|
|
202
|
+
return (short)Math.Clamp(value * 1000f, short.MinValue, short.MaxValue);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
public static float DecompressUShort(ushort value) {
|
|
206
|
+
return value / 1000f;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
public static float DecompressShort(short value) {
|
|
210
|
+
return value / 1000f;
|
|
211
|
+
}
|
|
212
|
+
|
|
168
213
|
public static void WriteCharacterSnapshotData(this NetworkWriter writer, CharacterSnapshotData value) {
|
|
169
214
|
byte bools = 0;
|
|
170
215
|
SetBit(ref bools, 0, value.inputDisabled);
|
|
@@ -176,23 +221,26 @@ namespace Code.Player.Character.MovementSystems.Character
|
|
|
176
221
|
SetBit(ref bools, 6, value.prevStepUp);
|
|
177
222
|
SetBit(ref bools, 7, value.isGrounded);
|
|
178
223
|
writer.Write(bools);
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
224
|
+
|
|
225
|
+
if (value.customData != null) {
|
|
226
|
+
writer.WriteInt(value.customData.dataSize);
|
|
227
|
+
writer.WriteBytes(value.customData.data, 0, value.customData.data.Length);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
writer.WriteInt(0);
|
|
231
|
+
}
|
|
182
232
|
|
|
183
233
|
writer.Write(value.time);
|
|
184
234
|
writer.Write(value.lastProcessedCommand);
|
|
185
235
|
writer.Write(value.position);
|
|
186
236
|
writer.Write(value.velocity);
|
|
187
|
-
writer.Write((
|
|
188
|
-
writer.Write((
|
|
189
|
-
writer.Write((
|
|
237
|
+
writer.Write(CompressToShort(value.lookVector.x));
|
|
238
|
+
writer.Write(CompressToShort(value.lookVector.y));
|
|
239
|
+
writer.Write(CompressToShort(value.lookVector.z));
|
|
190
240
|
writer.Write(value.currentSpeed);
|
|
191
241
|
// This makes our max speed modifier 65.535 with a 0.001 precision.
|
|
192
|
-
writer.Write((
|
|
193
|
-
writer.Write(
|
|
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));
|
|
242
|
+
writer.Write(CompressToUshort(value.speedModifier));
|
|
243
|
+
writer.Write(value.canJump);
|
|
196
244
|
writer.Write((byte) value.state);
|
|
197
245
|
writer.Write(value.jumpCount);
|
|
198
246
|
}
|
|
@@ -200,8 +248,11 @@ namespace Code.Player.Character.MovementSystems.Character
|
|
|
200
248
|
public static CharacterSnapshotData ReadCharacterSnapshotData(this NetworkReader reader) {
|
|
201
249
|
var bools = reader.Read<byte>();
|
|
202
250
|
var customDataSize = reader.ReadInt();
|
|
203
|
-
|
|
204
|
-
|
|
251
|
+
BinaryBlob customData = default;
|
|
252
|
+
if (customDataSize != 0) {
|
|
253
|
+
var customDataArray = reader.ReadBytes(customDataSize);
|
|
254
|
+
customData = new BinaryBlob(customDataArray);
|
|
255
|
+
}
|
|
205
256
|
return new CharacterSnapshotData() {
|
|
206
257
|
inputDisabled = GetBit(bools, 0),
|
|
207
258
|
isFlying = GetBit(bools, 1),
|
|
@@ -211,17 +262,17 @@ namespace Code.Player.Character.MovementSystems.Character
|
|
|
211
262
|
isCrouching = GetBit(bools, 5),
|
|
212
263
|
prevStepUp = GetBit(bools, 6),
|
|
213
264
|
isGrounded = GetBit(bools, 7),
|
|
214
|
-
|
|
215
265
|
time = reader.Read<double>(),
|
|
216
266
|
lastProcessedCommand = reader.Read<int>(),
|
|
217
267
|
position = reader.Read<Vector3>(),
|
|
218
268
|
velocity = reader.Read<Vector3>(),
|
|
219
|
-
lookVector = new Vector3(
|
|
269
|
+
lookVector = new Vector3(
|
|
270
|
+
DecompressShort(reader.Read<short>()),
|
|
271
|
+
DecompressShort(reader.Read<short>()),
|
|
272
|
+
DecompressShort(reader.Read<short>())),
|
|
220
273
|
currentSpeed = reader.Read<float>(),
|
|
221
|
-
speedModifier = reader.Read<ushort>()
|
|
222
|
-
|
|
223
|
-
timeSinceWasGrounded = reader.Read<byte>() * Time.fixedDeltaTime,
|
|
224
|
-
timeSinceBecameGrounded = reader.Read<byte>() * Time.fixedDeltaTime,
|
|
274
|
+
speedModifier = DecompressUShort(reader.Read<ushort>()),
|
|
275
|
+
canJump = reader.Read<byte>(),
|
|
225
276
|
state = (CharacterState) reader.Read<byte>(),
|
|
226
277
|
jumpCount = reader.Read<byte>(),
|
|
227
278
|
customData = customData,
|
|
@@ -675,8 +675,6 @@ namespace Airship.DevConsole
|
|
|
675
675
|
_inputField.textComponent.alignment = TextAnchor.MiddleLeft;
|
|
676
676
|
|
|
677
677
|
if (EventSystem.current != null) {
|
|
678
|
-
// if (_inputField.isFocused)
|
|
679
|
-
print("setting to null");
|
|
680
678
|
EventSystem.current.SetSelectedGameObject(null);
|
|
681
679
|
}
|
|
682
680
|
|
|
@@ -1385,7 +1383,6 @@ namespace Airship.DevConsole
|
|
|
1385
1383
|
|
|
1386
1384
|
// Force the input field to be focused by the event system
|
|
1387
1385
|
if (_focusInputField && !Application.isMobilePlatform) {
|
|
1388
|
-
Debug.Log("Selecting input field.");
|
|
1389
1386
|
EventSystem.current.SetSelectedGameObject(_inputField.gameObject);
|
|
1390
1387
|
_focusInputField = false;
|
|
1391
1388
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -155,7 +155,9 @@ namespace UnityEditor.Build.Pipeline.Tasks
|
|
|
155
155
|
{
|
|
156
156
|
foreach (AssetOutput o in output.AssetResults)
|
|
157
157
|
{
|
|
158
|
-
m_DependencyData.AssetInfo.
|
|
158
|
+
if (!m_DependencyData.AssetInfo.TryAdd(o.asset, o.assetInfo)) {
|
|
159
|
+
Debug.LogWarning("m_DependencyData already contained asset: " + AssetDatabase.GUIDToAssetPath(o.asset));
|
|
160
|
+
}
|
|
159
161
|
foreach (var objectDependencyInfo in o.objectDependencyInfo)
|
|
160
162
|
m_ObjectDependencyData.ObjectDependencyMap[objectDependencyInfo.Object] = objectDependencyInfo.Dependencies;
|
|
161
163
|
}
|
|
@@ -167,7 +169,7 @@ namespace UnityEditor.Build.Pipeline.Tasks
|
|
|
167
169
|
ExpandReferences(assetOutput, m_ObjectDependencyData.ObjectDependencyMap);
|
|
168
170
|
#endif
|
|
169
171
|
|
|
170
|
-
m_DependencyData.AssetUsage.
|
|
172
|
+
m_DependencyData.AssetUsage.TryAdd(assetOutput.asset, assetOutput.usageTags);
|
|
171
173
|
|
|
172
174
|
Dictionary<ObjectIdentifier, System.Type[]> objectTypes = new Dictionary<ObjectIdentifier, Type[]>();
|
|
173
175
|
foreach (var objectType in assetOutput.objectTypes)
|
|
@@ -183,21 +185,21 @@ namespace UnityEditor.Build.Pipeline.Tasks
|
|
|
183
185
|
ReferencedObjects = assetOutput.assetInfo.referencedObjects,
|
|
184
186
|
ObjectTypes = objectTypes
|
|
185
187
|
};
|
|
186
|
-
m_Results.AssetResults.
|
|
188
|
+
m_Results.AssetResults.TryAdd(assetOutput.asset, resultData);
|
|
187
189
|
}
|
|
188
190
|
|
|
189
191
|
if (assetOutput.spriteData != null)
|
|
190
192
|
{
|
|
191
193
|
if (m_SpriteData == null)
|
|
192
194
|
m_SpriteData = new BuildSpriteData();
|
|
193
|
-
m_SpriteData.ImporterData.
|
|
195
|
+
m_SpriteData.ImporterData.TryAdd(assetOutput.asset, assetOutput.spriteData);
|
|
194
196
|
}
|
|
195
197
|
|
|
196
198
|
if (!m_Parameters.DisableVisibleSubAssetRepresentations && assetOutput.extendedData != null)
|
|
197
199
|
{
|
|
198
200
|
if (m_ExtendedAssetData == null)
|
|
199
201
|
m_ExtendedAssetData = new BuildExtendedAssetData();
|
|
200
|
-
m_ExtendedAssetData.ExtendedData.
|
|
202
|
+
m_ExtendedAssetData.ExtendedData.TryAdd(assetOutput.asset, assetOutput.extendedData);
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
if (assetOutput.objectTypes != null)
|
|
@@ -1045,7 +1045,9 @@ namespace Mirror
|
|
|
1045
1045
|
// the players object for example.
|
|
1046
1046
|
public static bool Ready()
|
|
1047
1047
|
{
|
|
1048
|
+
#if AIRSHIP_PLAYER
|
|
1048
1049
|
Debug.Log($"NetworkClient.Ready() called with active scene: " + SceneManager.GetActiveScene().name);
|
|
1050
|
+
#endif
|
|
1049
1051
|
if (ready)
|
|
1050
1052
|
{
|
|
1051
1053
|
Debug.LogError("NetworkClient is already ready. It shouldn't be called twice.");
|