diff --git a/CodeGenerator/CodeGenerator.csproj b/CodeGenerator/CodeGenerator.csproj index 32255ac..c80dce9 100644 --- a/CodeGenerator/CodeGenerator.csproj +++ b/CodeGenerator/CodeGenerator.csproj @@ -115,10 +115,6 @@ ..\ref\Techblox_Data\Managed\Gamecraft.BlockGroups.dll ..\..\ref\Techblox_Data\Managed\Gamecraft.BlockGroups.dll - - ..\ref\Techblox_Data\Managed\Gamecraft.Blocks.DestructionBlocks.dll - ..\..\ref\Techblox_Data\Managed\Gamecraft.Blocks.DestructionBlocks.dll - ..\ref\Techblox_Data\Managed\Gamecraft.Blocks.LogicBlock.dll ..\..\ref\Techblox_Data\Managed\Gamecraft.Blocks.LogicBlock.dll @@ -283,10 +279,6 @@ ..\ref\Techblox_Data\Managed\Havok.Physics.Hybrid.dll ..\..\ref\Techblox_Data\Managed\Havok.Physics.Hybrid.dll - - ..\ref\Techblox_Data\Managed\JWT.dll - ..\..\ref\Techblox_Data\Managed\JWT.dll - ..\ref\Techblox_Data\Managed\LiteNetLib.dll ..\..\ref\Techblox_Data\Managed\LiteNetLib.dll @@ -415,10 +407,6 @@ ..\ref\Techblox_Data\Managed\RobocraftX.GUI.Inventory.dll ..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.Inventory.dll - - ..\ref\Techblox_Data\Managed\RobocraftX.GUI.PauseMenu.dll - ..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.PauseMenu.dll - ..\ref\Techblox_Data\Managed\RobocraftX.GUI.QuitConfirmation.dll ..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.QuitConfirmation.dll @@ -547,6 +535,10 @@ ..\ref\Techblox_Data\Managed\Techblox.AdditionalParts.dll ..\..\ref\Techblox_Data\Managed\Techblox.AdditionalParts.dll + + ..\ref\Techblox_Data\Managed\Techblox.AntiAFKServer.dll + ..\..\ref\Techblox_Data\Managed\Techblox.AntiAFKServer.dll + ..\ref\Techblox_Data\Managed\Techblox.Anticheat.Client.dll ..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Client.dll @@ -555,10 +547,6 @@ ..\ref\Techblox_Data\Managed\Techblox.Anticheat.Common.dll ..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Common.dll - - ..\ref\Techblox_Data\Managed\Techblox.Anticheat.Server.dll - ..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Server.dll - ..\ref\Techblox_Data\Managed\Techblox.AtmosphereBlock.dll ..\..\ref\Techblox_Data\Managed\Techblox.AtmosphereBlock.dll @@ -627,6 +615,18 @@ ..\ref\Techblox_Data\Managed\Techblox.CentreHUDGUI.dll ..\..\ref\Techblox_Data\Managed\Techblox.CentreHUDGUI.dll + + ..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Client.dll + ..\..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Client.dll + + + ..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Server.dll + ..\..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Server.dll + + + ..\ref\Techblox_Data\Managed\Techblox.CharacterRespawnScreen.dll + ..\..\ref\Techblox_Data\Managed\Techblox.CharacterRespawnScreen.dll + ..\ref\Techblox_Data\Managed\Techblox.CheckpointBlock.dll ..\..\ref\Techblox_Data\Managed\Techblox.CheckpointBlock.dll @@ -659,6 +659,14 @@ ..\ref\Techblox_Data\Managed\Techblox.CounterBlockServer.dll ..\..\ref\Techblox_Data\Managed\Techblox.CounterBlockServer.dll + + ..\ref\Techblox_Data\Managed\Techblox.DamageRbScoreBlockServerServer.dll + ..\..\ref\Techblox_Data\Managed\Techblox.DamageRbScoreBlockServerServer.dll + + + ..\ref\Techblox_Data\Managed\Techblox.DirectionalDamageVingette.dll + ..\..\ref\Techblox_Data\Managed\Techblox.DirectionalDamageVingette.dll + ..\ref\Techblox_Data\Managed\Techblox.DistanceSensorBlock.dll ..\..\ref\Techblox_Data\Managed\Techblox.DistanceSensorBlock.dll @@ -735,14 +743,14 @@ ..\ref\Techblox_Data\Managed\Techblox.GUI.BuildRules.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.BuildRules.dll + + ..\ref\Techblox_Data\Managed\Techblox.GUI.CharacterHealthFeedback.dll + ..\..\ref\Techblox_Data\Managed\Techblox.GUI.CharacterHealthFeedback.dll + ..\ref\Techblox_Data\Managed\Techblox.GUI.Collection.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Collection.dll - - ..\ref\Techblox_Data\Managed\Techblox.GUI.Commands.dll - ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Commands.dll - ..\ref\Techblox_Data\Managed\Techblox.GUI.Controls.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Controls.dll @@ -755,6 +763,10 @@ ..\ref\Techblox_Data\Managed\Techblox.GUI.GamePortal.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.GamePortal.dll + + ..\ref\Techblox_Data\Managed\Techblox.GUI.GeneralSettingsScreen.dll + ..\..\ref\Techblox_Data\Managed\Techblox.GUI.GeneralSettingsScreen.dll + ..\ref\Techblox_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll @@ -783,6 +795,10 @@ ..\ref\Techblox_Data\Managed\Techblox.GUI.Login.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Login.dll + + ..\ref\Techblox_Data\Managed\Techblox.GUI.MachineReconstructTimer.dll + ..\..\ref\Techblox_Data\Managed\Techblox.GUI.MachineReconstructTimer.dll + ..\ref\Techblox_Data\Managed\Techblox.GUI.MainGame.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.MainGame.dll @@ -803,10 +819,6 @@ ..\ref\Techblox_Data\Managed\Techblox.GUI.Progression.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Progression.dll - - ..\ref\Techblox_Data\Managed\Techblox.GUI.ScreenCanvas.dll - ..\..\ref\Techblox_Data\Managed\Techblox.GUI.ScreenCanvas.dll - ..\ref\Techblox_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll @@ -819,10 +831,6 @@ ..\ref\Techblox_Data\Managed\Techblox.GUI.UsernameDisplay.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.UsernameDisplay.dll - - ..\ref\Techblox_Data\Managed\Techblox.GUI.WorldCanvas.dll - ..\..\ref\Techblox_Data\Managed\Techblox.GUI.WorldCanvas.dll - ..\ref\Techblox_Data\Managed\Techblox.InputCapture.dll ..\..\ref\Techblox_Data\Managed\Techblox.InputCapture.dll @@ -835,6 +843,10 @@ ..\ref\Techblox_Data\Managed\Techblox.JetBlockClient.dll ..\..\ref\Techblox_Data\Managed\Techblox.JetBlockClient.dll + + ..\ref\Techblox_Data\Managed\Techblox.KillScoreBlock.dll + ..\..\ref\Techblox_Data\Managed\Techblox.KillScoreBlock.dll + ..\ref\Techblox_Data\Managed\Techblox.MachineProcessingService.dll ..\..\ref\Techblox_Data\Managed\Techblox.MachineProcessingService.dll @@ -935,10 +947,6 @@ ..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Client.dll ..\..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Client.dll - - ..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Server.dll - ..\..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Server.dll - ..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Common.dll ..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Common.dll @@ -947,10 +955,6 @@ ..\ref\Techblox_Data\Managed\Techblox.Services.Eos.dll ..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.dll - - ..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Server.dll - ..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Server.dll - ..\ref\Techblox_Data\Managed\Techblox.Services.GameDetails.dll ..\..\ref\Techblox_Data\Managed\Techblox.Services.GameDetails.dll @@ -987,6 +991,10 @@ ..\ref\Techblox_Data\Managed\Techblox.Services.Users.dll ..\..\ref\Techblox_Data\Managed\Techblox.Services.Users.dll + + ..\ref\Techblox_Data\Managed\Techblox.ServoBlocksClient.dll + ..\..\ref\Techblox_Data\Managed\Techblox.ServoBlocksClient.dll + ..\ref\Techblox_Data\Managed\Techblox.ServoBlocksServer.dll ..\..\ref\Techblox_Data\Managed\Techblox.ServoBlocksServer.dll @@ -1147,22 +1155,6 @@ ..\ref\Techblox_Data\Managed\Unity.Addressables.dll ..\..\ref\Techblox_Data\Managed\Unity.Addressables.dll - - ..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.dll - ..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.dll - - - ..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Mdb.dll - ..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Mdb.dll - - - ..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Pdb.dll - ..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Pdb.dll - - - ..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Rocks.dll - ..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Rocks.dll - ..\ref\Techblox_Data\Managed\Unity.Burst.dll ..\..\ref\Techblox_Data\Managed\Unity.Burst.dll @@ -1479,10 +1471,6 @@ ..\ref\Techblox_Data\Managed\UnityEngine.TextCoreFontEngineModule.dll ..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreFontEngineModule.dll - - ..\ref\Techblox_Data\Managed\UnityEngine.TextCoreModule.dll - ..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreModule.dll - ..\ref\Techblox_Data\Managed\UnityEngine.TextCoreTextEngineModule.dll ..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreTextEngineModule.dll @@ -1595,17 +1583,10 @@ ..\ref\Techblox_Data\Managed\websocket-sharp.dll ..\..\ref\Techblox_Data\Managed\websocket-sharp.dll - - ..\ref\Techblox_Data\Managed\Whinarn.UnityMeshSimplifier.Runtime.dll - ..\..\ref\Techblox_Data\Managed\Whinarn.UnityMeshSimplifier.Runtime.dll - ..\ref\Techblox_Data\Managed\ZFBrowser.dll ..\..\ref\Techblox_Data\Managed\ZFBrowser.dll - - - \ No newline at end of file diff --git a/TechbloxModdingAPI/App/Client.cs b/TechbloxModdingAPI/App/Client.cs index 89f486f..317adec 100644 --- a/TechbloxModdingAPI/App/Client.cs +++ b/TechbloxModdingAPI/App/Client.cs @@ -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 diff --git a/TechbloxModdingAPI/App/GameGameEngine.cs b/TechbloxModdingAPI/App/GameGameEngine.cs index a07bed8..8eab6fd 100644 --- a/TechbloxModdingAPI/App/GameGameEngine.cs +++ b/TechbloxModdingAPI/App/GameGameEngine.cs @@ -140,18 +140,19 @@ namespace TechbloxModdingAPI.App { var allBlocks = entitiesDB.QueryEntities(); List blockEGIDs = new List(); - 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(buffer[i].ID).DBID; - var ownership = entitiesDB.QueryEntity(buffer[i].ID).BlockOwnership; + dbid = entitiesDB.QueryEntity(id).DBID; + var ownership = entitiesDB.QueryEntity(id).BlockOwnership; if ((ownership & BlockOwnership.User) != 0 && dbid == (ulong)filter) - blockEGIDs.Add(buffer[i].ID); + blockEGIDs.Add(id); } } diff --git a/TechbloxModdingAPI/App/GameMenuEngine.cs b/TechbloxModdingAPI/App/GameMenuEngine.cs index 0f68299..8da4742 100644 --- a/TechbloxModdingAPI/App/GameMenuEngine.cs +++ b/TechbloxModdingAPI/App/GameMenuEngine.cs @@ -154,16 +154,6 @@ namespace TechbloxModdingAPI.App { return ref entitiesDB.QueryEntity(id); } - - internal void CloseBetaPopup() - { - var (buffer, count) = entitiesDB.QueryEntities(ExclusiveGroup.Search("BetaPopup")); - for (int index = 0; index < count; ++index) - { - entitiesDB.QueryEntity(buffer[index].TogglePanelButtonComponent.targetPanel) - .guiRoot.enabled = false; - } - } } internal class MyGameDataEntityDescriptor_DamnItFJWhyDidYouMakeThisInternal : GenericEntityDescriptor { } diff --git a/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs b/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs index dc035ee..e3d7695 100644 --- a/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs +++ b/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs @@ -70,7 +70,7 @@ namespace TechbloxModdingAPI.Blocks.Engines public float4 ConvertBlockColor(byte index) => index == byte.MaxValue ? new float4(-1f, -1f, -1f, -1f) : entitiesDB.QueryEntity(index, - CommonExclusiveGroups.COLOUR_PALETTE_GROUP).Colour; + ColourPaletteExclusiveGroups.COLOUR_PALETTE_GROUP).Colour; public OptionalRef GetBlockInfoOptional(Block block) where T : unmanaged, IEntityComponent { @@ -171,14 +171,13 @@ namespace TechbloxModdingAPI.Blocks.Engines public SimBody[] GetSimBodiesFromID(byte id) { var ret = new FasterList(4); - var (oids, tags, count) = entitiesDB.QueryEntities(ObjectIDBlockExclusiveGroups.OBJECT_ID_BLOCK_GROUP); + var oids = entitiesDB.QueryEntitiesOptional(ObjectIDBlockExclusiveGroups.OBJECT_ID_BLOCK_GROUP); EGIDMapper? 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(tag.ID.groupID); + connections = entitiesDB.QueryMappedEntities(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(); var ret = new FasterList(4); - var (oids, tags, count) = entitiesDB.QueryEntities(ObjectIDBlockExclusiveGroups.OBJECT_ID_BLOCK_GROUP); - for (var index = 0; index < count; index++) + var oids = entitiesDB.QueryEntitiesOptional(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(); diff --git a/TechbloxModdingAPI/Blocks/Engines/SignalEngine.cs b/TechbloxModdingAPI/Blocks/Engines/SignalEngine.cs index 75dbddc..e2009b4 100644 --- a/TechbloxModdingAPI/Blocks/Engines/SignalEngine.cs +++ b/TechbloxModdingAPI/Blocks/Engines/SignalEngine.cs @@ -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(wireEGID); @@ -50,10 +50,9 @@ namespace TechbloxModdingAPI.Blocks.Engines sourceBlockEGID = startBlock, sourcePortUsage = startPort, destinationBlockEGID = endBlock, - destinationPortUsage = endPort, - ID = wireEGID + destinationPortUsage = endPort }); - return wireInitializer.Get(); + return (wireInitializer.Get(), 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.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(NamedExclusiveGroup.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.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(ExclusiveGroup group, Func isMatch) where T : unmanaged, IEntityComponent - { - FasterList results = new FasterList(); - var (components, count) = entitiesDB.QueryEntities(group); - for (uint i = 0; i < count; i++) - { - if (isMatch(components[i])) - { - results.Add(components[i]); - } - } - return results.ToArray(); + return entitiesDB + .QueryEntitiesOptional(NamedExclusiveGroup.Group) + .ToArray(wire => wire.ID, + wire => wire.Component.sourcePortUsage == port && wire.Component.sourceBlockEGID == block); } private EntityCollection GetSignalStruct(uint signalID, out uint index, bool input = true) diff --git a/TechbloxModdingAPI/Blocks/Wire.cs b/TechbloxModdingAPI/Blocks/Wire.cs index 41a8791..1a949dd 100644 --- a/TechbloxModdingAPI/Blocks/Wire.cs +++ b/TechbloxModdingAPI/Blocks/Wire.cs @@ -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); } /// @@ -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) { } diff --git a/TechbloxModdingAPI/Player.cs b/TechbloxModdingAPI/Player.cs index 32901ad..857c477 100644 --- a/TechbloxModdingAPI/Player.cs +++ b/TechbloxModdingAPI/Player.cs @@ -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. /// /// The initial health. + [Obsolete("We can no longer get initial health, returns max health.")] public float InitialHealth { get { - var opt = playerEngine.GetCharacterStruct(Id); - return opt ? opt.Get().initialHealth : -1f; + var opt = playerEngine.GetCharacterStruct(Id); + return opt ? opt.Get().maxHealth : -1f; } - set => playerEngine.GetCharacterStruct(Id).Get().initialHealth = value; + set => playerEngine.GetCharacterStruct(Id).Get().maxHealth = value; } /// @@ -233,30 +234,25 @@ namespace TechbloxModdingAPI { get { - var opt = playerEngine.GetCharacterStruct(Id); + var opt = playerEngine.GetCharacterStruct(Id); return opt ? opt.Get().currentHealth : -1f; } - set => playerEngine.GetCharacterStruct(Id).Get().currentHealth = value; + set => playerEngine.GetCharacterStruct(Id).Get().currentHealth = value; } /// /// Whether this is damageable. /// /// true if damageable; otherwise, false. + [Obsolete("Players are probably always damageable")] public bool Damageable { - get - { - var opt = playerEngine.GetCharacterStruct(Id); - return opt.Get().canTakeDamageStat; - } + get => true; + // ReSharper disable once ValueParameterNotUsed set { - ref var healthStruct = ref playerEngine.GetCharacterStruct(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. /// /// The initial lives. + [Obsolete("The player has infinite lives")] public uint InitialLives { - get - { - var opt = playerEngine.GetCharacterStruct(Id); - return opt ? opt.Get().initialLives : uint.MaxValue; - } + get => uint.MaxValue; - set => playerEngine.GetCharacterStruct(Id).Get().initialLives = value; + // ReSharper disable once ValueParameterNotUsed + set { } } /// /// The player's current lives in Simulation (aka Time Running) mode. /// /// The current lives. + [Obsolete("The player has infinite lives")] public uint CurrentLives { - get - { - var opt = playerEngine.GetCharacterStruct(Id); - return opt ? opt.Get().currentLives : uint.MaxValue; - } + get => uint.MaxValue; - set => playerEngine.GetCharacterStruct(Id).Get().currentLives = value; + // ReSharper disable once ValueParameterNotUsed + set { } } /*/// diff --git a/TechbloxModdingAPI/Players/PlayerEngine.cs b/TechbloxModdingAPI/Players/PlayerEngine.cs index 24f019c..534f75a 100644 --- a/TechbloxModdingAPI/Players/PlayerEngine.cs +++ b/TechbloxModdingAPI/Players/PlayerEngine.cs @@ -115,7 +115,7 @@ namespace TechbloxModdingAPI.Players public bool IsDead(uint playerId) { if (entitiesDB == null) return true; - return entitiesDB.Exists(playerId, CharacterExclusiveGroups.DeadCharacters); + return entitiesDB.Exists(playerId, CharacterExclusiveGroups.DeadGroup); } // reusable methods @@ -164,8 +164,9 @@ namespace TechbloxModdingAPI.Players var opt = GetCameraStruct(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) diff --git a/TechbloxModdingAPI/TechbloxModdingAPI.csproj b/TechbloxModdingAPI/TechbloxModdingAPI.csproj index 12ff5bb..709fc87 100644 --- a/TechbloxModdingAPI/TechbloxModdingAPI.csproj +++ b/TechbloxModdingAPI/TechbloxModdingAPI.csproj @@ -111,10 +111,6 @@ ..\ref\Techblox_Data\Managed\Gamecraft.BlockGroups.dll ..\..\ref\Techblox_Data\Managed\Gamecraft.BlockGroups.dll - - ..\ref\Techblox_Data\Managed\Gamecraft.Blocks.DestructionBlocks.dll - ..\..\ref\Techblox_Data\Managed\Gamecraft.Blocks.DestructionBlocks.dll - ..\ref\Techblox_Data\Managed\Gamecraft.Blocks.LogicBlock.dll ..\..\ref\Techblox_Data\Managed\Gamecraft.Blocks.LogicBlock.dll @@ -279,10 +275,6 @@ ..\ref\Techblox_Data\Managed\Havok.Physics.Hybrid.dll ..\..\ref\Techblox_Data\Managed\Havok.Physics.Hybrid.dll - - ..\ref\Techblox_Data\Managed\JWT.dll - ..\..\ref\Techblox_Data\Managed\JWT.dll - ..\ref\Techblox_Data\Managed\LiteNetLib.dll ..\..\ref\Techblox_Data\Managed\LiteNetLib.dll @@ -411,10 +403,6 @@ ..\ref\Techblox_Data\Managed\RobocraftX.GUI.Inventory.dll ..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.Inventory.dll - - ..\ref\Techblox_Data\Managed\RobocraftX.GUI.PauseMenu.dll - ..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.PauseMenu.dll - ..\ref\Techblox_Data\Managed\RobocraftX.GUI.QuitConfirmation.dll ..\..\ref\Techblox_Data\Managed\RobocraftX.GUI.QuitConfirmation.dll @@ -543,6 +531,10 @@ ..\ref\Techblox_Data\Managed\Techblox.AdditionalParts.dll ..\..\ref\Techblox_Data\Managed\Techblox.AdditionalParts.dll + + ..\ref\Techblox_Data\Managed\Techblox.AntiAFKServer.dll + ..\..\ref\Techblox_Data\Managed\Techblox.AntiAFKServer.dll + ..\ref\Techblox_Data\Managed\Techblox.Anticheat.Client.dll ..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Client.dll @@ -551,10 +543,6 @@ ..\ref\Techblox_Data\Managed\Techblox.Anticheat.Common.dll ..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Common.dll - - ..\ref\Techblox_Data\Managed\Techblox.Anticheat.Server.dll - ..\..\ref\Techblox_Data\Managed\Techblox.Anticheat.Server.dll - ..\ref\Techblox_Data\Managed\Techblox.AtmosphereBlock.dll ..\..\ref\Techblox_Data\Managed\Techblox.AtmosphereBlock.dll @@ -623,6 +611,18 @@ ..\ref\Techblox_Data\Managed\Techblox.CentreHUDGUI.dll ..\..\ref\Techblox_Data\Managed\Techblox.CentreHUDGUI.dll + + ..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Client.dll + ..\..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Client.dll + + + ..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Server.dll + ..\..\ref\Techblox_Data\Managed\Techblox.CharacterDamage.Server.dll + + + ..\ref\Techblox_Data\Managed\Techblox.CharacterRespawnScreen.dll + ..\..\ref\Techblox_Data\Managed\Techblox.CharacterRespawnScreen.dll + ..\ref\Techblox_Data\Managed\Techblox.CheckpointBlock.dll ..\..\ref\Techblox_Data\Managed\Techblox.CheckpointBlock.dll @@ -655,6 +655,14 @@ ..\ref\Techblox_Data\Managed\Techblox.CounterBlockServer.dll ..\..\ref\Techblox_Data\Managed\Techblox.CounterBlockServer.dll + + ..\ref\Techblox_Data\Managed\Techblox.DamageRbScoreBlockServerServer.dll + ..\..\ref\Techblox_Data\Managed\Techblox.DamageRbScoreBlockServerServer.dll + + + ..\ref\Techblox_Data\Managed\Techblox.DirectionalDamageVingette.dll + ..\..\ref\Techblox_Data\Managed\Techblox.DirectionalDamageVingette.dll + ..\ref\Techblox_Data\Managed\Techblox.DistanceSensorBlock.dll ..\..\ref\Techblox_Data\Managed\Techblox.DistanceSensorBlock.dll @@ -731,14 +739,14 @@ ..\ref\Techblox_Data\Managed\Techblox.GUI.BuildRules.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.BuildRules.dll + + ..\ref\Techblox_Data\Managed\Techblox.GUI.CharacterHealthFeedback.dll + ..\..\ref\Techblox_Data\Managed\Techblox.GUI.CharacterHealthFeedback.dll + ..\ref\Techblox_Data\Managed\Techblox.GUI.Collection.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Collection.dll - - ..\ref\Techblox_Data\Managed\Techblox.GUI.Commands.dll - ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Commands.dll - ..\ref\Techblox_Data\Managed\Techblox.GUI.Controls.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Controls.dll @@ -751,6 +759,10 @@ ..\ref\Techblox_Data\Managed\Techblox.GUI.GamePortal.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.GamePortal.dll + + ..\ref\Techblox_Data\Managed\Techblox.GUI.GeneralSettingsScreen.dll + ..\..\ref\Techblox_Data\Managed\Techblox.GUI.GeneralSettingsScreen.dll + ..\ref\Techblox_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Hotbar.Landscapes.dll @@ -779,6 +791,10 @@ ..\ref\Techblox_Data\Managed\Techblox.GUI.Login.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Login.dll + + ..\ref\Techblox_Data\Managed\Techblox.GUI.MachineReconstructTimer.dll + ..\..\ref\Techblox_Data\Managed\Techblox.GUI.MachineReconstructTimer.dll + ..\ref\Techblox_Data\Managed\Techblox.GUI.MainGame.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.MainGame.dll @@ -799,10 +815,6 @@ ..\ref\Techblox_Data\Managed\Techblox.GUI.Progression.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.Progression.dll - - ..\ref\Techblox_Data\Managed\Techblox.GUI.ScreenCanvas.dll - ..\..\ref\Techblox_Data\Managed\Techblox.GUI.ScreenCanvas.dll - ..\ref\Techblox_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.TabsBar.Landscapes.dll @@ -815,10 +827,6 @@ ..\ref\Techblox_Data\Managed\Techblox.GUI.UsernameDisplay.dll ..\..\ref\Techblox_Data\Managed\Techblox.GUI.UsernameDisplay.dll - - ..\ref\Techblox_Data\Managed\Techblox.GUI.WorldCanvas.dll - ..\..\ref\Techblox_Data\Managed\Techblox.GUI.WorldCanvas.dll - ..\ref\Techblox_Data\Managed\Techblox.InputCapture.dll ..\..\ref\Techblox_Data\Managed\Techblox.InputCapture.dll @@ -831,6 +839,10 @@ ..\ref\Techblox_Data\Managed\Techblox.JetBlockClient.dll ..\..\ref\Techblox_Data\Managed\Techblox.JetBlockClient.dll + + ..\ref\Techblox_Data\Managed\Techblox.KillScoreBlock.dll + ..\..\ref\Techblox_Data\Managed\Techblox.KillScoreBlock.dll + ..\ref\Techblox_Data\Managed\Techblox.MachineProcessingService.dll ..\..\ref\Techblox_Data\Managed\Techblox.MachineProcessingService.dll @@ -931,10 +943,6 @@ ..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Client.dll ..\..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Client.dll - - ..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Server.dll - ..\..\ref\Techblox_Data\Managed\Techblox.Services.Anticheat.Server.dll - ..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Common.dll ..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Common.dll @@ -943,10 +951,6 @@ ..\ref\Techblox_Data\Managed\Techblox.Services.Eos.dll ..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.dll - - ..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Server.dll - ..\..\ref\Techblox_Data\Managed\Techblox.Services.Eos.Server.dll - ..\ref\Techblox_Data\Managed\Techblox.Services.GameDetails.dll ..\..\ref\Techblox_Data\Managed\Techblox.Services.GameDetails.dll @@ -983,6 +987,10 @@ ..\ref\Techblox_Data\Managed\Techblox.Services.Users.dll ..\..\ref\Techblox_Data\Managed\Techblox.Services.Users.dll + + ..\ref\Techblox_Data\Managed\Techblox.ServoBlocksClient.dll + ..\..\ref\Techblox_Data\Managed\Techblox.ServoBlocksClient.dll + ..\ref\Techblox_Data\Managed\Techblox.ServoBlocksServer.dll ..\..\ref\Techblox_Data\Managed\Techblox.ServoBlocksServer.dll @@ -1143,22 +1151,6 @@ ..\ref\Techblox_Data\Managed\Unity.Addressables.dll ..\..\ref\Techblox_Data\Managed\Unity.Addressables.dll - - ..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.dll - ..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.dll - - - ..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Mdb.dll - ..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Mdb.dll - - - ..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Pdb.dll - ..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Pdb.dll - - - ..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Rocks.dll - ..\..\ref\Techblox_Data\Managed\Unity.Burst.Cecil.Rocks.dll - ..\ref\Techblox_Data\Managed\Unity.Burst.dll ..\..\ref\Techblox_Data\Managed\Unity.Burst.dll @@ -1475,10 +1467,6 @@ ..\ref\Techblox_Data\Managed\UnityEngine.TextCoreFontEngineModule.dll ..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreFontEngineModule.dll - - ..\ref\Techblox_Data\Managed\UnityEngine.TextCoreModule.dll - ..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreModule.dll - ..\ref\Techblox_Data\Managed\UnityEngine.TextCoreTextEngineModule.dll ..\..\ref\Techblox_Data\Managed\UnityEngine.TextCoreTextEngineModule.dll @@ -1591,10 +1579,6 @@ ..\ref\Techblox_Data\Managed\websocket-sharp.dll ..\..\ref\Techblox_Data\Managed\websocket-sharp.dll - - ..\ref\Techblox_Data\Managed\Whinarn.UnityMeshSimplifier.Runtime.dll - ..\..\ref\Techblox_Data\Managed\Whinarn.UnityMeshSimplifier.Runtime.dll - ..\ref\Techblox_Data\Managed\ZFBrowser.dll ..\..\ref\Techblox_Data\Managed\ZFBrowser.dll diff --git a/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs b/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs index 7564816..32ed3e5 100644 --- a/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs +++ b/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs @@ -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( diff --git a/TechbloxModdingAPI/Utility/OptionalRef.cs b/TechbloxModdingAPI/Utility/OptionalRef.cs index b89ff88..2d551e3 100644 --- a/TechbloxModdingAPI/Utility/OptionalRef.cs +++ b/TechbloxModdingAPI/Utility/OptionalRef.cs @@ -78,7 +78,7 @@ namespace TechbloxModdingAPI.Utility } /// - /// 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. /// public EGID EGID => entityId; diff --git a/TechbloxModdingAPI/Utility/RefCollection.cs b/TechbloxModdingAPI/Utility/RefCollection.cs index be76390..0776e8a 100644 --- a/TechbloxModdingAPI/Utility/RefCollection.cs +++ b/TechbloxModdingAPI/Utility/RefCollection.cs @@ -37,6 +37,27 @@ namespace TechbloxModdingAPI.Utility } public Enumerator GetEnumerator() => new(this); + + /// + /// The amount of items in the collection. + /// + public int Count => count; + + public T[] ToArray() => ToArray(a => a.Component); + + public TA[] ToArray(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 {