Browse Source

Merge master into preview

tags/v2.2.0
NorbiPeti 4 years ago
parent
commit
53bdd27166
10 changed files with 28 additions and 38 deletions
  1. +1
    -1
      GamecraftModdingAPI/Blocks/ConsoleBlock.cs
  2. +1
    -1
      GamecraftModdingAPI/Blocks/Motor.cs
  3. +1
    -1
      GamecraftModdingAPI/Blocks/MusicBlock.cs
  4. +1
    -1
      GamecraftModdingAPI/Blocks/Piston.cs
  5. +1
    -1
      GamecraftModdingAPI/Blocks/Servo.cs
  6. +1
    -1
      GamecraftModdingAPI/Blocks/TextBlock.cs
  7. +1
    -1
      GamecraftModdingAPI/Blocks/Timer.cs
  8. +4
    -4
      GamecraftModdingAPI/Blocks/Wire.cs
  9. +10
    -7
      GamecraftModdingAPI/Players/PlayerEngine.cs
  10. +7
    -20
      GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs

+ 1
- 1
GamecraftModdingAPI/Blocks/ConsoleBlock.cs View File

@@ -10,7 +10,7 @@ using GamecraftModdingAPI.Utility;

namespace GamecraftModdingAPI.Blocks
{
public class ConsoleBlock : Block
public class ConsoleBlock : SignalingBlock
{
public ConsoleBlock(EGID id): base(id)
{


+ 1
- 1
GamecraftModdingAPI/Blocks/Motor.cs View File

@@ -9,7 +9,7 @@ using GamecraftModdingAPI.Utility;

namespace GamecraftModdingAPI.Blocks
{
public class Motor : Block
public class Motor : SignalingBlock
{
public Motor(EGID id) : base(id)
{


+ 1
- 1
GamecraftModdingAPI/Blocks/MusicBlock.cs View File

@@ -14,7 +14,7 @@ using GamecraftModdingAPI.Utility;

namespace GamecraftModdingAPI.Blocks
{
public class MusicBlock : Block
public class MusicBlock : SignalingBlock
{
public MusicBlock(EGID id) : base(id)
{


+ 1
- 1
GamecraftModdingAPI/Blocks/Piston.cs View File

@@ -9,7 +9,7 @@ using RobocraftX.Common;

namespace GamecraftModdingAPI.Blocks
{
public class Piston : Block
public class Piston : SignalingBlock
{
public Piston(EGID id) : base(id)
{


+ 1
- 1
GamecraftModdingAPI/Blocks/Servo.cs View File

@@ -9,7 +9,7 @@ using GamecraftModdingAPI.Utility;

namespace GamecraftModdingAPI.Blocks
{
public class Servo : Block
public class Servo : SignalingBlock
{
public Servo(EGID id) : base(id)
{


+ 1
- 1
GamecraftModdingAPI/Blocks/TextBlock.cs View File

@@ -10,7 +10,7 @@ using GamecraftModdingAPI.Utility;

namespace GamecraftModdingAPI.Blocks
{
public class TextBlock : Block
public class TextBlock : SignalingBlock
{
public TextBlock(EGID id) : base(id)
{


+ 1
- 1
GamecraftModdingAPI/Blocks/Timer.cs View File

@@ -11,7 +11,7 @@ using GamecraftModdingAPI.Utility;

namespace GamecraftModdingAPI.Blocks
{
public class Timer : Block
public class Timer : SignalingBlock
{
public Timer(EGID id) : base(id)
{


+ 4
- 4
GamecraftModdingAPI/Blocks/Wire.cs View File

@@ -31,7 +31,7 @@ namespace GamecraftModdingAPI.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);
return new Wire(wire, start, end);
}

/// <summary>
@@ -173,15 +173,15 @@ namespace GamecraftModdingAPI.Blocks
this.startPort = wire.sourcePortUsage;
}

internal Wire(WireEntityStruct wire)
internal Wire(WireEntityStruct wire, SignalingBlock src, SignalingBlock dest)
{
this.wireEGID = wire.ID;
this.startBlockEGID = wire.sourceBlockEGID;
this.endBlockEGID = wire.destinationBlockEGID;
inputToOutput = false;
endPortEGID = signalEngine.MatchBlockInputToPort(wire.destinationBlockEGID, wire.destinationPortUsage, out bool exists);
endPortEGID = signalEngine.MatchBlockInputToPort(dest, wire.destinationPortUsage, out bool exists);
if (!exists) throw new WireInvalidException("Wire end port not found");
startPortEGID = signalEngine.MatchBlockOutputToPort(wire.sourceBlockEGID, wire.sourcePortUsage, out exists);
startPortEGID = signalEngine.MatchBlockOutputToPort(src, wire.sourcePortUsage, out exists);
if (!exists) throw new WireInvalidException("Wire start port not found");
this.endPort = wire.destinationPortUsage;
this.startPort = wire.sourcePortUsage;


+ 10
- 7
GamecraftModdingAPI/Players/PlayerEngine.cs View File

@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;

using RobocraftX.Character;
@@ -10,12 +12,16 @@ using RobocraftX.Physics;
using RobocraftX.Blocks.Ghost;
using RobocraftX.Character.Camera;
using RobocraftX.Character.Factories;
using Gamecraft.GUI.HUDFeedbackBlocks;
using Svelto.ECS;
using Unity.Mathematics;
using Unity.Physics;
using UnityEngine;

using GamecraftModdingAPI.Engines;
using HarmonyLib;
using RobocraftX.Common;
using Svelto.ECS.DataStructures;

namespace GamecraftModdingAPI.Players
{
@@ -356,15 +362,12 @@ namespace GamecraftModdingAPI.Players
public bool GetGameOverScreen(uint playerId)
{
if (entitiesDB == null) return false;
ref var c = ref GetCharacterStruct<CharacterLivesEntityComponent>(playerId, out bool exists);
if (exists)
{
return c.gameOverScreen;
}
return false;
ref HudActivatedBlocksEntityStruct habes = ref entitiesDB.QueryEntity<HudActivatedBlocksEntityStruct>(HUDFeedbackBlocksGUIExclusiveGroups.GameOverHudEgid);
NativeDynamicArrayCast<EGID> nativeDynamicArrayCast = new NativeDynamicArrayCast<EGID>(habes.activatedBlocksOrdered);
return nativeDynamicArrayCast.count > 0;
}

public bool IsDead(uint playerId)
public bool IsDead(uint playerId)
{
if (entitiesDB == null) return true;
return entitiesDB.Exists<RigidBodyEntityStruct>(playerId, CharacterExclusiveGroups.DeadCharacters);


+ 7
- 20
GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs View File

@@ -22,33 +22,29 @@ using GamecraftModdingAPI.Players;

namespace GamecraftModdingAPI.Tests
{
#if DEBUG
// unused by design
/// <summary>
/// Modding API implemented as a standalone IPA Plugin.
/// Ideally, GamecraftModdingAPI should be loaded by another mod; not itself
/// </summary>
public class GamecraftModdingAPIPluginTest
#if DEBUG
: IllusionPlugin.IEnhancedPlugin
#endif
public class GamecraftModdingAPIPluginTest : IllusionPlugin.IEnhancedPlugin
{

private static Harmony harmony { get; set; }

public string[] Filter { get; } = new string[] { "Gamecraft", "GamecraftPreview" };
public override string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name;

public string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name;

public string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString();
public override string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString();

public string HarmonyID { get; } = "org.git.exmods.modtainers.gamecraftmoddingapi";

public void OnApplicationQuit()
public override void OnApplicationQuit()
{
GamecraftModdingAPI.Main.Shutdown();
}

public void OnApplicationStart()
public override void OnApplicationStart()
{
FileLog.Reset();
Harmony.DEBUG = true;
@@ -387,16 +383,6 @@ namespace GamecraftModdingAPI.Tests
}
}

public void OnFixedUpdate() { }

public void OnLateUpdate() { }

public void OnLevelWasInitialized(int level) { }

public void OnLevelWasLoaded(int level) { }

public void OnUpdate() { }

[HarmonyPatch]
public class MinimumSpecsPatch
{
@@ -411,4 +397,5 @@ namespace GamecraftModdingAPI.Tests
}
}
}
#endif
}

Loading…
Cancel
Save