(Re)load blueprints from file, t3 shields
Blueprints can be loaded and reloaded from a file in the game's directory except in a release version
This commit is contained in:
parent
5bc0351bd1
commit
ab169fb87c
3 changed files with 20 additions and 4 deletions
|
@ -17,8 +17,15 @@ namespace Pixi.Common
|
||||||
|
|
||||||
public static Dictionary<string, BlockJsonInfo[]> ParseBlueprintResource(string name)
|
public static Dictionary<string, BlockJsonInfo[]> ParseBlueprintResource(string name)
|
||||||
{
|
{
|
||||||
StreamReader bluemap = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(name));
|
StreamReader bluemap;
|
||||||
return JsonConvert.DeserializeObject<Dictionary<string, BlockJsonInfo[]>>(bluemap.ReadToEnd());
|
#if DEBUG
|
||||||
|
if (File.Exists(name))
|
||||||
|
bluemap = File.OpenText(name);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
bluemap = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(name));
|
||||||
|
using (bluemap)
|
||||||
|
return JsonConvert.DeserializeObject<Dictionary<string, BlockJsonInfo[]>>(bluemap.ReadToEnd());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ProcessedVoxelObjectNotation[][] ProcessAndExpandBlocks(string name, BlockJsonInfo[] blocks, BlueprintProvider blueprints)
|
public static ProcessedVoxelObjectNotation[][] ProcessAndExpandBlocks(string name, BlockJsonInfo[] blocks, BlueprintProvider blueprints)
|
||||||
|
|
|
@ -47,12 +47,14 @@ namespace Pixi
|
||||||
root.Inject(new ImageTextBlockImporter());
|
root.Inject(new ImageTextBlockImporter());
|
||||||
root.Inject(new ImageCommandImporter());
|
root.Inject(new ImageCommandImporter());
|
||||||
// Robot functionality
|
// Robot functionality
|
||||||
root.Inject(new RobotInternetImporter());
|
var robot = new RobotInternetImporter();
|
||||||
|
root.Inject(robot);
|
||||||
//RobotCommands.CreateRobotCRFCommand();
|
//RobotCommands.CreateRobotCRFCommand();
|
||||||
//RobotCommands.CreateRobotFileCommand();
|
//RobotCommands.CreateRobotFileCommand();
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// Development functionality
|
// Development functionality
|
||||||
RobotCommands.CreatePartDumpCommand();
|
RobotCommands.CreatePartDumpCommand();
|
||||||
|
((RobotBlueprintProvider) robot.BlueprintProvider).AddReloadCommand();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ using Unity.Mathematics;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
using GamecraftModdingAPI.Blocks;
|
using GamecraftModdingAPI.Blocks;
|
||||||
|
using GamecraftModdingAPI.Commands;
|
||||||
using GamecraftModdingAPI.Utility;
|
using GamecraftModdingAPI.Utility;
|
||||||
using Pixi.Common;
|
using Pixi.Common;
|
||||||
|
|
||||||
|
@ -96,5 +97,11 @@ namespace Pixi.Robots
|
||||||
}
|
}
|
||||||
return adjustedBlueprint;
|
return adjustedBlueprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddReloadCommand()
|
||||||
|
{
|
||||||
|
CommandBuilder.Builder("PixiReload", "Reloads the robot blueprints")
|
||||||
|
.Action(() => botprints = null).Build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue