Fix breaking API changes

This commit is contained in:
NGnius (Graham) 2020-05-15 13:48:49 -04:00
parent d536956e6c
commit 6acf1b7d4e
2 changed files with 5 additions and 33 deletions

View file

@ -7,10 +7,11 @@ using UnityEngine;
using Unity.Mathematics; // float3 using Unity.Mathematics; // float3
using IllusionPlugin; using IllusionPlugin;
// using GamecraftModdingAPI; using GamecraftModdingAPI;
using GamecraftModdingAPI.Commands; using GamecraftModdingAPI.Commands;
using GamecraftModdingAPI.Utility; using GamecraftModdingAPI.Utility;
using GamecraftModdingAPI.Blocks; using GamecraftModdingAPI.Blocks;
using GamecraftModdingAPI.Players;
namespace Pixi namespace Pixi
{ {
@ -29,8 +30,6 @@ namespace Pixi
private double blockSize = 0.2; private double blockSize = 0.2;
private PlayerLocationEngine playerLocationEngine = new PlayerLocationEngine();
// called when Gamecraft shuts down // called when Gamecraft shuts down
public void OnApplicationQuit() public void OnApplicationQuit()
{ {
@ -71,7 +70,6 @@ namespace Pixi
// register commands so the modding API knows about it // register commands so the modding API knows about it
CommandManager.AddCommand(pixelate2DCommand); CommandManager.AddCommand(pixelate2DCommand);
CommandManager.AddCommand(scaleCommand); CommandManager.AddCommand(scaleCommand);
GameEngineManager.AddGameEngine(playerLocationEngine);
GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has started up"); GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has started up");
} }
@ -104,7 +102,7 @@ namespace Pixi
Logging.MetaLog(e.Message + "\n" + e.StackTrace); Logging.MetaLog(e.Message + "\n" + e.StackTrace);
return; return;
} }
float3 position = playerLocationEngine.GetPlayerLocation(0u); float3 position = new Player(PlayerType.Local).Position;
uint blockCount = 0; uint blockCount = 0;
position.x += 1f; position.x += 1f;
//position.y += 1f; //position.y += 1f;
@ -138,7 +136,7 @@ namespace Pixi
if (qVoxel.visible) if (qVoxel.visible)
{ {
position.y = zero_y + (float)((y * blockSize + (y - scale.y) * blockSize) / 2); position.y = zero_y + (float)((y * blockSize + (y - scale.y) * blockSize) / 2);
Placement.PlaceBlock(qVoxel.block, position, color: qVoxel.color, darkness: qVoxel.darkness, scale: scale); Block.PlaceNew(qVoxel.block, position, color: qVoxel.color, darkness: qVoxel.darkness, scale: scale);
blockCount++; blockCount++;
} }
scale = new float3(1, 1, 1); scale = new float3(1, 1, 1);
@ -154,7 +152,7 @@ namespace Pixi
if (qVoxel.visible) if (qVoxel.visible)
{ {
position.y = zero_y + (float)((height * blockSize + (height - scale.y) * blockSize) / 2); position.y = zero_y + (float)((height * blockSize + (height - scale.y) * blockSize) / 2);
Placement.PlaceBlock(qVoxel.block, position, color: qVoxel.color, darkness: qVoxel.darkness, scale: scale); Block.PlaceNew(qVoxel.block, position, color: qVoxel.color, darkness: qVoxel.darkness, scale: scale);
blockCount++; blockCount++;
} }
//position.y = zero_y; //position.y = zero_y;

View file

@ -1,26 +0,0 @@
using System;
using GamecraftModdingAPI.Utility;
using Svelto.ECS;
using Unity.Mathematics;
using RobocraftX.Physics;
using RobocraftX.Character;
namespace Pixi
{
internal class PlayerLocationEngine : IApiEngine
{
public string Name => "PixiPlayerLocationGameEngine";
public EntitiesDB entitiesDB { set; private get; }
public void Dispose() {}
public void Ready() {}
public float3 GetPlayerLocation(uint playerId)
{
return entitiesDB.QueryEntity<RigidBodyEntityStruct>(playerId, CharacterExclusiveGroups.OnFootGroup).position;
}
}
}