Electrical wires not being copiedSolved
what ?
var linePoints = new List<Vector3>();
if (output.linePoints != null)
{
// Since Vector3 is struct should be able to simply save the Vecot directly.
foreach (Vector3 linePoint in output.linePoints)
{
linePoints.Add(NormalizePosition(copyData.SourcePos, linePoint, copyData.RotCor));
}
}
ioConnection.Add("linePoints", linePoints);can be replaced with:
ioConnection.Add("linePoints", output.linePoints ?? new List<Vector3>); WhiteDragon
I failed to direct that statement at the plugin owner. In EntityData():var linePoints = new List<Vector3>(); if (output.linePoints != null) { // Since Vector3 is struct should be able to simply save the Vecot directly. foreach (Vector3 linePoint in output.linePoints) { linePoints.Add(NormalizePosition(copyData.SourcePos, linePoint, copyData.RotCor)); } } ioConnection.Add("linePoints", linePoints);
can be replaced with:ioConnection.Add("linePoints", output.linePoints ?? new List<Vector3>);
Very interesting! I made some sort of mistake though because when compiling, it gives me this error:
(22:41:21) | Error while compiling: CopyPaste.cs(722,89): error CS1525: Unexpected symbol `)', expecting `(', `[', or `{'
(22:43:11) | Error while compiling: CopyPaste.cs(722,89): error CS1525: Unexpected symbol `)', expecting `(', `[', or `{'My code is this one:
List<object> outputs = new List<object>();
foreach (IOEntity.IOSlot output in ioEntity.outputs)
{
Dictionary<string, object> ioConnection = new Dictionary<string, object>
{
{"connectedID", output.connectedTo.entityRef.uid },
{"connectedToSlot", output.connectedToSlot },
{"niceName", output.niceName },
{"type", (int)output.type },
};
// var linePoints = new List<Vector3>();
//if (output.linePoints != null)
//{
// Since Vector3 is struct should be able to simply save the Vecot directly.
// foreach (Vector3 linePoint in output.linePoints)
// {
// linePoints.Add(NormalizePosition(copyData.SourcePos, linePoint, copyData.RotCor));
// }
//}
ioConnection.Add("linePoints", output.linePoints ?? new List<Vector3>);
//correction for the electric cables made by whitedragon
outputs.Add(ioConnection);
}
ioData.Add("outputs", outputs);
ioData.Add("oldID", ioEntity.net.ID);
var electricalBranch = ioEntity as ElectricalBranch;Where the heck I did the mistake?? :D
ioConnection.Add("linePoints", output.linePoints?.ToList() ?? new List<Vector3>());Similarly, replace the following in PasteLoop():
// Get the relative positions (normalized) and convert it to an actual position.
var normalizedPos =
pasteData.QuaternionRotation * (new Vector3(
Convert.ToSingle(linePoint["x"]),
Convert.ToSingle(linePoint["y"]) + pasteData.HeightAdj,
Convert.ToSingle(linePoint["z"]))) + pasteData.StartPos;
lineList.Add(normalizedPos);With this:
lineList.Add(new Vector3(
Convert.ToSingle(linePoint["x"]),
Convert.ToSingle(linePoint["y"]),
Convert.ToSingle(linePoint["z"]))); Herbcan we go back to the original problem ? i dont understand one word
If you don't know how to copy/paste and how to search chunks of code inside a file, maybe you better don't try to modify the plugin. Basically you have to search for the piece of code and replace with the one given by WhiteDragon. You have to do this thing in thee *.cs file, then upload it in your server and make it start again keeping in mind what has been said about the buildings copied BEFORE the modification.
But then again: if you don't know how to copy/paste and how to search chunks of code inside a file, maybe you better don't try to modify the plugin.
You risk to break the plugin.
WhiteDragon
There was an error in my fix. I have updated it:ioConnection.Add("linePoints", output.linePoints?.ToList() ?? new List<Vector3>());Similarly, replace the following in PasteLoop():
// Get the relative positions (normalized) and convert it to an actual position. var normalizedPos = pasteData.QuaternionRotation * (new Vector3( Convert.ToSingle(linePoint["x"]), Convert.ToSingle(linePoint["y"]) + pasteData.HeightAdj, Convert.ToSingle(linePoint["z"]))) + pasteData.StartPos; lineList.Add(normalizedPos);
With this:lineList.Add(new Vector3( Convert.ToSingle(linePoint["x"]), Convert.ToSingle(linePoint["y"]), Convert.ToSingle(linePoint["z"])));
Thank you for your correction! :-D I will try to update the plugin later. And ok... The past buildings can be sacrificed if the new ones have the correct wiring showing up! Big Thumb Up!
:-)Merged post
Holy Cow! It works like a charm!!! :-D
Dear sir, WhiteDragon, thank you 1024 times! ^__^
i was just reporting bugs
Herbi was just reporting bugs
" i dont understand one word" does not seem to me as "reporting bug" but hey... Whatever. :-D
And if you do know how to handle them, then what is the problem? Just paste the code provided into the proper file.