Fix tests and add new materials
This commit is contained in:
parent
0b2ffef0d3
commit
52ccbe4dad
5 changed files with 19 additions and 7 deletions
|
@ -7,6 +7,14 @@ namespace TechbloxModdingAPI.Blocks
|
||||||
RigidSteel,
|
RigidSteel,
|
||||||
CarbonFiber,
|
CarbonFiber,
|
||||||
Plastic,
|
Plastic,
|
||||||
Wood = 6
|
Wood = 6,
|
||||||
|
RigidSteelPainted,
|
||||||
|
RigidSteelRustedPaint,
|
||||||
|
RigidSteelHeavyRust,
|
||||||
|
SteelBodyworkMetallicPaint,
|
||||||
|
SteelBodyworkRustedPaint,
|
||||||
|
SteelBodyworkHeavyRust,
|
||||||
|
WoodVarnishedDark,
|
||||||
|
Chrome
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -72,6 +72,7 @@ namespace TechbloxModdingAPI.Blocks
|
||||||
public static IEnumerator<TaskContract> TestBlockProperties()
|
public static IEnumerator<TaskContract> TestBlockProperties()
|
||||||
{ //Uses the result of the previous test case
|
{ //Uses the result of the previous test case
|
||||||
var blocks = Game.CurrentGame().GetBlocksInGame();
|
var blocks = Game.CurrentGame().GetBlocksInGame();
|
||||||
|
yield return Yield.It;
|
||||||
for (var index = 0; index < blocks.Length; index++)
|
for (var index = 0; index < blocks.Length; index++)
|
||||||
{
|
{
|
||||||
if (index % 50 == 0) yield return Yield.It; //The material or flipped status can only be changed 130 times per submission
|
if (index % 50 == 0) yield return Yield.It; //The material or flipped status can only be changed 130 times per submission
|
||||||
|
@ -140,8 +141,8 @@ namespace TechbloxModdingAPI.Blocks
|
||||||
Block newBlock = Block.PlaceNew(BlockIDs.DampedSpring, Unity.Mathematics.float3.zero + 1);
|
Block newBlock = Block.PlaceNew(BlockIDs.DampedSpring, Unity.Mathematics.float3.zero + 1);
|
||||||
DampedSpring b = null; // Note: the assignment operation is a lambda, which slightly confuses the compiler
|
DampedSpring b = null; // Note: the assignment operation is a lambda, which slightly confuses the compiler
|
||||||
Assert.Errorless(() => { b = (DampedSpring) newBlock; }, "Casting block to DampedSpring raised an exception: ", "Casting block to DampedSpring completed without issue.");
|
Assert.Errorless(() => { b = (DampedSpring) newBlock; }, "Casting block to DampedSpring raised an exception: ", "Casting block to DampedSpring completed without issue.");
|
||||||
if (!Assert.CloseTo(b.Stiffness, 30f, $"DampedSpring.Stiffness {b.Stiffness} does not equal default value, possibly because it failed silently.", "DampedSpring.Stiffness is close enough to default.")) return;
|
if (!Assert.CloseTo(b.Stiffness, 1f, $"DampedSpring.Stiffness {b.Stiffness} does not equal default value, possibly because it failed silently.", "DampedSpring.Stiffness is close enough to default.")) return;
|
||||||
if (!Assert.CloseTo(b.Damping, 30f, $"DampedSpring.Damping {b.Damping} does not equal default value, possibly because it failed silently.", "DampedSpring.Damping is close enough to default.")) return;
|
if (!Assert.CloseTo(b.Damping, 0.1f, $"DampedSpring.Damping {b.Damping} does not equal default value, possibly because it failed silently.", "DampedSpring.Damping is close enough to default.")) return;
|
||||||
if (!Assert.CloseTo(b.MaxExtension, 0.3f, $"DampedSpring.MaxExtension {b.MaxExtension} does not equal default value, possibly because it failed silently.", "DampedSpring.MaxExtension is close enough to default.")) return;
|
if (!Assert.CloseTo(b.MaxExtension, 0.3f, $"DampedSpring.MaxExtension {b.MaxExtension} does not equal default value, possibly because it failed silently.", "DampedSpring.MaxExtension is close enough to default.")) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,9 +117,6 @@ namespace TechbloxModdingAPI.Blocks.Engines
|
||||||
if (block.Exists)
|
if (block.Exists)
|
||||||
entitiesDB.PublishEntityChange<GFXPrefabEntityStructGPUI>(block.Id);
|
entitiesDB.PublishEntityChange<GFXPrefabEntityStructGPUI>(block.Id);
|
||||||
//Phyiscs prefab: prefabAssetID, set on block creation from the CubeListData
|
//Phyiscs prefab: prefabAssetID, set on block creation from the CubeListData
|
||||||
/*Console.WriteLine("Materials:\n" + FullGameFields._dataDb.GetValues<MaterialPropertiesData>()
|
|
||||||
.Select(kv => $"{kv.Key}: {((MaterialPropertiesData) kv.Value).Name}")
|
|
||||||
.Aggregate((a, b) => a + "\n" + b));*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool BlockExists(EGID blockID)
|
public bool BlockExists(EGID blockID)
|
||||||
|
|
|
@ -12,7 +12,7 @@ using TechbloxModdingAPI.Utility;
|
||||||
|
|
||||||
namespace TechbloxModdingAPI.Persistence
|
namespace TechbloxModdingAPI.Persistence
|
||||||
{
|
{
|
||||||
[HarmonyPatch]
|
//[HarmonyPatch] - TODO
|
||||||
class DeserializeFromDiskEntitiesEnginePatch
|
class DeserializeFromDiskEntitiesEnginePatch
|
||||||
{
|
{
|
||||||
internal static EntitiesDB entitiesDB = null;
|
internal static EntitiesDB entitiesDB = null;
|
||||||
|
|
|
@ -276,6 +276,12 @@ namespace TechbloxModdingAPI.Tests
|
||||||
lastKey = currentKey;
|
lastKey = currentKey;
|
||||||
}
|
}
|
||||||
};*/
|
};*/
|
||||||
|
/*Game.Enter += (sender, e) =>
|
||||||
|
{
|
||||||
|
Console.WriteLine("Materials:\n" + FullGameFields._dataDb.GetValues<MaterialPropertiesData>()
|
||||||
|
.Select(kv => $"{kv.Key}: {((MaterialPropertiesData) kv.Value).Name}")
|
||||||
|
.Aggregate((a, b) => a + "\n" + b));
|
||||||
|
};*/
|
||||||
#if TEST
|
#if TEST
|
||||||
TestRoot.RunTests();
|
TestRoot.RunTests();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue