• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

Carbon Copy plugin for VS


Commit MetaInfo

Revision2bd43bf791833937d7ad584005508e3be5d5c9dd (tree)
Time2021-11-10 07:36:38
Authormelchior <melchior@user...>
Commitermelchior

Log Message

select bugfix, msg improvements

Bugfix for Selection box, not matching exported area.
Somewhat improved command feedback messages.

Change Summary

Incremental Difference

--- a/CarbonCopy/CarbonCopy.csproj
+++ b/CarbonCopy/CarbonCopy.csproj
@@ -20,7 +20,7 @@
2020 <ConsolePause>false</ConsolePause>
2121 <CustomCommands>
2222 <CustomCommands>
23- <Command type="AfterBuild" command="7z -tzip a Carboncopy_${ProjectConfig}.zip" workingdir="${TargetDir}" />
23+ <Command type="AfterBuild" command="7z a -tzip -x!*.zip -aoa CarbonCopy_${ProjectConfig}.zip" workingdir="${TargetDir}" />
2424 <Command type="AfterClean" command="rm -f *.zip" workingdir="${TargetDir}" />
2525 </CustomCommands>
2626 </CustomCommands>
--- a/CarbonCopy/ClientCommands/CarbonCopyCommand.cs
+++ b/CarbonCopy/ClientCommands/CarbonCopyCommand.cs
@@ -39,7 +39,7 @@ namespace CarbonCopy
3939 public CarbonCopyCommand(ICoreClientAPI clientAPI)
4040 {
4141 this.Command = _name;
42- this.Syntax = @"mark: start/end/ (x/y/z), save [name], clear; dump [items/blocks] [domain?]";
42+ this.Syntax = @"mark[ start/end(x/y/z) ], save [name], clear; dump [items/blocks] [domain?]";
4343 this.Description = @"Export carbon-copies of block selections locally.(as json export schematic) - also Block info...";
4444
4545 ClientAPI = clientAPI;
@@ -57,7 +57,7 @@ namespace CarbonCopy
5757 * mark start z+20
5858 * mark clear
5959 * save {NAME}
60- *
60+ * dump blocks/items
6161 *
6262 */
6363
@@ -95,7 +95,7 @@ namespace CarbonCopy
9595 break;
9696
9797 default:
98- ClientAPI.ShowChatMessage($"Unrecognised command: {command}");
98+ ClientAPI.ShowChatMessage($"Unrecognised command: '{command}' - try 'mark/save/clear'...");
9999 break;
100100 }
101101 }
@@ -117,7 +117,7 @@ namespace CarbonCopy
117117 }
118118 BendBlockPosition(this.start, args);
119119
120- ClientAPI.ShowChatMessage(string.Format("Marked start; ({0}).", start));
120+ ClientAPI.ShowChatMessage(string.Format("Start@ ({0}).", start));
121121 break;
122122
123123 case "end":
@@ -126,11 +126,11 @@ namespace CarbonCopy
126126 }
127127 BendBlockPosition(this.end, args);
128128
129- ClientAPI.ShowChatMessage(string.Format("Marked end; ({0}).", end));
129+ ClientAPI.ShowChatMessage(string.Format("End@ ({0}).", end));
130130 break;
131131
132132 default:
133- ClientAPI.ShowChatMessage("Mark: start or end ?");
133+ ClientAPI.ShowChatMessage("Mark synax: start or end");
134134 break;
135135 }
136136
@@ -138,61 +138,64 @@ namespace CarbonCopy
138138
139139 if (this.start != null &&
140140 this.end != null &&
141- ClientAPI.World.BulkBlockAccessor.IsValidPos(this.start) &&
142- ClientAPI.World.BulkBlockAccessor.IsValidPos(this.end)
141+ ClientAPI.World.BulkBlockAccessor.IsValidPos(this.start)
142+ && ClientAPI.World.BulkBlockAccessor.IsValidPos(this.end)
143143 ) {
144144
145145 //Calc. Vol:
146146 var size = start.DistanceTo(end);
147147
148148 if (size > 1) {
149-
150149 this.validSelection = true;
151-
152150 this.markedBlocks.Clear( );
153151
154152 ClientAPI.World.BulkBlockAccessor.WalkBlocks(start, end, addToMarked);
155153
156154 ClientAPI.World.HighlightBlocks(ClientAPI.World.Player, _highlightSlot, this.markedBlocks, colorList, EnumHighlightBlocksMode.Absolute, EnumHighlightShape.Arbitrary);
157155
158- ClientAPI.ShowChatMessage(string.Format("Marked area: {0:f1}diag = {1} blocks", size, markedBlocks.Count));
156+ int X = Math.Abs(start.X - end.X) + 1;
157+ int Y = Math.Abs(start.Y - end.Y) + 1;
158+ int Z = Math.Abs(start.Z - end.Z) + 1;
159+
160+ ClientAPI.ShowChatMessage($"Marked (X {X:#},Y {Y:#} ,Z {Z:#} ) {size:f1} diagonal = {markedBlocks.Count} cells");
159161 }
160162 else {
161- ClientAPI.ShowChatMessage("Marked area: volume too small"); ;
162- }
163+ ClientAPI.ShowChatMessage("Marked area: volume too small");
163164 }
165+ }
164166 }
165167 else {
166- ClientAPI.ShowChatMessage("Mark: start / end (x,y,z +-1#)");
168+ ClientAPI.ShowChatMessage("(Needs args) Mark: start / end (x,y,z +-1#)");
167169 }
168170
169171 }
170172
171173 private void BendBlockPosition(BlockPos position, CmdArgs args)
172174 {
173- char? axis = args.PopChar( );
174- int? offset = args.PopInt( );
175+ if (args.Length == 0) return;
176+ char? axis = args.PopChar();
177+ int? offset = args.PopInt();
175178
176- if (axis.HasValue && offset.HasValue) {
179+ if (axis.HasValue && offset.HasValue) {
177180 switch (Char.ToLowerInvariant(axis.Value)) {
178181
179- case 'x':
180- ClientAPI.ShowChatMessage(string.Format("applied X offset {0},", offset.Value));
182+ case 'x':
181183 position.Add(dx: offset.Value, dy: 0, dz: 0);
184+ ClientAPI.ShowChatMessage(string.Format("altered {0}, offset {1}", axis.Value, offset.Value));
182185 break;
183186
184- case 'y':
185- ClientAPI.ShowChatMessage(string.Format("applied Y offset {0},", offset.Value));
187+ case 'y':
186188 position.Add(dx: 0, dy: offset.Value, dz: 0);
189+ ClientAPI.ShowChatMessage(string.Format("altered {0}, offset {1}", axis.Value, offset.Value));
187190 break;
188191
189- case 'z':
190- ClientAPI.ShowChatMessage(string.Format("applied Z offset {0},", offset.Value));
192+ case 'z':
191193 position.Add(dx: 0, dy: 0, dz: offset.Value);
194+ ClientAPI.ShowChatMessage(string.Format("altered {0}, offset {1}", axis.Value, offset.Value));
192195 break;
193196
194197 default:
195- //Nothing to do.
198+ ClientAPI.ShowChatMessage("Can't apply offset; not in \"x, y, z +1#\" form...");
196199 break;
197200 }
198201 }
@@ -206,16 +209,30 @@ namespace CarbonCopy
206209 private void Process_SaveCommand(string filename)
207210 {
208211 if (validSelection) {
209-
210212 BlockSchematic blockExport = new BlockSchematic( );
213+ //Random Start / End
211214
212- blockExport.Init(ClientAPI.World.BlockAccessor);
215+ //'Lower'-> South + Westmost corner of same volume
216+ BlockPos seCorner = new BlockPos(Math.Max(start.X, end.X), Math.Min(start.Y, end.Y), Math.Max(start.Z, end.Z));
217+ //'Upper'-> North + Eastmost corner of same volume
218+ BlockPos nwCorner = new BlockPos(Math.Min(start.X, end.X), Math.Max(start.Y, end.Y), Math.Min(start.Z, end.Z));
219+
220+ //diagonal 'left'; offset into 'upper' - adds corner
221+ nwCorner.Up();
213222
214- blockExport.AddArea(ClientAPI.World, this.start, this.end);
223+ seCorner.X += 1;
224+ seCorner.Z += 1;
225+
226+ blockExport.Init(ClientAPI.World.BlockAccessor);
227+ #if DEBUG
228+ Logger.Debug("Start: {0}, End:{1}", start, end);
229+ Logger.Debug("S.E C: {0}, N.W:{1} (offset)", seCorner, nwCorner);
230+ #endif
231+ blockExport.AddArea(ClientAPI.World, seCorner, nwCorner);//Off by 1 in XYZ
215232
216- if (blockExport.Pack(ClientAPI.World, this.start))//What should start Be?
233+ if (blockExport.Pack(ClientAPI.World, seCorner))//?
217234 {
218- ClientAPI.ShowChatMessage(string.Format("Export packed OK: {0} Blocks {1} Entities {2} BlockEntity", blockExport.BlockIds.Count, blockExport.Entities.Count, blockExport.BlockEntities.Count));
235+ ClientAPI.ShowChatMessage(string.Format("Export packed OK: {0} BlockIDs, {1}, Entities, {2} BlockEntities; ({3} total blocks)", blockExport.BlockIds.Count, blockExport.Entities.Count, blockExport.BlockEntities.Count, blockExport.Indices.Count));
219236
220237 filename = Path.Combine(ClientAPI.GetOrCreateDataPath(_exportPath), filename);
221238
--- a/CarbonCopy/modinfo.json
+++ b/CarbonCopy/modinfo.json
@@ -1,12 +1,12 @@
11 {
22 "type": "code",
33 "name": "Carbon-Copy",
4- "description" : "Export schematics, and more from SP/MP (clientside!)",
4+ "description" : "Replicate builds, and more from SP/MP (clientside!)",
55 "authors": ["Melchior"],
6- "version": "0.1.6",
6+ "version": "0.1.7",
77 "side": "client",
88 "dependencies": {
9- "game": "1.13.0"
9+ "game": "1.15.0"
1010 },
1111 "website": "http://nowebsite.nope"
1212 }
\ No newline at end of file