Fix all compiler issues and add Count property and smart ToArray() function to RefCollection

- Collections can be converted into arrays using a mapper and a predicate function
This commit is contained in:
Norbi Peti 2022-10-02 01:34:51 +02:00
parent 5117b69500
commit 5e90c5ee26
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
13 changed files with 162 additions and 225 deletions

View file

@ -115,10 +115,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Gamecraft.BlockGroups.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Gamecraft.BlockGroups.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Blocks.DestructionBlocks">
<HintPath>..\ref\Techblox_Data\Managed\Gamecraft.Blocks.DestructionBlocks.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Gamecraft.Blocks.DestructionBlocks.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Blocks.LogicBlock">
<HintPath>..\ref\Techblox_Data\Managed\Gamecraft.Blocks.LogicBlock.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Gamecraft.Blocks.LogicBlock.dll</HintPath>
@ -283,10 +279,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Havok.Physics.Hybrid.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Havok.Physics.Hybrid.dll</HintPath>
</Reference>
<Reference Include="JWT">
<HintPath>..\ref\Techblox_Data\Managed\JWT.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\JWT.dll</HintPath>
</Reference>
<Reference Include="LiteNetLib">
<HintPath>..\ref\Techblox_Data\Managed\LiteNetLib.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\LiteNetLib.dll</HintPath>
@ -415,10 +407,6 @@
<HintPath>..\ref\Techblox_Data\Managed\RobocraftX.GUI.Inventory.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.Inventory.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.GUI.PauseMenu">
<HintPath>..\ref\Techblox_Data\Managed\RobocraftX.GUI.PauseMenu.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.PauseMenu.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.GUI.QuitConfirmation">
<HintPath>..\ref\Techblox_Data\Managed\RobocraftX.GUI.QuitConfirmation.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.QuitConfirmation.dll</HintPath>
@ -547,6 +535,10 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.AdditionalParts.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.AdditionalParts.dll</HintPath>
</Reference>
<Reference Include="Techblox.AntiAFKServer">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.AntiAFKServer.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.AntiAFKServer.dll</HintPath>
</Reference>
<Reference Include="Techblox.Anticheat.Client">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Anticheat.Client.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Client.dll</HintPath>
@ -555,10 +547,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Anticheat.Common.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Common.dll</HintPath>
</Reference>
<Reference Include="Techblox.Anticheat.Server">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Anticheat.Server.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Server.dll</HintPath>
</Reference>
<Reference Include="Techblox.AtmosphereBlock">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.AtmosphereBlock.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.AtmosphereBlock.dll</HintPath>
@ -627,6 +615,18 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CentreHUDGUI.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CentreHUDGUI.dll</HintPath>
</Reference>
<Reference Include="Techblox.CharacterDamage.Client">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Client.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Client.dll</HintPath>
</Reference>
<Reference Include="Techblox.CharacterDamage.Server">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Server.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Server.dll</HintPath>
</Reference>
<Reference Include="Techblox.CharacterRespawnScreen">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CharacterRespawnScreen.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CharacterRespawnScreen.dll</HintPath>
</Reference>
<Reference Include="Techblox.CheckpointBlock">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CheckpointBlock.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CheckpointBlock.dll</HintPath>
@ -659,6 +659,14 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CounterBlockServer.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CounterBlockServer.dll</HintPath>
</Reference>
<Reference Include="Techblox.DamageRbScoreBlockServerServer">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.DamageRbScoreBlockServerServer.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.DamageRbScoreBlockServerServer.dll</HintPath>
</Reference>
<Reference Include="Techblox.DirectionalDamageVingette">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.DirectionalDamageVingette.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.DirectionalDamageVingette.dll</HintPath>
</Reference>
<Reference Include="Techblox.DistanceSensorBlock">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.DistanceSensorBlock.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.DistanceSensorBlock.dll</HintPath>
@ -735,14 +743,14 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.BuildRules.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.BuildRules.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.CharacterHealthFeedback">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.CharacterHealthFeedback.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.CharacterHealthFeedback.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Collection">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Collection.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Collection.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Commands">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Commands.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Commands.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Controls">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Controls.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Controls.dll</HintPath>
@ -755,6 +763,10 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.GamePortal.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.GamePortal.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.GeneralSettingsScreen">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.GeneralSettingsScreen.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.GeneralSettingsScreen.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Hotbar.Landscapes">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll</HintPath>
@ -783,6 +795,10 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Login.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Login.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.MachineReconstructTimer">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.MachineReconstructTimer.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.MachineReconstructTimer.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.MainGame">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.MainGame.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.MainGame.dll</HintPath>
@ -803,10 +819,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Progression.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Progression.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.ScreenCanvas">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.ScreenCanvas.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.ScreenCanvas.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.TabsBar.Landscapes">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll</HintPath>
@ -819,10 +831,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.UsernameDisplay.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.UsernameDisplay.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.WorldCanvas">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.WorldCanvas.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.WorldCanvas.dll</HintPath>
</Reference>
<Reference Include="Techblox.InputCapture">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.InputCapture.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.InputCapture.dll</HintPath>
@ -835,6 +843,10 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.JetBlockClient.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.JetBlockClient.dll</HintPath>
</Reference>
<Reference Include="Techblox.KillScoreBlock">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.KillScoreBlock.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.KillScoreBlock.dll</HintPath>
</Reference>
<Reference Include="Techblox.MachineProcessingService">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.MachineProcessingService.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.MachineProcessingService.dll</HintPath>
@ -935,10 +947,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Client.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Client.dll</HintPath>
</Reference>
<Reference Include="Techblox.Services.Anticheat.Server">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Server.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Server.dll</HintPath>
</Reference>
<Reference Include="Techblox.Services.Eos.Common">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Common.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Common.dll</HintPath>
@ -947,10 +955,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Eos.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.dll</HintPath>
</Reference>
<Reference Include="Techblox.Services.Eos.Server">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Server.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Server.dll</HintPath>
</Reference>
<Reference Include="Techblox.Services.GameDetails">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.GameDetails.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.GameDetails.dll</HintPath>
@ -987,6 +991,10 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Users.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Users.dll</HintPath>
</Reference>
<Reference Include="Techblox.ServoBlocksClient">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.ServoBlocksClient.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.ServoBlocksClient.dll</HintPath>
</Reference>
<Reference Include="Techblox.ServoBlocksServer">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.ServoBlocksServer.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.ServoBlocksServer.dll</HintPath>
@ -1147,22 +1155,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Unity.Addressables.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Addressables.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil">
<HintPath>..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil.Mdb">
<HintPath>..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Mdb.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil.Pdb">
<HintPath>..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Pdb.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil.Rocks">
<HintPath>..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Rocks.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst">
<HintPath>..\ref\Techblox_Data\Managed\Unity.Burst.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Burst.dll</HintPath>
@ -1479,10 +1471,6 @@
<HintPath>..\ref\Techblox_Data\Managed\UnityEngine.TextCoreFontEngineModule.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreFontEngineModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextCoreModule">
<HintPath>..\ref\Techblox_Data\Managed\UnityEngine.TextCoreModule.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextCoreTextEngineModule">
<HintPath>..\ref\Techblox_Data\Managed\UnityEngine.TextCoreTextEngineModule.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreTextEngineModule.dll</HintPath>
@ -1595,17 +1583,10 @@
<HintPath>..\ref\Techblox_Data\Managed\websocket-sharp.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\websocket-sharp.dll</HintPath>
</Reference>
<Reference Include="Whinarn.UnityMeshSimplifier.Runtime">
<HintPath>..\ref\Techblox_Data\Managed\Whinarn.UnityMeshSimplifier.Runtime.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Whinarn.UnityMeshSimplifier.Runtime.dll</HintPath>
</Reference>
<Reference Include="ZFBrowser">
<HintPath>..\ref\Techblox_Data\Managed\ZFBrowser.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\ZFBrowser.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties" />
</ItemGroup>
<!--End Dependencies-->
</Project>

View file

@ -114,11 +114,6 @@ namespace TechbloxModdingAPI.App
popup.SecondButton();
}
internal void CloseBetaPopup()
{
Game.menuEngine.CloseBetaPopup();
}
internal static void Init()
{
// this would have been so much simpler if this didn't involve a bunch of internal fields & classes

View file

@ -140,18 +140,19 @@ namespace TechbloxModdingAPI.App
{
var allBlocks = entitiesDB.QueryEntities<BlockTagEntityStruct>();
List<EGID> blockEGIDs = new List<EGID>();
foreach (var ((buffer, count), _) in allBlocks)
foreach (var ((_, ids, count), group) in allBlocks)
{
for (int i = 0; i < count; i++)
{
var id = new EGID(ids[i], group);
uint dbid;
if (filter == BlockIDs.Invalid)
dbid = (uint)filter;
else
dbid = entitiesDB.QueryEntity<DBEntityStruct>(buffer[i].ID).DBID;
var ownership = entitiesDB.QueryEntity<BlockOwnershipComponent>(buffer[i].ID).BlockOwnership;
dbid = entitiesDB.QueryEntity<DBEntityStruct>(id).DBID;
var ownership = entitiesDB.QueryEntity<BlockOwnershipComponent>(id).BlockOwnership;
if ((ownership & BlockOwnership.User) != 0 && dbid == (ulong)filter)
blockEGIDs.Add(buffer[i].ID);
blockEGIDs.Add(id);
}
}

View file

@ -154,16 +154,6 @@ namespace TechbloxModdingAPI.App
{
return ref entitiesDB.QueryEntity<T>(id);
}
internal void CloseBetaPopup()
{
var (buffer, count) = entitiesDB.QueryEntities<TogglePanelButtonEntityViewStruct>(ExclusiveGroup.Search("BetaPopup"));
for (int index = 0; index < count; ++index)
{
entitiesDB.QueryEntity<GUIEntityViewStruct>(buffer[index].TogglePanelButtonComponent.targetPanel)
.guiRoot.enabled = false;
}
}
}
internal class MyGameDataEntityDescriptor_DamnItFJWhyDidYouMakeThisInternal : GenericEntityDescriptor<MyGameDataEntityStruct> { }

View file

@ -70,7 +70,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
public float4 ConvertBlockColor(byte index) => index == byte.MaxValue
? new float4(-1f, -1f, -1f, -1f)
: entitiesDB.QueryEntity<PaletteEntryEntityStruct>(index,
CommonExclusiveGroups.COLOUR_PALETTE_GROUP).Colour;
ColourPaletteExclusiveGroups.COLOUR_PALETTE_GROUP).Colour;
public OptionalRef<T> GetBlockInfoOptional<T>(Block block) where T : unmanaged, IEntityComponent
{
@ -171,14 +171,13 @@ namespace TechbloxModdingAPI.Blocks.Engines
public SimBody[] GetSimBodiesFromID(byte id)
{
var ret = new FasterList<SimBody>(4);
var (oids, tags, count) = entitiesDB.QueryEntities<ObjectIdEntityStruct, BlockTagEntityStruct>(ObjectIDBlockExclusiveGroups.OBJECT_ID_BLOCK_GROUP);
var oids = entitiesDB.QueryEntitiesOptional<ObjectIdEntityStruct>(ObjectIDBlockExclusiveGroups.OBJECT_ID_BLOCK_GROUP);
EGIDMapper<GridConnectionsEntityStruct>? connections = null;
for (int i = 0; i < count; i++)
foreach (var oid in oids)
{
if (oids[i].objectId != id) continue;
var tag = tags[i];
if (oid.Get().objectId != id) continue;
if (!connections.HasValue) //Would need reflection to get the group from the build group otherwise
connections = entitiesDB.QueryMappedEntities<GridConnectionsEntityStruct>(tag.ID.groupID);
connections = entitiesDB.QueryMappedEntities<GridConnectionsEntityStruct>(oid.EGID.groupID);
//var rid = connections.Value.Entity(tag.ID.entityID).machineRigidBodyId;
/*foreach (var rb in ret) - TODO
{
@ -278,11 +277,11 @@ namespace TechbloxModdingAPI.Blocks.Engines
return Array.Empty<ObjectID>();
var ret = new FasterList<ObjectID>(4);
var (oids, tags, count) = entitiesDB.QueryEntities<ObjectIDTweakableComponent, BlockTagEntityStruct>(ObjectIDBlockExclusiveGroups.OBJECT_ID_BLOCK_GROUP);
for (var index = 0; index < count; index++)
var oids = entitiesDB.QueryEntitiesOptional<ObjectIDTweakableComponent>(ObjectIDBlockExclusiveGroups.OBJECT_ID_BLOCK_GROUP);
foreach (var oid in oids)
{
if (oids[index].objectIDToTrigger == id)
ret.Add(new ObjectID(tags[index].ID));
if (oid.Get().objectIDToTrigger == id)
ret.Add(new ObjectID(oid.EGID));
}
return ret.ToArray();

View file

@ -41,7 +41,7 @@ namespace TechbloxModdingAPI.Blocks.Engines
// implementations for block wiring
public WireEntityStruct CreateNewWire(EGID startBlock, byte startPort, EGID endBlock, byte endPort)
public (WireEntityStruct Wire, EGID ID) CreateNewWire(EGID startBlock, byte startPort, EGID endBlock, byte endPort)
{
EGID wireEGID = new EGID(BuildModeWiresGroups.NewWireEntityId, BuildModeWiresGroups.WiresGroup.Group);
EntityInitializer wireInitializer = Factory.BuildEntity<WireEntityDescriptor>(wireEGID);
@ -50,10 +50,9 @@ namespace TechbloxModdingAPI.Blocks.Engines
sourceBlockEGID = startBlock,
sourcePortUsage = startPort,
destinationBlockEGID = endBlock,
destinationPortUsage = endPort,
ID = wireEGID
destinationPortUsage = endPort
});
return wireInitializer.Get<WireEntityStruct>();
return (wireInitializer.Get<WireEntityStruct>(), wireEGID);
}
public ref WireEntityStruct GetWire(EGID wire)
@ -323,42 +322,18 @@ namespace TechbloxModdingAPI.Blocks.Engines
public EGID[] WiredToInput(EGID block, byte port)
{
WireEntityStruct[] wireEntityStructs = Search(NamedExclusiveGroup<BuildModeWiresGroups.WiresGroup>.Group,
(WireEntityStruct wes) => wes.destinationPortUsage == port && wes.destinationBlockEGID == block);
EGID[] result = new EGID[wireEntityStructs.Length];
for (uint i = 0; i < wireEntityStructs.Length; i++)
{
result[i] = wireEntityStructs[i].ID;
}
return result;
return entitiesDB
.QueryEntitiesOptional<WireEntityStruct>(NamedExclusiveGroup<BuildModeWiresGroups.WiresGroup>.Group)
.ToArray(wire => wire.ID,
wire => wire.Component.destinationPortUsage == port && wire.Component.destinationBlockEGID == block);
}
public EGID[] WiredToOutput(EGID block, byte port)
{
WireEntityStruct[] wireEntityStructs = Search(NamedExclusiveGroup<BuildModeWiresGroups.WiresGroup>.Group,
(WireEntityStruct wes) => wes.sourcePortUsage == port && wes.sourceBlockEGID == block);
EGID[] result = new EGID[wireEntityStructs.Length];
for (uint i = 0; i < wireEntityStructs.Length; i++)
{
result[i] = wireEntityStructs[i].ID;
}
return result;
}
private T[] Search<T>(ExclusiveGroup group, Func<T, bool> isMatch) where T : unmanaged, IEntityComponent
{
FasterList<T> results = new FasterList<T>();
var (components, count) = entitiesDB.QueryEntities<T>(group);
for (uint i = 0; i < count; i++)
{
if (isMatch(components[i]))
{
results.Add(components[i]);
}
}
return results.ToArray();
return entitiesDB
.QueryEntitiesOptional<WireEntityStruct>(NamedExclusiveGroup<BuildModeWiresGroups.WiresGroup>.Group)
.ToArray(wire => wire.ID,
wire => wire.Component.sourcePortUsage == port && wire.Component.sourceBlockEGID == block);
}
private EntityCollection<ChannelDataStruct> GetSignalStruct(uint signalID, out uint index, bool input = true)

View file

@ -31,8 +31,8 @@ namespace TechbloxModdingAPI.Blocks
public static Wire Connect(SignalingBlock start, byte startPort, SignalingBlock end, byte endPort)
{
WireEntityStruct wire = signalEngine.CreateNewWire(start.Id, startPort, end.Id, endPort);
return new Wire(wire, start, end);
var (wire, id) = signalEngine.CreateNewWire(start.Id, startPort, end.Id, endPort);
return new Wire(wire, start, end, id);
}
/// <summary>
@ -133,9 +133,9 @@ namespace TechbloxModdingAPI.Blocks
this.endBlockEGID = endBlock;
this.inputToOutput = inputToOutput;
this.wireEGID = wire;
endPortEGID = signalEngine.MatchBlockIOToPort(startBlock, startPort, inputToOutput).Nullable()?.ID ?? default;
endPortEGID = signalEngine.MatchBlockIOToPort(startBlock, startPort, inputToOutput).EGID;
if (endPortEGID == default) throw new WireInvalidException("Wire end port not found");
startPortEGID = signalEngine.MatchBlockIOToPort(endBlock, endPort, !inputToOutput).Nullable()?.ID ?? default;
startPortEGID = signalEngine.MatchBlockIOToPort(endBlock, endPort, !inputToOutput).EGID;
if (startPortEGID == default) throw new WireInvalidException("Wire start port not found");
this.startPort = startPort;
this.endPort = endPort;
@ -152,8 +152,8 @@ namespace TechbloxModdingAPI.Blocks
wireEgid, false);
}
private Wire(WireEntityStruct wire, SignalingBlock src, SignalingBlock dest)
: this(src, dest, wire.sourcePortUsage, wire.destinationPortUsage, wire.ID, false)
private Wire(WireEntityStruct wire, SignalingBlock src, SignalingBlock dest, EGID wireEgid)
: this(src, dest, wire.sourcePortUsage, wire.destinationPortUsage, wireEgid, false)
{
}

View file

@ -1,6 +1,5 @@
using System;
using Gamecraft.Wires;
using RobocraftX.Blocks.Ghost;
using RobocraftX.Character;
using RobocraftX.Character.Movement;
using Unity.Mathematics;
@ -11,6 +10,7 @@ using RobocraftX.Physics;
using Svelto.ECS;
using Techblox.BuildingDrone;
using Techblox.Camera;
using Techblox.Character;
using TechbloxModdingAPI.Blocks;
using TechbloxModdingAPI.Players;
using TechbloxModdingAPI.Utility;
@ -214,15 +214,16 @@ namespace TechbloxModdingAPI
/// The player's initial health when entering Simulation (aka Time Running) mode.
/// </summary>
/// <value>The initial health.</value>
[Obsolete("We can no longer get initial health, returns max health.")]
public float InitialHealth
{
get
{
var opt = playerEngine.GetCharacterStruct<CharacterHealthEntityStruct>(Id);
return opt ? opt.Get().initialHealth : -1f;
var opt = playerEngine.GetCharacterStruct<CharacterHealthEntityComponent>(Id);
return opt ? opt.Get().maxHealth : -1f;
}
set => playerEngine.GetCharacterStruct<CharacterHealthEntityStruct>(Id).Get().initialHealth = value;
set => playerEngine.GetCharacterStruct<CharacterHealthEntityComponent>(Id).Get().maxHealth = value;
}
/// <summary>
@ -233,30 +234,25 @@ namespace TechbloxModdingAPI
{
get
{
var opt = playerEngine.GetCharacterStruct<CharacterHealthEntityStruct>(Id);
var opt = playerEngine.GetCharacterStruct<CharacterHealthEntityComponent>(Id);
return opt ? opt.Get().currentHealth : -1f;
}
set => playerEngine.GetCharacterStruct<CharacterHealthEntityStruct>(Id).Get().currentHealth = value;
set => playerEngine.GetCharacterStruct<CharacterHealthEntityComponent>(Id).Get().currentHealth = value;
}
/// <summary>
/// Whether this <see cref="T:TechbloxModdingAPI.Player"/> is damageable.
/// </summary>
/// <value><c>true</c> if damageable; otherwise, <c>false</c>.</value>
[Obsolete("Players are probably always damageable")]
public bool Damageable
{
get
{
var opt = playerEngine.GetCharacterStruct<CharacterHealthEntityStruct>(Id);
return opt.Get().canTakeDamageStat;
}
get => true;
// ReSharper disable once ValueParameterNotUsed
set
{
ref var healthStruct = ref playerEngine.GetCharacterStruct<CharacterHealthEntityStruct>(Id).Get();
healthStruct.canTakeDamage = value;
healthStruct.canTakeDamageStat = value;
}
}
@ -264,30 +260,26 @@ namespace TechbloxModdingAPI
/// The player's lives when initially entering Simulation (aka Time Running) mode.
/// </summary>
/// <value>The initial lives.</value>
[Obsolete("The player has infinite lives")]
public uint InitialLives
{
get
{
var opt = playerEngine.GetCharacterStruct<CharacterLivesEntityComponent>(Id);
return opt ? opt.Get().initialLives : uint.MaxValue;
}
get => uint.MaxValue;
set => playerEngine.GetCharacterStruct<CharacterLivesEntityComponent>(Id).Get().initialLives = value;
// ReSharper disable once ValueParameterNotUsed
set { }
}
/// <summary>
/// The player's current lives in Simulation (aka Time Running) mode.
/// </summary>
/// <value>The current lives.</value>
[Obsolete("The player has infinite lives")]
public uint CurrentLives
{
get
{
var opt = playerEngine.GetCharacterStruct<CharacterLivesEntityComponent>(Id);
return opt ? opt.Get().currentLives : uint.MaxValue;
}
get => uint.MaxValue;
set => playerEngine.GetCharacterStruct<CharacterLivesEntityComponent>(Id).Get().currentLives = value;
// ReSharper disable once ValueParameterNotUsed
set { }
}
/*/// <summary>

View file

@ -115,7 +115,7 @@ namespace TechbloxModdingAPI.Players
public bool IsDead(uint playerId)
{
if (entitiesDB == null) return true;
return entitiesDB.Exists<RigidBodyEntityStruct>(playerId, CharacterExclusiveGroups.DeadCharacters);
return entitiesDB.Exists<RigidBodyEntityStruct>(playerId, CharacterExclusiveGroups.DeadGroup);
}
// reusable methods
@ -164,8 +164,9 @@ namespace TechbloxModdingAPI.Players
var opt = GetCameraStruct<PhysicCameraRayCastEntityStruct>(playerId);
if (!opt) return default;
PhysicCameraRayCastEntityStruct rayCast = opt;
EGID physicCameraEgid = new EGID(playerId, CameraExclusiveGroups.PhysicCameraGroup);
float distance = maxDistance < 0
? GhostBlockUtils.GetBuildInteractionDistance(entitiesDB, rayCast,
? GhostBlockUtils.GetBuildInteractionDistance(entitiesDB, rayCast, physicCameraEgid,
GhostBlockUtils.GhostCastMethod.GhostCastProportionalToBlockSize)
: maxDistance;
if (rayCast.hit && rayCast.distance <= distance)

View file

@ -111,10 +111,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Gamecraft.BlockGroups.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Gamecraft.BlockGroups.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Blocks.DestructionBlocks">
<HintPath>..\ref\Techblox_Data\Managed\Gamecraft.Blocks.DestructionBlocks.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Gamecraft.Blocks.DestructionBlocks.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Blocks.LogicBlock">
<HintPath>..\ref\Techblox_Data\Managed\Gamecraft.Blocks.LogicBlock.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Gamecraft.Blocks.LogicBlock.dll</HintPath>
@ -279,10 +275,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Havok.Physics.Hybrid.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Havok.Physics.Hybrid.dll</HintPath>
</Reference>
<Reference Include="JWT">
<HintPath>..\ref\Techblox_Data\Managed\JWT.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\JWT.dll</HintPath>
</Reference>
<Reference Include="LiteNetLib">
<HintPath>..\ref\Techblox_Data\Managed\LiteNetLib.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\LiteNetLib.dll</HintPath>
@ -411,10 +403,6 @@
<HintPath>..\ref\Techblox_Data\Managed\RobocraftX.GUI.Inventory.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.Inventory.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.GUI.PauseMenu">
<HintPath>..\ref\Techblox_Data\Managed\RobocraftX.GUI.PauseMenu.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.PauseMenu.dll</HintPath>
</Reference>
<Reference Include="RobocraftX.GUI.QuitConfirmation">
<HintPath>..\ref\Techblox_Data\Managed\RobocraftX.GUI.QuitConfirmation.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.QuitConfirmation.dll</HintPath>
@ -543,6 +531,10 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.AdditionalParts.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.AdditionalParts.dll</HintPath>
</Reference>
<Reference Include="Techblox.AntiAFKServer">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.AntiAFKServer.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.AntiAFKServer.dll</HintPath>
</Reference>
<Reference Include="Techblox.Anticheat.Client">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Anticheat.Client.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Client.dll</HintPath>
@ -551,10 +543,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Anticheat.Common.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Common.dll</HintPath>
</Reference>
<Reference Include="Techblox.Anticheat.Server">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Anticheat.Server.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Server.dll</HintPath>
</Reference>
<Reference Include="Techblox.AtmosphereBlock">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.AtmosphereBlock.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.AtmosphereBlock.dll</HintPath>
@ -623,6 +611,18 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CentreHUDGUI.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CentreHUDGUI.dll</HintPath>
</Reference>
<Reference Include="Techblox.CharacterDamage.Client">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Client.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Client.dll</HintPath>
</Reference>
<Reference Include="Techblox.CharacterDamage.Server">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Server.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Server.dll</HintPath>
</Reference>
<Reference Include="Techblox.CharacterRespawnScreen">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CharacterRespawnScreen.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CharacterRespawnScreen.dll</HintPath>
</Reference>
<Reference Include="Techblox.CheckpointBlock">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CheckpointBlock.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CheckpointBlock.dll</HintPath>
@ -655,6 +655,14 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.CounterBlockServer.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.CounterBlockServer.dll</HintPath>
</Reference>
<Reference Include="Techblox.DamageRbScoreBlockServerServer">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.DamageRbScoreBlockServerServer.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.DamageRbScoreBlockServerServer.dll</HintPath>
</Reference>
<Reference Include="Techblox.DirectionalDamageVingette">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.DirectionalDamageVingette.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.DirectionalDamageVingette.dll</HintPath>
</Reference>
<Reference Include="Techblox.DistanceSensorBlock">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.DistanceSensorBlock.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.DistanceSensorBlock.dll</HintPath>
@ -731,14 +739,14 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.BuildRules.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.BuildRules.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.CharacterHealthFeedback">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.CharacterHealthFeedback.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.CharacterHealthFeedback.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Collection">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Collection.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Collection.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Commands">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Commands.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Commands.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Controls">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Controls.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Controls.dll</HintPath>
@ -751,6 +759,10 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.GamePortal.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.GamePortal.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.GeneralSettingsScreen">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.GeneralSettingsScreen.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.GeneralSettingsScreen.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.Hotbar.Landscapes">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll</HintPath>
@ -779,6 +791,10 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Login.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Login.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.MachineReconstructTimer">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.MachineReconstructTimer.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.MachineReconstructTimer.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.MainGame">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.MainGame.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.MainGame.dll</HintPath>
@ -799,10 +815,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.Progression.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.Progression.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.ScreenCanvas">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.ScreenCanvas.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.ScreenCanvas.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.TabsBar.Landscapes">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll</HintPath>
@ -815,10 +827,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.UsernameDisplay.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.UsernameDisplay.dll</HintPath>
</Reference>
<Reference Include="Techblox.GUI.WorldCanvas">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.GUI.WorldCanvas.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.GUI.WorldCanvas.dll</HintPath>
</Reference>
<Reference Include="Techblox.InputCapture">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.InputCapture.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.InputCapture.dll</HintPath>
@ -831,6 +839,10 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.JetBlockClient.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.JetBlockClient.dll</HintPath>
</Reference>
<Reference Include="Techblox.KillScoreBlock">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.KillScoreBlock.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.KillScoreBlock.dll</HintPath>
</Reference>
<Reference Include="Techblox.MachineProcessingService">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.MachineProcessingService.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.MachineProcessingService.dll</HintPath>
@ -931,10 +943,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Client.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Client.dll</HintPath>
</Reference>
<Reference Include="Techblox.Services.Anticheat.Server">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Server.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Server.dll</HintPath>
</Reference>
<Reference Include="Techblox.Services.Eos.Common">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Common.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Common.dll</HintPath>
@ -943,10 +951,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Eos.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.dll</HintPath>
</Reference>
<Reference Include="Techblox.Services.Eos.Server">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Server.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Server.dll</HintPath>
</Reference>
<Reference Include="Techblox.Services.GameDetails">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.GameDetails.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.GameDetails.dll</HintPath>
@ -983,6 +987,10 @@
<HintPath>..\ref\Techblox_Data\Managed\Techblox.Services.Users.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.Services.Users.dll</HintPath>
</Reference>
<Reference Include="Techblox.ServoBlocksClient">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.ServoBlocksClient.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.ServoBlocksClient.dll</HintPath>
</Reference>
<Reference Include="Techblox.ServoBlocksServer">
<HintPath>..\ref\Techblox_Data\Managed\Techblox.ServoBlocksServer.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Techblox.ServoBlocksServer.dll</HintPath>
@ -1143,22 +1151,6 @@
<HintPath>..\ref\Techblox_Data\Managed\Unity.Addressables.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Addressables.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil">
<HintPath>..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil.Mdb">
<HintPath>..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Mdb.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil.Pdb">
<HintPath>..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Pdb.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil.Rocks">
<HintPath>..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Rocks.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst">
<HintPath>..\ref\Techblox_Data\Managed\Unity.Burst.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Unity.Burst.dll</HintPath>
@ -1475,10 +1467,6 @@
<HintPath>..\ref\Techblox_Data\Managed\UnityEngine.TextCoreFontEngineModule.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreFontEngineModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextCoreModule">
<HintPath>..\ref\Techblox_Data\Managed\UnityEngine.TextCoreModule.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextCoreTextEngineModule">
<HintPath>..\ref\Techblox_Data\Managed\UnityEngine.TextCoreTextEngineModule.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreTextEngineModule.dll</HintPath>
@ -1591,10 +1579,6 @@
<HintPath>..\ref\Techblox_Data\Managed\websocket-sharp.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\websocket-sharp.dll</HintPath>
</Reference>
<Reference Include="Whinarn.UnityMeshSimplifier.Runtime">
<HintPath>..\ref\Techblox_Data\Managed\Whinarn.UnityMeshSimplifier.Runtime.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\Whinarn.UnityMeshSimplifier.Runtime.dll</HintPath>
</Reference>
<Reference Include="ZFBrowser">
<HintPath>..\ref\Techblox_Data\Managed\ZFBrowser.dll</HintPath>
<HintPath>..\..\ref\Techblox_Data\Managed\ZFBrowser.dll</HintPath>

View file

@ -368,8 +368,6 @@ namespace TechbloxModdingAPI.Tests
}, () => shouldTestGhostBlock));
Logging.CommandLog("Test enabled");
}).Build();
Client.EnterMenu += (sender, args) => Scheduler.Schedule(new Once(() => Client.Instance.CloseBetaPopup()));
Game.Enter += (sender, args) =>
Console.WriteLine(

View file

@ -78,7 +78,7 @@ namespace TechbloxModdingAPI.Utility
}
/// <summary>
/// The ID of the entity this component belongs to.
/// The ID of the entity this component belongs to or default if it doesn't exist.
/// </summary>
public EGID EGID => entityId;

View file

@ -37,6 +37,27 @@ namespace TechbloxModdingAPI.Utility
}
public Enumerator GetEnumerator() => new(this);
/// <summary>
/// The amount of items in the collection.
/// </summary>
public int Count => count;
public T[] ToArray() => ToArray(a => a.Component);
public TA[] ToArray<TA>(Func<(T Component, EGID ID), TA> transformFunction, Predicate<(T Component, EGID ID)> predicateFunction = null)
{
var result = new TA[Count];
int i = 0;
foreach (var opt in this)
{
if (predicateFunction != null && !predicateFunction((opt.Get(), opt.EGID))) continue;
result[i] = transformFunction((opt.Get(), opt.EGID));
i++;
}
return result;
}
public ref struct Enumerator
{