Update to Gamecraft 2020.12.16.14.19 and custom block stuff

- Fixed the crash on second time start
- Tweaked more stuff about the block

Breaking changes coming from FMOD 2.0:
- Audio[int index] changed to Audio[PARAMETER_ID index]
- Audio.Parameters removed
This commit is contained in:
Norbi Peti 2020-12-17 02:34:36 +01:00
parent 4e16f251ee
commit a7f6a16231
8 changed files with 40 additions and 44 deletions

View file

@ -227,7 +227,7 @@ namespace GamecraftModdingAPI.Blocks
for (int i = 0; i < joints.count; i++) for (int i = 0; i < joints.count; i++)
{ {
ref var joint = ref joints.buffer[i]; ref var joint = ref joints.buffer[i];
if (joint.jointState == JointState.Broken) continue; if (joint.isBroken) continue;
if (joint.connectedEntityA == id) list.Add(new SimBody(joint.connectedEntityB)); if (joint.connectedEntityA == id) list.Add(new SimBody(joint.connectedEntityB));
else if (joint.connectedEntityB == id) list.Add(new SimBody(joint.connectedEntityA)); else if (joint.connectedEntityB == id) list.Add(new SimBody(joint.connectedEntityA));
} }

View file

@ -20,6 +20,7 @@ using UnityEngine.AddressableAssets;
using BoxCollider = UnityEngine.BoxCollider; using BoxCollider = UnityEngine.BoxCollider;
using Material = UnityEngine.Material; using Material = UnityEngine.Material;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
using ScalingPermission = DataLoader.ScalingPermission;
namespace GamecraftModdingAPI.Blocks namespace GamecraftModdingAPI.Blocks
{ {
@ -266,8 +267,15 @@ namespace GamecraftModdingAPI.Blocks
SelectableFaces = new[] {0, 1, 2, 3, 4, 5}, SelectableFaces = new[] {0, 1, 2, 3, 4, 5},
GridScale = new[] {1, 1, 1}, GridScale = new[] {1, 1, 1},
Mass = 1, Mass = 1,
JointBreakAngle = 1, Material = abd.Material,
Material = abd.Material scalingPermission = ScalingPermission.NonUniform,
SortIndex = 12,
DefaultColour = (byte) BlockColors.Lime,
Volume = 1f,
timeRunningCollision = TimeRunningCollision.Enabled,
IsIsolator = false,
EdgeConnectingFaces = new[] {0, 1, 2, 3, 4, 5},
PointDataVolumeMultiplier = 1f
}; };
Console.WriteLine("Aluminium block data:\n" + abd); Console.WriteLine("Aluminium block data:\n" + abd);
Console.WriteLine("Material: " + abd.Material); Console.WriteLine("Material: " + abd.Material);

View file

@ -19,10 +19,10 @@ namespace GamecraftModdingAPI.Blocks
/// </summary> /// </summary>
public float MaxForce public float MaxForce
{ {
get => BlockEngine.GetBlockInfo(this, (DampedSpringReadOnlyStruct dsrs) => dsrs.maxForce); get => BlockEngine.GetBlockInfo(this, (DampedSpringReadOnlyStruct dsrs) => dsrs.springFrequency);
set => BlockEngine.SetBlockInfo(this, set => BlockEngine.SetBlockInfo(this,
(ref DampedSpringReadOnlyStruct dsrs, float val) => dsrs.maxForce = val, value); (ref DampedSpringReadOnlyStruct dsrs, float val) => dsrs.springFrequency = val, value);
} }
/// <summary> /// <summary>
@ -39,10 +39,10 @@ namespace GamecraftModdingAPI.Blocks
/// </summary> /// </summary>
public float Damping public float Damping
{ {
get => BlockEngine.GetBlockInfo(this, (LinearJointForcesReadOnlyStruct ljf) => ljf.dampingForceMagnitude); get => BlockEngine.GetBlockInfo(this, (DampedSpringReadOnlyStruct ljf) => ljf.springDamping);
set => BlockEngine.SetBlockInfo(this, set => BlockEngine.SetBlockInfo(this,
(ref LinearJointForcesReadOnlyStruct ljf, float val) => ljf.dampingForceMagnitude = val, value); (ref DampedSpringReadOnlyStruct ljf, float val) => ljf.springDamping = val, value);
} }
} }
} }

View file

@ -40,11 +40,11 @@ namespace GamecraftModdingAPI.Blocks
/// </summary> /// </summary>
public float MaximumForce public float MaximumForce
{ {
get => BlockEngine.GetBlockInfo(this, (PistonReadOnlyStruct st) => st.maxForce); get => BlockEngine.GetBlockInfo(this, (PistonReadOnlyStruct st) => st.pistonVelocity);
set set
{ {
BlockEngine.SetBlockInfo(this, (ref PistonReadOnlyStruct st, float val) => st.maxForce = val, value); BlockEngine.SetBlockInfo(this, (ref PistonReadOnlyStruct st, float val) => st.pistonVelocity = val, value);
} }
} }
} }

View file

@ -52,11 +52,11 @@ namespace GamecraftModdingAPI.Blocks
/// </summary> /// </summary>
public float MaximumForce public float MaximumForce
{ {
get => BlockEngine.GetBlockInfo(this, (ServoReadOnlyStruct st) => st.maxForce); get => BlockEngine.GetBlockInfo(this, (ServoReadOnlyStruct st) => st.servoVelocity);
set set
{ {
BlockEngine.SetBlockInfo(this, (ref ServoReadOnlyStruct st, float val) => st.maxForce = val, value); BlockEngine.SetBlockInfo(this, (ref ServoReadOnlyStruct st, float val) => st.servoVelocity = val, value);
} }
} }

View file

@ -35,10 +35,8 @@ namespace GamecraftModdingAPI.Blocks
BlockEngine.SetBlockInfo(this, (ref TextBlockDataStruct tbds, string val) => BlockEngine.SetBlockInfo(this, (ref TextBlockDataStruct tbds, string val) =>
{ {
tbds.textCurrent.Set(val); tbds.textCurrent.Set(val);
tbds.textStored.Set(val); tbds.textStored.Set(val, true);
}, value); }, value);
BlockEngine.SetBlockInfo(this,
(ref TextBlockNetworkDataStruct st, string val) => st.newTextBlockStringContent.Set(val), value);
} }
} }
@ -54,8 +52,6 @@ namespace GamecraftModdingAPI.Blocks
if (value == null) value = ""; if (value == null) value = "";
BlockEngine.SetBlockInfo(this, (ref TextBlockDataStruct tbds, string val) => BlockEngine.SetBlockInfo(this, (ref TextBlockDataStruct tbds, string val) =>
tbds.textBlockID.Set(val), value); tbds.textBlockID.Set(val), value);
BlockEngine.SetBlockInfo(this,
(ref TextBlockNetworkDataStruct st, string val) => st.newTextBlockID.Set(val), value);
} }
} }
} }

View file

@ -78,9 +78,9 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll</HintPath>
</Reference> </Reference>
<Reference Include="FMOD"> <Reference Include="FMODUnity">
<HintPath>..\ref\Gamecraft_Data\Managed\FMOD.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\FMODUnity.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\FMOD.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\FMODUnity.dll</HintPath>
</Reference> </Reference>
<Reference Include="FullGame"> <Reference Include="FullGame">
<HintPath>..\ref\Gamecraft_Data\Managed\FullGame.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\FullGame.dll</HintPath>
@ -266,6 +266,10 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Music.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Music.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Music.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Music.dll</HintPath>
</Reference> </Reference>
<Reference Include="Gamecraft.NetStrings">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.NetStrings.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.NetStrings.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.PerformanceWarnings"> <Reference Include="Gamecraft.PerformanceWarnings">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.PerformanceWarnings.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.PerformanceWarnings.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.PerformanceWarnings.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.PerformanceWarnings.dll</HintPath>
@ -286,6 +290,10 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Projectiles.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Projectiles.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Projectiles.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Projectiles.dll</HintPath>
</Reference> </Reference>
<Reference Include="Gamecraft.Serialization">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Serialization.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Serialization.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Tweaks"> <Reference Include="Gamecraft.Tweaks">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath>
@ -510,6 +518,10 @@
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.NetworkEntityStream.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.NetworkEntityStream.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.NetworkEntityStream.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.NetworkEntityStream.dll</HintPath>
</Reference> </Reference>
<Reference Include="RobocraftX.Multiplayer.Serializers">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.Serializers.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.Serializers.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.MultiplayerInput"> <Reference Include="RobocraftX.MultiplayerInput">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.MultiplayerInput.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.MultiplayerInput.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.MultiplayerInput.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.MultiplayerInput.dll</HintPath>
@ -554,10 +566,6 @@
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.SaveGameDialog.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.SaveGameDialog.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.SaveGameDialog.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.SaveGameDialog.dll</HintPath>
</Reference> </Reference>
<Reference Include="RobocraftX.Serializers">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Serializers.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.Serializers.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.Services"> <Reference Include="RobocraftX.Services">
<HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Services.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocraftX.Services.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.Services.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\RobocraftX.Services.dll</HintPath>

View file

@ -43,40 +43,24 @@ namespace GamecraftModdingAPI.Utility
{ {
get get
{ {
sound.getParameterValue(key, out float val, out float finalVal); sound.getParameterByName(key, out float val, out float finalVal);
return val; return val;
} }
set => sound.setParameterValue(key, value); set => sound.setParameterByName(key, value);
} }
public float this[int index] public float this[PARAMETER_ID index]
{ {
get get
{ {
sound.getParameterValueByIndex(index, out float val, out float finalVal); sound.getParameterByID(index, out float val, out float finalVal);
return val; return val;
} }
set => sound.setParameterValueByIndex(index, value); set => sound.setParameterByID(index, value);
} }
public string[] Parameters
{
get
{
sound.getParameterCount(out int count);
string[] parameters = new string[count];
for (int i = 0; i < count; i++)
{
sound.getParameterByIndex(i, out ParameterInstance param);
param.getDescription(out PARAMETER_DESCRIPTION desc);
parameters[i] = desc.name;
}
return parameters;
}
}
public float3 Position public float3 Position
{ {
get get