// This patch fixes the Attachment Nodes definitions for the
// Procedural parts, fixing the following issues:
//
// * https://github.com/net-lisias-ksp/KSP-Recall/issues/41
// * https://github.com/KSP-CKAN/NetKAN/pull/9076
// Related, but not merged, to
// * https://github.com/KSP-RO/ProceduralParts/issues/315
//
@PART[*]:HAS[@MODULE[ProceduralShape*]]:NEEDS[KSPRECALL-PROCEDURALPARTS-AN]:FINAL
{
	@node_stack_top    = 0,  1, 0, 0,  1, 0, 1
	@node_stack_bottom = 0, -1, 0, 0, -1, 0, 1

	%xxxValue = #$MODULE[ProceduralShape*],0/length$
	@xxxValue /= 2
	@node_stack_top,0[1] = #$xxxValue$

	@xxxValue *= -1
	@node_stack_bottom,0[1] = #$xxxValue$

	-xxxValue = dummy
}

// If the user didn't configured the KSP-Recall to patch all Procedural Parts, only
// parts with AttachedOnEditor will be patched (if any, someone else need to add
// AttachedOnEditor on the part first!).
// This is done as a fail safe situation where AttachedOnEditor was injected on a
// Procedural Part by 3rd Parties, as KSP-Recall, at least to this moment, don't do it.
//
@PART[*]:HAS[@MODULE[AttachedOnEditor],@MODULE[ProceduralShape*]]:NEEDS[!KSPRECALL-PROCEDURALPARTS-AN]:FINAL
{
	@node_stack_top    = 0,  1, 0, 0,  1, 0, 1
	@node_stack_bottom = 0, -1, 0, 0, -1, 0, 1

	%xxxValue = #$MODULE[ProceduralShape*],0/length$
	@xxxValue /= 2
	@node_stack_top,0[1] = #$xxxValue$

	@xxxValue *= -1
	@node_stack_bottom,0[1] = #$xxxValue$

	-xxxValue = dummy
}
