Fix build issues for latest Gamecraft preview version

This commit is contained in:
NGnius (Graham) 2020-08-07 13:55:00 -04:00
parent 89f354b647
commit fd97194903
6 changed files with 195 additions and 18 deletions

View file

@ -10,6 +10,7 @@ using Svelto.ECS.Experimental;
using GamecraftModdingAPI.Engines; using GamecraftModdingAPI.Engines;
using GamecraftModdingAPI.Utility; using GamecraftModdingAPI.Utility;
using Svelto.DataStructures;
namespace GamecraftModdingAPI.App namespace GamecraftModdingAPI.App
{ {
@ -114,11 +115,21 @@ namespace GamecraftModdingAPI.App
} }
public ref MyGamesSlotEntityViewStruct GetGameViewInfo(EGID id) 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); return ref entitiesDB.QueryEntity<T>(id);
} }

View file

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

View file

@ -59,16 +59,34 @@ namespace GamecraftModdingAPI.Blocks
color.paletteColour = paletteEntry.Colour; 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)) if (entitiesDB.Exists<T>(blockID))
return ref entitiesDB.QueryEntity<T>(blockID); return ref entitiesDB.QueryEntity<T>(blockID);
T[] structHolder = new T[1]; //Create something that can be referenced T[] structHolder = new T[1]; //Create something that can be referenced
return ref structHolder[0]; //Gets a default value automatically 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, 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)) if (entitiesDB.Exists<T>(block.Id))
return getter(entitiesDB.QueryEntity<T>(block.Id)); return getter(entitiesDB.QueryEntity<T>(block.Id));
@ -78,10 +96,56 @@ namespace GamecraftModdingAPI.Blocks
return getter(initializer.Get<T>()); return getter(initializer.Get<T>());
return def; 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 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)) if (entitiesDB.Exists<T>(block.Id))
setter(ref entitiesDB.QueryEntity<T>(block.Id), value); setter(ref entitiesDB.QueryEntity<T>(block.Id), value);

View file

@ -96,7 +96,7 @@ namespace GamecraftModdingAPI.Blocks
return ref GetPortByOffset(bps, portNumber, input); 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); return ref entitiesDB.QueryEntity<T>(egid);
} }
@ -372,7 +372,7 @@ namespace GamecraftModdingAPI.Blocks
return results.ToArray(); 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]; T[] defRef = new T[1];
if (entitiesDB.Exists<T>(id)) if (entitiesDB.Exists<T>(id))

View file

@ -22,6 +22,7 @@
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
</ItemGroup> </ItemGroup>
<<<<<<< HEAD
<!--Start Dependencies--> <!--Start Dependencies-->
<ItemGroup> <ItemGroup>
<Reference Include="IllusionInjector"> <Reference Include="IllusionInjector">
@ -55,6 +56,21 @@
<Reference Include="Accessibility"> <Reference Include="Accessibility">
<HintPath>..\ref\Gamecraft_Data\Managed\Accessibility.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Accessibility.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Accessibility.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Accessibility.dll</HintPath>
=======
<!--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>
>>>>>>> 50ebf4f... Fix build issues for latest Gamecraft preview version
</Reference> </Reference>
<Reference Include="Analytics"> <Reference Include="Analytics">
<HintPath>..\ref\Gamecraft_Data\Managed\Analytics.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Analytics.dll</HintPath>
@ -72,10 +88,13 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Authentication.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Authentication.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Authentication.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Authentication.dll</HintPath>
</Reference> </Reference>
<<<<<<< HEAD
<Reference Include="BlockEntityFactory"> <Reference Include="BlockEntityFactory">
<HintPath>..\ref\Gamecraft_Data\Managed\BlockEntityFactory.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\BlockEntityFactory.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\BlockEntityFactory.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\BlockEntityFactory.dll</HintPath>
</Reference> </Reference>
=======
>>>>>>> 50ebf4f... Fix build issues for latest Gamecraft preview version
<Reference Include="Blocks.HUDFeedbackBlocks"> <Reference Include="Blocks.HUDFeedbackBlocks">
<HintPath>..\ref\Gamecraft_Data\Managed\Blocks.HUDFeedbackBlocks.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Blocks.HUDFeedbackBlocks.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Blocks.HUDFeedbackBlocks.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Blocks.HUDFeedbackBlocks.dll</HintPath>
@ -84,6 +103,18 @@
<HintPath>..\ref\Gamecraft_Data\Managed\CommandLine.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\CommandLine.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\CommandLine.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\CommandLine.dll</HintPath>
</Reference> </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"> <Reference Include="DataLoader">
<HintPath>..\ref\Gamecraft_Data\Managed\DataLoader.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\DataLoader.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\DataLoader.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\DataLoader.dll</HintPath>
@ -108,6 +139,14 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.AudioBlocks.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.AudioBlocks.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.AudioBlocks.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.AudioBlocks.dll</HintPath>
</Reference> </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"> <Reference Include="Gamecraft.Blocks.ConsoleBlock">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.ConsoleBlock.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.ConsoleBlock.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.ConsoleBlock.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.ConsoleBlock.dll</HintPath>
@ -116,6 +155,10 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.DamagingSurfaceBlock.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.DamagingSurfaceBlock.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.DamagingSurfaceBlock.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.DamagingSurfaceBlock.dll</HintPath>
</Reference> </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"> <Reference Include="Gamecraft.Blocks.GenericPhysicsBlocks">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll</HintPath>
@ -128,10 +171,18 @@
<HintPath>..\ref\Gamecraft_Data\Managed\GameCraft.Blocks.ProjectileBlock.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\GameCraft.Blocks.ProjectileBlock.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\GameCraft.Blocks.ProjectileBlock.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\GameCraft.Blocks.ProjectileBlock.dll</HintPath>
</Reference> </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"> <Reference Include="Gamecraft.Blocks.TimerBlock">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath>
</Reference> </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"> <Reference Include="Gamecraft.CharacterVulnerability">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll</HintPath>
@ -140,10 +191,22 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll</HintPath>
</Reference> </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"> <Reference Include="Gamecraft.Effects">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll</HintPath>
</Reference> </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"> <Reference Include="Gamecraft.GUI.ConsoleBlock">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.ConsoleBlock.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.ConsoleBlock.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.ConsoleBlock.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.ConsoleBlock.dll</HintPath>
@ -172,6 +235,14 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll</HintPath>
</Reference> </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"> <Reference Include="Gamecraft.Music">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Music.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Music.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Music.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Music.dll</HintPath>
@ -180,6 +251,22 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.PerformanceWarnings.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.PerformanceWarnings.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.PerformanceWarnings.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.PerformanceWarnings.dll</HintPath>
</Reference> </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"> <Reference Include="Gamecraft.Tweaks">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath>
@ -188,6 +275,10 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.Mockup.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.Mockup.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.Mockup.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.Mockup.dll</HintPath>
</Reference> </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"> <Reference Include="Gamecraft.VisualEffects">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.VisualEffects.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.VisualEffects.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.VisualEffects.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.VisualEffects.dll</HintPath>
@ -196,10 +287,13 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.dll</HintPath>
</Reference> </Reference>
<<<<<<< HEAD
<Reference Include="Gamecraft.Wires.Input"> <Reference Include="Gamecraft.Wires.Input">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Input.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Input.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Input.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Input.dll</HintPath>
</Reference> </Reference>
=======
>>>>>>> 50ebf4f... Fix build issues for latest Gamecraft preview version
<Reference Include="Gamecraft.Wires.Mockup"> <Reference Include="Gamecraft.Wires.Mockup">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Mockup.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Mockup.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Mockup.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Mockup.dll</HintPath>
@ -424,6 +518,14 @@
<HintPath>..\ref\Gamecraft_Data\Managed\RobocratX.SimulationCompositionRoot.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\RobocratX.SimulationCompositionRoot.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\RobocratX.SimulationCompositionRoot.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\RobocratX.SimulationCompositionRoot.dll</HintPath>
</Reference> </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"> <Reference Include="StringFormatter">
<HintPath>..\ref\Gamecraft_Data\Managed\StringFormatter.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\StringFormatter.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\StringFormatter.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\StringFormatter.dll</HintPath>
@ -444,6 +546,10 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Svelto.Tasks.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Svelto.Tasks.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Svelto.Tasks.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Svelto.Tasks.dll</HintPath>
</Reference> </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"> <Reference Include="Unity.Addressables">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath>
@ -816,6 +922,7 @@
<HintPath>..\ref\Gamecraft_Data\Managed\UnityEngine.XRModule.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\UnityEngine.XRModule.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\UnityEngine.XRModule.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\UnityEngine.XRModule.dll</HintPath>
</Reference> </Reference>
<<<<<<< HEAD
<Reference Include="uREPL"> <Reference Include="uREPL">
<HintPath>..\ref\Gamecraft_Data\Managed\uREPL.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\uREPL.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\uREPL.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\uREPL.dll</HintPath>
@ -824,6 +931,8 @@
<HintPath>..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath>
</Reference> </Reference>
=======
>>>>>>> 50ebf4f... Fix build issues for latest Gamecraft preview version
</ItemGroup> </ItemGroup>
<!--End Dependencies--> <!--End Dependencies-->
</Project> </Project>

View file

@ -288,14 +288,7 @@ namespace GamecraftModdingAPI.Players
public bool DamagePlayer(uint playerId, float amount) public bool DamagePlayer(uint playerId, float amount)
{ {
if (entitiesDB == null) return false; if (entitiesDB == null) return false;
Factory.BuildEntity<DamageEntityDescriptor>( return SetCurrentHealth(playerId, GetCurrentHealth(playerId) - amount);
new EGID(CharacterVulnerabilityExclusiveGroups.NextDamageEntityId, CharacterVulnerabilityExclusiveGroups.CharacterDamageExclusiveGroup)
).Init(new DamageEntityStruct
{
damage = amount,
targetPlayerEntityId = playerId,
});
return true;
} }
public bool GetDamageable(uint playerId) public bool GetDamageable(uint playerId)