• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Automap (client) [VS plugin mod]


Commit MetaInfo

Revision9ff3843035f5a07a42fb9a60b5352494aa875a8f (tree)
Time2020-02-24 03:36:03
AuthorThe Grand Dog <alex.h@me.c...>
CommiterThe Grand Dog

Log Message

prep Metadata.js for ViewFrame, bug fix with POI positions

Change Summary

Incremental Difference

--- a/Automap/Subsystems/AutomapSystem.cs
+++ b/Automap/Subsystems/AutomapSystem.cs
@@ -92,10 +92,12 @@ namespace Automap
9292
9393 ClientAPI.Event.ChunkDirty += ChunkAChanging;
9494
95- cartographer_thread = new Thread(Cartographer);
96- cartographer_thread.Name = "Cartographer";
97- cartographer_thread.Priority = ThreadPriority.Lowest;
98- cartographer_thread.IsBackground = true;
95+ cartographer_thread = new Thread(Cartographer)
96+ {
97+ Name = "Cartographer",
98+ Priority = ThreadPriority.Lowest,
99+ IsBackground = true
100+ };
99101
100102 ClientAPI.Event.RegisterGameTickListener(AwakenCartographer, 6000);
101103 }
@@ -308,21 +310,6 @@ namespace Automap
308310 tableWriter.Write(stylesFile.ToText());
309311 tableWriter.RenderEndTag();//</style>
310312
311- //## JSON map-state data ######################
312- tableWriter.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
313- tableWriter.RenderBeginTag(HtmlTextWriterTag.Script);
314-
315- tableWriter.Write("var available_images = [");
316-
317- foreach (var shard in this.chunkTopMetadata)
318- {
319- tableWriter.Write("{{X:{0},Y:{1} }}, ", shard.Location.X, shard.Location.Y);
320- }
321-
322- tableWriter.Write(" ];\n");
323-
324- tableWriter.RenderEndTag();
325-
326313 tableWriter.RenderEndTag();
327314
328315 tableWriter.RenderBeginTag(HtmlTextWriterTag.Body);
@@ -507,57 +494,58 @@ namespace Automap
507494 StreamWriter jsonWriter = new StreamWriter(jsonFilename, false, Encoding.UTF8);
508495 using (jsonWriter)
509496 {
510- jsonWriter.WriteLine("var worldSeedNum = {0};", ClientAPI.World.Seed);
511- jsonWriter.WriteLine("var genTime = new Date('{0}');", DateTimeOffset.UtcNow.ToString("O"));
512- jsonWriter.WriteLine("var startCoords = {{X:{0},Y:{1}}};", startChunkColumn.X, startChunkColumn.Y);
513- jsonWriter.WriteLine("var chunkSize = {0};", chunkSize);
514- jsonWriter.WriteLine("var northMostChunk ={0};", chunkTopMetadata.North_mostChunk);
515- jsonWriter.WriteLine("var southMostChunk ={0};", chunkTopMetadata.South_mostChunk);
516- jsonWriter.WriteLine("var eastMostChunk ={0};", chunkTopMetadata.East_mostChunk);
517- jsonWriter.WriteLine("var westMostChunk ={0};", chunkTopMetadata.West_mostChunk);
497+ jsonWriter.Write("ViewFrame.chunks={};");
498+ jsonWriter.Write("ViewFrame.chunks.worldSeedNum={0};", ClientAPI.World.Seed);
499+ jsonWriter.Write("ViewFrame.chunks.genTime=new Date('{0}');", DateTimeOffset.UtcNow.ToString("O"));
500+ jsonWriter.Write("ViewFrame.chunks.startCoords=[{0},{1}];", startChunkColumn.X, startChunkColumn.Y);
501+ jsonWriter.Write("ViewFrame.chunks.chunkSize={0};", chunkSize);
502+ jsonWriter.Write("ViewFrame.chunks.northMostChunk={0};", chunkTopMetadata.North_mostChunk);
503+ jsonWriter.Write("ViewFrame.chunks.southMostChunk={0};", chunkTopMetadata.South_mostChunk);
504+ jsonWriter.Write("ViewFrame.chunks.eastMostChunk={0};", chunkTopMetadata.East_mostChunk);
505+ jsonWriter.Write("ViewFrame.chunks.westMostChunk={0};", chunkTopMetadata.West_mostChunk);
518506 //MAP object format - [key, value]: key is "x_y"
519- jsonWriter.Write("let shardsMetadata = new Map([");
507+ jsonWriter.Write("ViewFrame.chunks.chunkMetadata=new Map([");
520508 foreach (var shard in chunkTopMetadata)
521509 {
522510 jsonWriter.Write("['{0}_{1}',", shard.Location.X, shard.Location.Y);
523511 jsonWriter.Write("{");
524- jsonWriter.Write("ChunkAge: '{0}',", shard.ChunkAge);//World age - relative? or last edit ??
525- jsonWriter.Write("Temperature: {0},", shard.Temperature.ToString("F1"));
526- jsonWriter.Write("YMax: {0},", shard.YMax);
527- jsonWriter.Write("Fertility: {0},", shard.Fertility.ToString("F1"));
528- jsonWriter.Write("ForestDensity: {0},", shard.ForestDensity.ToString("F1"));
529- jsonWriter.Write("Rainfall: {0},", shard.Rainfall.ToString("F1"));
530- jsonWriter.Write("ShrubDensity: {0},", shard.ShrubDensity.ToString("F1"));
531- jsonWriter.Write("AirBlocks: {0},", shard.AirBlocks);
532- jsonWriter.Write("NonAirBlocks: {0},", shard.NonAirBlocks);
512+ jsonWriter.Write("chunkAge:'{0}',", shard.ChunkAge.ToString("g"));//World age - relative? or last edit ??
513+ jsonWriter.Write("temp:{0},", shard.Temperature.ToString("F1"));
514+ jsonWriter.Write("YMax:{0},", shard.YMax);
515+ jsonWriter.Write("fert:{0},", shard.Fertility.ToString("F1"));
516+ jsonWriter.Write("forestDens:{0},", shard.ForestDensity.ToString("F1"));
517+ jsonWriter.Write("rain:{0},", shard.Rainfall.ToString("F1"));
518+ jsonWriter.Write("shrubDens:{0},", shard.ShrubDensity.ToString("F1"));
519+ jsonWriter.Write("airBlocks:{0},", shard.AirBlocks);
520+ jsonWriter.Write("nonAirBlocks:{0},", shard.NonAirBlocks);
533521 //TODO: Heightmap
534522 //TODO: Rock-ratio
535523 jsonWriter.Write("}],");
536524 }
537- jsonWriter.Write("]);\n\n");
525+ jsonWriter.Write("]);");
538526
539527
540- jsonWriter.Write("let pointsOfInterest = new Map([");
528+ jsonWriter.Write("ViewFrame.chunks.pointsOfInterest = new Map([");
541529 foreach (var poi in POIs)
542530 {
543- jsonWriter.Write("['{0}_{1}',", poi.Location.X, poi.Location.Y);
531+ jsonWriter.Write("['{0}_{1}',", poi.Location.X, poi.Location.Z);
544532 jsonWriter.Write("{");
545- jsonWriter.Write("notes: '{0}',", poi.Notes.Replace("'", " "));
546- jsonWriter.Write("timestamp : new Date('{0}'),", poi.Timestamp.ToString("O"));
547- jsonWriter.Write("chunkPos:'{0}_{1}',", (poi.Location.X / chunkSize), (poi.Location.Y / chunkSize));
533+ jsonWriter.Write("notes:'{0}',", poi.Notes.Replace("'", "\'").Replace("\n","\\n"));
534+ jsonWriter.Write("time:new Date('{0}'),", poi.Timestamp.ToString("O"));
535+ jsonWriter.Write("chunkPos:'{0}_{1}',", (poi.Location.X / chunkSize), (poi.Location.Z / chunkSize));
548536 jsonWriter.Write("}],");
549537 }
550538
551539 foreach (var poi in EOIs.PointsList)
552540 {
553- jsonWriter.Write("['{0}_{1}',", poi.Location.X, poi.Location.Y);
541+ jsonWriter.Write("['{0}_{1}',", poi.Location.X, poi.Location.Z);
554542 jsonWriter.Write("{");
555- jsonWriter.Write("notes: '{0}',", poi.Notes.Replace("'", " "));
556- jsonWriter.Write("timestamp : new Date('{0}'),", poi.Timestamp.ToString("O"));
557- jsonWriter.Write("chunkPos:'{0}_{1}',", (poi.Location.X / chunkSize), (poi.Location.Y / chunkSize));
543+ jsonWriter.Write("notes:'{0}',", poi.Notes.Replace("'", "\'"));
544+ jsonWriter.Write("time:new Date('{0}'),", poi.Timestamp.ToString("O"));
545+ jsonWriter.Write("chunkPos:'{0}_{1}',", (poi.Location.X / chunkSize), (poi.Location.Z / chunkSize));
558546 jsonWriter.Write("}],");
559547 }
560- jsonWriter.Write("]);\n\n");
548+ jsonWriter.Write("]);");
561549
562550 jsonWriter.Flush();
563551 }