gg.easy.airship 0.1.2182 → 0.1.2183

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.
@@ -1,8 +1,9 @@
1
1
  // ReSharper disable InconsistentNaming
2
2
 
3
3
  namespace Code {
4
+ [LuauAPI]
4
5
  public static class AirshipConst {
5
- public const int playerVersion = 16;
6
+ public const int playerVersion = 17;
6
7
 
7
8
  /// <summary>
8
9
  /// The server will kick clients that have a playerVersion lower than this value.
@@ -1064,33 +1064,47 @@ public partial class LuauCore : MonoBehaviour {
1064
1064
  /// <returns>True if successful, otherwise false if nothing was written.</returns>
1065
1065
  private static bool FastGetAndWriteValueProperty(IntPtr thread, object objectReference, PropertyGetReflectionCache cacheData) {
1066
1066
  var propType = cacheData.propertyInfo.PropertyType;
1067
- if (propType == intType) {
1067
+ if (IsOfType(propType, intType)) {
1068
1068
  var intValue = GetValue<int>(objectReference, cacheData);
1069
1069
  WritePropertyToThreadInt32(thread, intValue);
1070
1070
  return true;
1071
1071
  }
1072
- if (propType == doubleType) {
1072
+ if (IsOfType(propType, doubleType)) {
1073
1073
  var doubleVal = GetValue<double>(objectReference, cacheData);
1074
1074
  WritePropertyToThreadDouble(thread, doubleVal);
1075
1075
  return true;
1076
1076
  }
1077
- if (propType == floatType) {
1077
+ if (IsOfType(propType, floatType)) {
1078
1078
  var shortVal = GetValue<float>(objectReference, cacheData);
1079
1079
  WritePropertyToThreadSingle(thread, shortVal);
1080
1080
  return true;
1081
1081
  }
1082
- if (propType == vector3Type) {
1082
+ if (IsOfType(propType, vector3Type)) {
1083
1083
  var vecValue = GetValue<Vector3>(objectReference, cacheData);
1084
1084
  WritePropertyToThreadVector3(thread, vecValue);
1085
1085
  return true;
1086
1086
  }
1087
- if (propType == quaternionType) {
1087
+ if (IsOfType(propType, vector2Type)) {
1088
+ var vecValue = GetValue<Vector2>(objectReference, cacheData);
1089
+ WritePropertyToThreadVector2(thread, vecValue);
1090
+ return true;
1091
+ }
1092
+ if (IsOfType(propType, quaternionType)) {
1088
1093
  var quatValue = GetValue<Quaternion>(objectReference, cacheData);
1089
1094
  WritePropertyToThreadQuaternion(thread, quatValue);
1090
1095
  return true;
1091
1096
  }
1092
1097
  return false;
1093
1098
  }
1099
+
1100
+ /// <summary>
1101
+ /// Checks if type is of specified ofType including if it is a reference of the ofType.
1102
+ /// </summary>
1103
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
1104
+ private static bool IsOfType(Type type, Type ofType) {
1105
+ if (type.IsByRef) return type == ofType.MakeByRefType();
1106
+ return type == ofType;
1107
+ }
1094
1108
 
1095
1109
  public static string GetRequirePath(string originalScriptPath, string fileNameStr) {
1096
1110
  Profiler.BeginSample("GetRequirePath");
@@ -242,6 +242,7 @@ namespace Luau {
242
242
  ["AudioMixerGroupController"] = LuauContextAll,
243
243
  #endif
244
244
  ["Toggle"] = LuauContextAll, // "no idea why this needs to be a string...
245
+ ["UnityEngine.InputSystem.FastTouchscreen"] = LuauContextAll,
245
246
  };
246
247
 
247
248
  private static readonly HashSet<string> SkipNamespaces = new() {
@@ -0,0 +1,31 @@
1
+ using System;
2
+ using UnityEngine.InputSystem;
3
+ using UnityEngine.InputSystem.Controls;
4
+
5
+ [LuauAPI]
6
+ public class InputControlAPI : BaseLuaAPIClass {
7
+ public override Type GetAPIType() {
8
+ return typeof(InputControl);
9
+ }
10
+
11
+ public override Type[] GetDescendantTypes() {
12
+ return new Type[] {
13
+ typeof(UnityEngine.InputSystem.Controls.AxisControl),
14
+ typeof(UnityEngine.InputSystem.Controls.ButtonControl),
15
+ typeof(UnityEngine.InputSystem.Controls.DeltaControl),
16
+ typeof(UnityEngine.InputSystem.Controls.DoubleControl),
17
+ typeof(UnityEngine.InputSystem.Controls.IntegerControl),
18
+ typeof(UnityEngine.InputSystem.Controls.DpadControl),
19
+ typeof(UnityEngine.InputSystem.Controls.KeyControl),
20
+ typeof(UnityEngine.InputSystem.Controls.QuaternionControl),
21
+ typeof(UnityEngine.InputSystem.Controls.StickControl),
22
+ typeof(UnityEngine.InputSystem.Controls.TouchControl),
23
+ typeof(UnityEngine.InputSystem.Controls.Vector2Control),
24
+ typeof(UnityEngine.InputSystem.Controls.Vector3Control),
25
+ typeof(UnityEngine.InputSystem.Controls.AnyKeyControl),
26
+ typeof(UnityEngine.InputSystem.Controls.DiscreteButtonControl),
27
+ typeof(UnityEngine.InputSystem.Controls.TouchPhaseControl),
28
+ typeof(UnityEngine.InputSystem.Controls.TouchPressControl),
29
+ };
30
+ }
31
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 4af1c2dcd75643c19c006d14009b287f
3
+ timeCreated: 1759165572
@@ -82,6 +82,14 @@ public class LuauHelper : Singleton<LuauHelper> {
82
82
  var instance = (BaseLuaAPIClass)Activator.CreateInstance(type);
83
83
  var apiType = instance.GetAPIType();
84
84
  ReflectionList.AddToReflectionList(apiType, typeAttribute.AllowedContextsMask);
85
+
86
+ var descendantTypes = instance.GetDescendantTypes();
87
+ if (descendantTypes != null) {
88
+ foreach (var descendant in descendantTypes) {
89
+ ReflectionList.AddToReflectionList(descendant, typeAttribute.AllowedContextsMask);
90
+ }
91
+ }
92
+
85
93
  LuauCore.CoreInstance.RegisterBaseAPI(instance);
86
94
 
87
95
  // Override context of individual methods / members
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg.easy.airship",
3
- "version": "0.1.2182",
3
+ "version": "0.1.2183",
4
4
  "displayName": "Airship",
5
5
  "unity": "2021.3",
6
6
  "unityRelease": "12f1",