Fix build issues for latest Gamecraft preview version

This commit is contained in:
NGnius (Graham) 2020-08-07 13:55:00 -04:00
parent 167ea5388b
commit 50ebf4f0a6
7 changed files with 184 additions and 37 deletions

View file

@ -10,6 +10,7 @@ using Svelto.ECS.Experimental;
using GamecraftModdingAPI.Engines;
using GamecraftModdingAPI.Utility;
using Svelto.DataStructures;
namespace GamecraftModdingAPI.App
{
@ -115,10 +116,20 @@ namespace GamecraftModdingAPI.App
public ref MyGamesSlotEntityViewStruct GetGameViewInfo(EGID id)
{
return ref GetComponent<MyGamesSlotEntityViewStruct>(new EGID(id.entityID, MyGamesScreenExclusiveGroups.GameSlotGuiEntities));
EntityCollection<MyGamesSlotEntityViewStruct> entities =
entitiesDB.QueryEntities<MyGamesSlotEntityViewStruct>(MyGamesScreenExclusiveGroups.GameSlotGuiEntities);
for (int i = 0; i < entities.count; i++)
{
if (entities[i].ID.entityID == id.entityID)
{
return ref entities[i];
}
}
MyGamesSlotEntityViewStruct[] defRef = new MyGamesSlotEntityViewStruct[1];
return ref defRef[0];
}
public ref T GetComponent<T>(EGID id) where T: struct, IEntityComponent
public ref T GetComponent<T>(EGID id) where T: unmanaged, IEntityComponent
{
return ref entitiesDB.QueryEntity<T>(id);
}

View file

@ -337,10 +337,10 @@ namespace GamecraftModdingAPI
/// </summary>
public string Label
{
get => BlockEngine.GetBlockInfo(this, (TextLabelEntityViewStruct st) => st.textLabelComponent?.text);
get => BlockEngine.GetBlockInfoViewStruct(this, (TextLabelEntityViewStruct st) => st.textLabelComponent?.text);
set
{
BlockEngine.SetBlockInfo(this, (ref TextLabelEntityViewStruct text, string val) =>
BlockEngine.SetBlockInfoViewStruct(this, (ref TextLabelEntityViewStruct text, string val) =>
{
if (text.textLabelComponent != null) text.textLabelComponent.text = val;
}, value);

View file

@ -59,7 +59,7 @@ namespace GamecraftModdingAPI.Blocks
color.paletteColour = paletteEntry.Colour;
}
public ref T GetBlockInfo<T>(EGID blockID) where T : struct, IEntityComponent
public ref T GetBlockInfo<T>(EGID blockID) where T : unmanaged, IEntityComponent
{
if (entitiesDB.Exists<T>(blockID))
return ref entitiesDB.QueryEntity<T>(blockID);
@ -67,8 +67,26 @@ namespace GamecraftModdingAPI.Blocks
return ref structHolder[0]; //Gets a default value automatically
}
public ref T GetBlockInfoViewStruct<T>(EGID blockID) where T : struct, INeedEGID, IEntityComponent
{
if (entitiesDB.Exists<T>(blockID))
{
// TODO: optimize by using EntitiesDB internal calls instead of iterating over everything
EntityCollection<T> entities = entitiesDB.QueryEntities<T>(blockID.groupID);
for (int i = 0; i < entities.count; i++)
{
if (entities[i].ID == blockID)
{
return ref entities[i];
}
}
}
T[] structHolder = new T[1]; //Create something that can be referenced
return ref structHolder[0]; //Gets a default value automatically
}
public U GetBlockInfo<T, U>(Block block, Func<T, U> getter,
U def = default) where T : struct, IEntityComponent
U def = default) where T : unmanaged, IEntityComponent
{
if (entitiesDB.Exists<T>(block.Id))
return getter(entitiesDB.QueryEntity<T>(block.Id));
@ -79,9 +97,55 @@ namespace GamecraftModdingAPI.Blocks
return def;
}
public U GetBlockInfoViewStruct<T, U>(Block block, Func<T, U> getter,
U def = default) where T : struct, INeedEGID, IEntityComponent
{
if (entitiesDB.Exists<T>(block.Id))
{
// TODO: optimize by using EntitiesDB internal calls instead of iterating over everything
EntityCollection<T> entities = entitiesDB.QueryEntities<T>(block.Id.groupID);
for (int i = 0; i < entities.count; i++)
{
if (entities[i].ID == block.Id)
{
return getter(entities[i]);
}
}
}
if (block.InitData.Group == null) return def;
var initializer = new EntityComponentInitializer(block.Id, block.InitData.Group);
if (initializer.Has<T>())
return getter(initializer.Get<T>());
return def;
}
public delegate void Setter<T, U>(ref T component, U value) where T : struct, IEntityComponent;
public void SetBlockInfo<T, U>(Block block, Setter<T, U> setter, U value) where T : struct, IEntityComponent
public void SetBlockInfoViewStruct<T, U>(Block block, Setter<T, U> setter, U value) where T : struct, INeedEGID, IEntityComponent
{
if (entitiesDB.Exists<T>(block.Id))
{
EntityCollection<T> entities = entitiesDB.QueryEntities<T>(block.Id.groupID);
for (int i = 0; i < entities.count; i++)
{
if (entities[i].ID == block.Id)
{
setter(ref entities[i], value);
return;
}
}
}
else if (block.InitData.Group != null)
{
var initializer = new EntityComponentInitializer(block.Id, block.InitData.Group);
T component = initializer.Has<T>() ? initializer.Get<T>() : default;
ref T structRef = ref component;
setter(ref structRef, value);
initializer.Init(structRef);
}
}
public void SetBlockInfo<T, U>(Block block, Setter<T, U> setter, U value) where T : unmanaged, IEntityComponent
{
if (entitiesDB.Exists<T>(block.Id))
setter(ref entitiesDB.QueryEntity<T>(block.Id), value);

View file

@ -96,7 +96,7 @@ namespace GamecraftModdingAPI.Blocks
return ref GetPortByOffset(bps, portNumber, input);
}
public ref T GetComponent<T>(EGID egid) where T : struct, IEntityComponent
public ref T GetComponent<T>(EGID egid) where T : unmanaged, IEntityComponent
{
return ref entitiesDB.QueryEntity<T>(egid);
}
@ -372,7 +372,7 @@ namespace GamecraftModdingAPI.Blocks
return results.ToArray();
}
private ref T GetFromDbOrInitData<T>(Block block, EGID id, out bool exists) where T : struct, IEntityComponent
private ref T GetFromDbOrInitData<T>(Block block, EGID id, out bool exists) where T : unmanaged, IEntityComponent
{
T[] defRef = new T[1];
if (entitiesDB.Exists<T>(id))

View file

@ -25,8 +25,17 @@
<!--Start Dependencies-->
<ItemGroup>
<Reference Include="IllusionInjector">
<HintPath>..\ref\GamecraftPreview_Data\Managed\IllusionInjector.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\IllusionInjector.dll</HintPath>
</Reference>
<Reference Include="IllusionPlugin">
<HintPath>..\ref\GamecraftPreview_Data\Managed\IllusionPlugin.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\IllusionPlugin.dll</HintPath>
</Reference>
<Reference Include="Analytics">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Analytics.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Analytics.dll</HintPath>
@ -43,10 +52,6 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\Authentication.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Authentication.dll</HintPath>
</Reference>
<Reference Include="BlockEntityFactory">
<HintPath>..\ref\GamecraftPreview_Data\Managed\BlockEntityFactory.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\BlockEntityFactory.dll</HintPath>
</Reference>
<Reference Include="Blocks.HUDFeedbackBlocks">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Blocks.HUDFeedbackBlocks.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Blocks.HUDFeedbackBlocks.dll</HintPath>
@ -55,6 +60,18 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\CommandLine.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\CommandLine.dll</HintPath>
</Reference>
<Reference Include="CommandLineCompositionRoot">
<HintPath>..\ref\GamecraftPreview_Data\Managed\CommandLineCompositionRoot.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\CommandLineCompositionRoot.dll</HintPath>
</Reference>
<Reference Include="ConsoleBlockComposotionRoot">
<HintPath>..\ref\GamecraftPreview_Data\Managed\ConsoleBlockComposotionRoot.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\ConsoleBlockComposotionRoot.dll</HintPath>
</Reference>
<Reference Include="ConsoleCommand">
<HintPath>..\ref\GamecraftPreview_Data\Managed\ConsoleCommand.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\ConsoleCommand.dll</HintPath>
</Reference>
<Reference Include="DataLoader">
<HintPath>..\ref\GamecraftPreview_Data\Managed\DataLoader.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\DataLoader.dll</HintPath>
@ -75,6 +92,14 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.AudioBlocks.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.AudioBlocks.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.BlockCompositionRoot">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.BlockCompositionRoot.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.BlockCompositionRoot.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.BlockEntityFactory">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.BlockEntityFactory.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.BlockEntityFactory.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Blocks.ConsoleBlock">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.ConsoleBlock.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.ConsoleBlock.dll</HintPath>
@ -83,6 +108,10 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.DamagingSurfaceBlock.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.DamagingSurfaceBlock.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Blocks.DestructionBlocks">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.DestructionBlocks.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.DestructionBlocks.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Blocks.GenericPhysicsBlocks">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll</HintPath>
@ -95,10 +124,18 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\GameCraft.Blocks.ProjectileBlock.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\GameCraft.Blocks.ProjectileBlock.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Blocks.TextBlock.CompositionRoot">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.TextBlock.CompositionRoot.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.TextBlock.CompositionRoot.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Blocks.TimerBlock">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.BlocksEntityDescriptors">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.BlocksEntityDescriptors.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.BlocksEntityDescriptors.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.CharacterVulnerability">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.CharacterVulnerability.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.CharacterVulnerability.dll</HintPath>
@ -107,10 +144,22 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Damage">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Damage.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Damage.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Effects">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Effects.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Effects.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.ExplosionFragments">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.ExplosionFragments.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.ExplosionFragments.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.GraphicsSettings">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.GraphicsSettings.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.GraphicsSettings.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.GUI.ConsoleBlock">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.GUI.ConsoleBlock.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.GUI.ConsoleBlock.dll</HintPath>
@ -139,6 +188,14 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.InventoryTimeRunning">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.InventoryTimeRunning.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.InventoryTimeRunning.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.JointBlocks">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.JointBlocks.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.JointBlocks.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Music">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Music.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Music.dll</HintPath>
@ -147,6 +204,22 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.PerformanceWarnings.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.PerformanceWarnings.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.PickupBlck">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.PickupBlck.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.PickupBlck.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.PickupsCommon">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.PickupsCommon.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.PickupsCommon.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.PopupMessage">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.PopupMessage.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.PopupMessage.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Projectiles">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Projectiles.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Projectiles.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Tweaks">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Tweaks.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Tweaks.dll</HintPath>
@ -155,6 +228,10 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Tweaks.Mockup.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Tweaks.Mockup.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.VisualEffects.Decals">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.VisualEffects.Decals.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.VisualEffects.Decals.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.VisualEffects">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.VisualEffects.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.VisualEffects.dll</HintPath>
@ -163,10 +240,6 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Wires.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Wires.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Wires.Input">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Wires.Input.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Wires.Input.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Wires.Mockup">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Gamecraft.Wires.Mockup.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Gamecraft.Wires.Mockup.dll</HintPath>
@ -379,6 +452,14 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\RobocratX.SimulationCompositionRoot.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\RobocratX.SimulationCompositionRoot.dll</HintPath>
</Reference>
<Reference Include="SpawningPointCompositionRoot">
<HintPath>..\ref\GamecraftPreview_Data\Managed\SpawningPointCompositionRoot.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\SpawningPointCompositionRoot.dll</HintPath>
</Reference>
<Reference Include="SpecializedDescriptors">
<HintPath>..\ref\GamecraftPreview_Data\Managed\SpecializedDescriptors.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\SpecializedDescriptors.dll</HintPath>
</Reference>
<Reference Include="StringFormatter">
<HintPath>..\ref\GamecraftPreview_Data\Managed\StringFormatter.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\StringFormatter.dll</HintPath>
@ -399,6 +480,10 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\Svelto.Tasks.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Svelto.Tasks.dll</HintPath>
</Reference>
<Reference Include="UltimateDecals">
<HintPath>..\ref\GamecraftPreview_Data\Managed\UltimateDecals.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\UltimateDecals.dll</HintPath>
</Reference>
<Reference Include="Unity.Addressables">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Unity.Addressables.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Unity.Addressables.dll</HintPath>
@ -563,6 +648,10 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\Unity.Transforms.Hybrid.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Unity.Transforms.Hybrid.dll</HintPath>
</Reference>
<Reference Include="Unity.VisualEffectGraph.Runtime">
<HintPath>..\ref\GamecraftPreview_Data\Managed\Unity.VisualEffectGraph.Runtime.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\Unity.VisualEffectGraph.Runtime.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>..\ref\GamecraftPreview_Data\Managed\UnityEngine.UI.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\UnityEngine.UI.dll</HintPath>
@ -855,14 +944,6 @@
<HintPath>..\ref\GamecraftPreview_Data\Managed\UnityEngine.XRModule.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\UnityEngine.XRModule.dll</HintPath>
</Reference>
<Reference Include="IllusionInjector">
<HintPath>..\ref\GamecraftPreview_Data\Managed\IllusionInjector.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\IllusionInjector.dll</HintPath>
</Reference>
<Reference Include="IllusionPlugin">
<HintPath>..\ref\GamecraftPreview_Data\Managed\IllusionPlugin.dll</HintPath>
<HintPath>..\..\ref\GamecraftPreview_Data\Managed\IllusionPlugin.dll</HintPath>
</Reference>
</ItemGroup>
<!--End Dependencies-->
</Project>

View file

@ -10,8 +10,6 @@ using RobocraftX.Physics;
using RobocraftX.Blocks.Ghost;
using RobocraftX.Character.Camera;
using RobocraftX.Character.Factories;
using Gamecraft.CharacterVulnerability;
using Gamecraft.CharacterVulnerability.Entities;
using Svelto.ECS;
using Unity.Mathematics;
using Unity.Physics;
@ -282,14 +280,7 @@ namespace GamecraftModdingAPI.Players
public bool DamagePlayer(uint playerId, float amount)
{
if (entitiesDB == null) return false;
Factory.BuildEntity<DamageEntityDescriptor>(
new EGID(CharacterVulnerabilityExclusiveGroups.NextDamageEntityId, CharacterVulnerabilityExclusiveGroups.CharacterDamageExclusiveGroup)
).Init(new DamageEntityStruct
{
damage = amount,
targetPlayerEntityId = playerId,
});
return true;
return SetCurrentHealth(playerId, GetCurrentHealth(playerId) - amount);
}
public bool GetDamageable(uint playerId)