gg.easy.airship 0.1.2147 → 0.1.2148

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.
@@ -23,7 +23,8 @@
23
23
  "GUID:ec266f293c0b4f6c9d06847488a52a0c",
24
24
  "GUID:325984b52e4128546bc7558552f8b1d2",
25
25
  "GUID:befe48b9a36afc04ea625c93daad910e",
26
- "GUID:21d1eb854b91ade49bc69a263d12bee2"
26
+ "GUID:21d1eb854b91ade49bc69a263d12bee2",
27
+ "GUID:d8b63aba1907145bea998dd612889d6b"
27
28
  ],
28
29
  "includePlatforms": [],
29
30
  "excludePlatforms": [],
@@ -663,7 +663,7 @@ public partial class LuauCore : MonoBehaviour {
663
663
 
664
664
  private static T GetValue<T>(object instance, PropertyGetReflectionCache cacheData) {
665
665
  if (typeof(T) == typeof(object) || cacheData.IsNativeClass || cacheData.IsStruct) {
666
- return (T) cacheData.propertyInfo.GetMethod.Invoke(instance, null);
666
+ return (T) cacheData.propertyInfo.GetValue(instance);
667
667
  }
668
668
 
669
669
  if (!cacheData.HasGetPropertyFunc) {
@@ -4,6 +4,7 @@ using System.Reflection;
4
4
  using ElRaccoone.Tweens;
5
5
  using Mirror;
6
6
  using TMPro;
7
+ using Unity.Mathematics;
7
8
  using UnityEngine;
8
9
  using UnityEngine.AI;
9
10
  using UnityEngine.Animations.Rigging;
@@ -191,6 +192,8 @@ namespace Luau {
191
192
  [typeof(CurveUtility)] = LuauContextAll,
192
193
  [typeof(SplineUtility)] = LuauContextAll,
193
194
  [typeof(BezierKnot)] = LuauContextAll,
195
+ [typeof(float3)] = LuauContextAll,
196
+ [typeof(SplineAnimate)] = LuauContextAll,
194
197
 
195
198
  // Rigging
196
199
  [typeof(TwoBoneIKConstraint)] = LuauContextAll,
@@ -0,0 +1,9 @@
1
+ using System;
2
+ using UnityEngine.Splines;
3
+
4
+ [LuauAPI]
5
+ public class BezierCurveAPI : BaseLuaAPIClass {
6
+ public override Type GetAPIType() {
7
+ return typeof(BezierCurve);
8
+ }
9
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 294404385e5240499d356c2e24be088f
3
+ timeCreated: 1750789147
@@ -0,0 +1,9 @@
1
+ using System;
2
+ using UnityEngine.Splines;
3
+
4
+ [LuauAPI]
5
+ public class BezierKnotAPI : BaseLuaAPIClass {
6
+ public override Type GetAPIType() {
7
+ return typeof(BezierKnot);
8
+ }
9
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 814c95bc6e2b4631a9a19eaff11f8306
3
+ timeCreated: 1750799536
@@ -6,6 +6,7 @@ using Airship.DevConsole;
6
6
  using Code.VoiceChat;
7
7
  using Mirror;
8
8
  using Tayx.Graphy;
9
+ using Unity.Mathematics;
9
10
  using UnityEngine;
10
11
  using UnityEngine.Networking;
11
12
  using UnityEngine.SceneManagement;
@@ -448,6 +449,10 @@ public static class Bridge {
448
449
  return scenes.ToArray();
449
450
  }
450
451
 
452
+ public static float3 MakeFloat3(Vector3 v) {
453
+ return new float3(v.x, v.y, v.z);
454
+ }
455
+
451
456
  public static void SetSkyboxMaterial(Material material) {
452
457
  RenderSettings.skybox = material;
453
458
  }
@@ -0,0 +1,9 @@
1
+ using System;
2
+ using UnityEngine.Splines;
3
+
4
+ [LuauAPI]
5
+ public class CurveUtilityAPI : BaseLuaAPIClass {
6
+ public override Type GetAPIType() {
7
+ return typeof(CurveUtility);
8
+ }
9
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: ca4d12d19ec44c70966123b460995fb6
3
+ timeCreated: 1750792387
@@ -0,0 +1,9 @@
1
+ using System;
2
+ using Unity.Mathematics;
3
+
4
+ [LuauAPI]
5
+ public class Float3API : BaseLuaAPIClass {
6
+ public override Type GetAPIType() {
7
+ return typeof(float3);
8
+ }
9
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 58fe41b1a8c74415aa712ecc2c966548
3
+ timeCreated: 1750789056
@@ -0,0 +1,9 @@
1
+ using System;
2
+ using UnityEngine.Splines;
3
+
4
+ [LuauAPI]
5
+ public class SplineAPI : BaseLuaAPIClass {
6
+ public override Type GetAPIType() {
7
+ return typeof(Spline);
8
+ }
9
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 97306bd413f14568b70abf904252b964
3
+ timeCreated: 1750789235
@@ -0,0 +1,52 @@
1
+ using System;
2
+ using Unity.Mathematics;
3
+ using UnityEngine.Splines;
4
+
5
+ [LuauAPI]
6
+ public class SplineUtilityAPI : BaseLuaAPIClass {
7
+ public override Type GetAPIType() {
8
+ return typeof(SplineUtility);
9
+ }
10
+
11
+ // public override int OverrideStaticMethod(LuauContext context, IntPtr thread, string methodName, int numParameters,
12
+ // ArraySegment<int> parameterDataPODTypes, ArraySegment<IntPtr> parameterDataPtrs, ArraySegment<int> parameterDataSizes) {
13
+ //
14
+ // if (methodName == "EvaluatePosition") {
15
+ // var spline = (ISpline) LuauCore.GetParameterAsObject(0, numParameters, parameterDataPODTypes, parameterDataPtrs,
16
+ // parameterDataSizes, thread);
17
+ //
18
+ // var f = LuauCore.GetParameterAsFloat(1, numParameters, parameterDataPODTypes, parameterDataPtrs,
19
+ // parameterDataSizes);
20
+ //
21
+ // var result = SplineUtility.EvaluatePosition(spline, f);
22
+ // LuauCore.WritePropertyToThread(thread, result, typeof(float3));
23
+ // return 1;
24
+ // }
25
+ //
26
+ // if (methodName == "EvaluateTangent") {
27
+ // var spline = (ISpline) LuauCore.GetParameterAsObject(0, numParameters, parameterDataPODTypes, parameterDataPtrs,
28
+ // parameterDataSizes, thread);
29
+ //
30
+ // var f = LuauCore.GetParameterAsFloat(1, numParameters, parameterDataPODTypes, parameterDataPtrs,
31
+ // parameterDataSizes);
32
+ //
33
+ // var result = SplineUtility.EvaluateTangent(spline, f);
34
+ // LuauCore.WritePropertyToThread(thread, result, typeof(float3));
35
+ // return 1;
36
+ // }
37
+ //
38
+ // if (methodName == "EvaluateUpVector") {
39
+ // var spline = (ISpline) LuauCore.GetParameterAsObject(0, numParameters, parameterDataPODTypes, parameterDataPtrs,
40
+ // parameterDataSizes, thread);
41
+ //
42
+ // var f = LuauCore.GetParameterAsFloat(1, numParameters, parameterDataPODTypes, parameterDataPtrs,
43
+ // parameterDataSizes);
44
+ //
45
+ // var result = SplineUtility.EvaluateUpVector(spline, f);
46
+ // LuauCore.WritePropertyToThread(thread, result, typeof(float3));
47
+ // return 1;
48
+ // }
49
+ //
50
+ // return -1;
51
+ // }
52
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 84255f56d8ff4318b10e0e2e848fc5b8
3
+ timeCreated: 1750791244
@@ -1080,96 +1080,78 @@ namespace Code.Player.Character.MovementSystems.Character {
1080
1080
  }
1081
1081
  }
1082
1082
  } else {
1083
+ //GRID BASED EDGE DETECTION
1083
1084
  //Find the edge of the characters collider
1084
- var axisAlignedDir = new Vector3(Mathf.Round(velocityNorm.x), 0, Mathf.Round(velocityNorm.z));
1085
- // if (Mathf.Abs(axisAlignedDir.x) > Mathf.Abs(axisAlignedDir.z)) {
1086
- // axisAlignedDir.z = 0;
1087
- // } else {
1088
- // axisAlignedDir.x = 0;
1089
- // }
1090
-
1085
+ var smallRadius = (characterRadius - forwardMargin) * .9f;
1091
1086
  var projectedPosition = transform.position + new Vector3(0, .1f, 0) +
1092
- axisAlignedDir * distanceCheck +
1093
1087
  velocityNorm * velocityMag;
1094
1088
 
1095
1089
  if (drawDebugGizmos_CROUCH) {
1096
1090
  GizmoUtils.DrawSphere(transform.position + new Vector3(0, .1f, 0), .05f, Color.black, 4, .1f);
1097
- GizmoUtils.DrawSphere(transform.position + new Vector3(0, .1f, 0) +
1098
- axisAlignedDir * distanceCheck, .08f, Color.gray, 4, .1f);
1091
+ //GizmoUtils.DrawSphere(transform.position + new Vector3(0, .1f, 0) +
1092
+ //axisAlignedDir * distanceCheck, .08f, Color.gray, 4, .1f);
1099
1093
  GizmoUtils.DrawSphere(projectedPosition, .1f, Color.blue, 4, .1f);
1100
1094
  }
1101
1095
 
1102
- //Cast to see if there is ground where we want to walk (to handle cases where you can walk across gaps even if technically there is air in the voxel you are stepping onto)
1103
- var hitGround = Physics.BoxCast(projectedPosition,
1104
- new Vector3(characterRadius - forwardMargin, .05f, characterRadius - forwardMargin),
1105
- Vector3.down, out var groundHitInfo, Quaternion.identity, .25f,
1106
- movementSettings.groundCollisionLayerMask);
1107
-
1108
- if (drawDebugGizmos_CROUCH) {
1109
- GizmoUtils.DrawBox(projectedPosition, Quaternion.identity,
1110
- new Vector3(characterRadius, .05f, characterRadius), Color.white, .1f);
1111
- Debug.DrawLine(projectedPosition, projectedPosition + Vector3.down * .25f,
1112
- hitGround ? Color.white : Color.red, .1f);
1096
+ var validGround = false;
1097
+ var groundCheckI = 0;
1098
+ var groundCheckPositions = new[] { projectedPosition, projectedPosition, projectedPosition };
1099
+ var groundVelocities = new[] { newVelocity, newVelocity, newVelocity };
1100
+ if (Mathf.Abs(newVelocity.x) > Mathf.Abs(newVelocity.z)) {
1101
+ //Check X Dir first
1102
+ groundCheckPositions[1].z = transform.position.z;
1103
+ groundCheckPositions[2].x = transform.position.x;
1104
+ groundVelocities[1].z = 0;
1105
+ groundVelocities[2].x = 0;
1106
+ } else {
1107
+ //Check Z dir first
1108
+ groundCheckPositions[1].x = transform.position.x;
1109
+ groundCheckPositions[2].z = transform.position.z;
1110
+ groundVelocities[1].x = 0;
1111
+ groundVelocities[2].z = 0;
1113
1112
  }
1114
1113
 
1115
- if (hitGround) {
1116
- //Raycast to see if there is a path to this ground we found
1117
- var rayCheckPos = transform.position + new Vector3(0, .175f, 0);
1118
- var endPos = projectedPosition + new Vector3(0, .175f, 0);
1119
- var dist = Vector3.Distance(groundHitInfo.point, rayCheckPos);
1120
- if (Physics.Raycast(rayCheckPos, endPos - rayCheckPos, dist)) {
1121
- //Something is in the way of the ground
1122
- hitGround = false;
1123
- }
1114
+ do {
1115
+ //Cast to see if there is ground where we want to walk (to handle cases where you can walk across gaps even if technically there is air in the voxel you are stepping onto)
1116
+ validGround = Physics.BoxCast(groundCheckPositions[groundCheckI],
1117
+ new Vector3(smallRadius, .05f, smallRadius),
1118
+ Vector3.down, out var groundHitInfo, Quaternion.identity, .25f,
1119
+ movementSettings.groundCollisionLayerMask);
1124
1120
 
1125
1121
  if (drawDebugGizmos_CROUCH) {
1126
- Debug.DrawLine(rayCheckPos, rayCheckPos + (endPos - rayCheckPos) * dist,
1127
- hitGround ? Color.green : Color.magenta, .1f);
1128
- GizmoUtils.DrawSphere(groundHitInfo.point, .05f, hitGround ? Color.green : Color.magenta, 4,
1129
- .1f);
1122
+ GizmoUtils.DrawBox(groundCheckPositions[groundCheckI], Quaternion.identity,
1123
+ new Vector3(characterRadius, .05f, characterRadius),
1124
+ validGround ? Color.white : Color.red, .1f);
1130
1125
  }
1131
- }
1132
1126
 
1133
- //var hitGround = false;
1134
-
1135
- if (!hitGround) {
1136
- // Block Movement by pushing to perpendicular directions
1137
- // Find out which directions are empty air
1138
- var dirDistance = characterRadius + forwardMargin;
1139
- var cornerDistance = characterRadius - forwardMargin;
1140
- var offsetDirs = new Vector3[] {
1141
- new(-dirDistance, .1f, 0),
1142
- new(dirDistance, .1f, 0),
1143
- new(0, .1f, -dirDistance),
1144
- new(0, .1f, dirDistance),
1145
- new(cornerDistance, .1f, -cornerDistance),
1146
- new(cornerDistance, .1f, cornerDistance),
1147
- new(-cornerDistance, .1f, -cornerDistance),
1148
- new(-cornerDistance, .1f, cornerDistance)
1149
- };
1150
- Vector3 currentDir;
1151
- Color color;
1152
- for (var i = 0; i < offsetDirs.Length; i++) {
1153
- color = Color.green;
1154
- currentDir = offsetDirs[i];
1155
- var dot = Vector3.Dot(newVelocity, currentDir);
1156
- if (dot > 0 && !Physics.Raycast(transform.position + currentDir, Vector3.down, .25f,
1127
+ if (validGround) {
1128
+ //Raycast to see if there is a path to this ground we found
1129
+ var rayCheckPos = transform.position + new Vector3(0, .175f, 0);
1130
+ var endPos = groundCheckPositions[groundCheckI] + new Vector3(0, .175f, 0);
1131
+ var dist = Vector3.Distance(groundHitInfo.point, rayCheckPos);
1132
+ if (Physics.Raycast(rayCheckPos, endPos - rayCheckPos, dist,
1157
1133
  movementSettings.groundCollisionLayerMask)) {
1158
- //Empty air in this dir
1159
- newVelocity.x = currentDir.x == 0
1160
- ? Mathf.Sign(newVelocity.x) * Mathf.Abs(newVelocity.x)
1161
- : 0;
1162
- newVelocity.z = currentDir.z == 0
1163
- ? Mathf.Sign(newVelocity.z) * Mathf.Abs(newVelocity.z)
1164
- : 0;
1165
- color = Color.red;
1134
+ //Something is in the way of the ground
1135
+ validGround = false;
1166
1136
  }
1167
1137
 
1168
1138
  if (drawDebugGizmos_CROUCH) {
1169
- Debug.DrawLine(transform.position + currentDir,
1170
- transform.position + offsetDirs[i] - Vector3.down * .25f, color, .1f);
1139
+ Debug.DrawLine(rayCheckPos, rayCheckPos + (endPos - rayCheckPos) * dist,
1140
+ validGround ? Color.green : Color.magenta, .1f);
1141
+ GizmoUtils.DrawSphere(groundHitInfo.point, .05f,
1142
+ validGround ? Color.green : Color.magenta, 4,
1143
+ .1f);
1171
1144
  }
1172
1145
  }
1146
+
1147
+ groundCheckI++;
1148
+ } while (!validGround && groundCheckI < 3);
1149
+
1150
+ if (validGround) {
1151
+ newVelocity = groundVelocities[groundCheckI - 1];
1152
+ } else {
1153
+ newVelocity.x = 0;
1154
+ newVelocity.z = 0;
1173
1155
  }
1174
1156
  }
1175
1157
  }
@@ -323,11 +323,21 @@ namespace CsToTs.TypeScript {
323
323
  var commentLines = GetFunctionComment(method);
324
324
  string generics = "";
325
325
  if (method.IsGenericMethod) {
326
- var genericPrms = method.GetGenericArguments().Select(t => GetTypeRef(t, context));
326
+ var genericPrms = method.GetGenericArguments().Select(t => {
327
+ var baseStr = GetTypeRef(t, context);
328
+ var constraints = t.GetGenericParameterConstraints().Where(c => c != typeof(ValueType)).ToArray();
329
+ if (constraints.Length > 0) {
330
+ baseStr = $"{baseStr} extends {string.Join(" & ", constraints.Select((constraintType) => GetTypeRef(constraintType, context)))}";
331
+ }
332
+ return baseStr;
333
+ });
327
334
  generics = $"<{string.Join(", ", genericPrms)}>";
328
335
  }
329
336
 
330
- var parameters = method.GetParameters()
337
+ var paramInfos = method.GetParameters();
338
+ if (paramInfos.Any(p => p.IsOut)) continue; // Skip over any out variable methods
339
+
340
+ var parameters = paramInfos
331
341
  .Select(p => new MemberDefinition(p.Name, GetTypeRef(p.ParameterType, context)));
332
342
 
333
343
  var decorators = useDecorators(method);
@@ -596,6 +606,10 @@ namespace CsToTs.TypeScript {
596
606
  return $"{typeName}<{string.Join(", ", genericPrms)}>";
597
607
  }
598
608
 
609
+ // Clear off the ending "&" from type name. This exists for ref types (which we support)
610
+ // and for out types (which we exclude anyway, so this doesn't matter for those).
611
+ typeName = typeName.Replace("&", "");
612
+
599
613
  return typeName;
600
614
  }
601
615
 
@@ -47,6 +47,7 @@ using UnityEngine.VFX;
47
47
  using Code.Player.Accessories;
48
48
  using Code.Player.Character.MovementSystems.Character;
49
49
  using Code.Player.Character.NetworkedMovement;
50
+ using Unity.Mathematics;
50
51
  using UnityEngine.Splines;
51
52
 
52
53
  public class TypeGenerator : MonoBehaviour
@@ -258,6 +259,7 @@ public class TypeGenerator : MonoBehaviour
258
259
  typeof(Spline),
259
260
  typeof(SplineAnimate),
260
261
  typeof(SplineUtility),
262
+ typeof(float3),
261
263
 
262
264
  // Airship
263
265
  typeof(AnimationEventData),
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg.easy.airship",
3
- "version": "0.1.2147",
3
+ "version": "0.1.2148",
4
4
  "displayName": "Airship",
5
5
  "unity": "2021.3",
6
6
  "unityRelease": "12f1",