diff --git a/Assets/CineboxAndrew b/Assets/CineboxAndrew index c40a3155..68fc7661 160000 --- a/Assets/CineboxAndrew +++ b/Assets/CineboxAndrew @@ -1 +1 @@ -Subproject commit c40a3155dbfcdcb8d1f37cd6cd9ed4129f703124 +Subproject commit 68fc76619b93ad0c262b119bc382a1f8813ee0c6 diff --git a/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-compoundparts-1-n.dds b/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-compoundparts-1-n.dds new file mode 100644 index 00000000..32a3ca87 Binary files /dev/null and b/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-compoundparts-1-n.dds differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-compoundparts-1.dds b/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-compoundparts-1.dds new file mode 100644 index 00000000..419cefcc Binary files /dev/null and b/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-compoundparts-1.dds differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-fuelline-1.mu b/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-fuelline-1.mu new file mode 100644 index 00000000..bef323b3 Binary files /dev/null and b/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-fuelline-1.mu differ diff --git a/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-strut-1.mu b/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-strut-1.mu new file mode 100644 index 00000000..92c13af1 Binary files /dev/null and b/Distribution/Restock/GameData/ReStock/Assets/CompoundParts/restock-strut-1.mu differ diff --git a/Distribution/Restock/GameData/ReStock/Localization/en-us.cfg b/Distribution/Restock/GameData/ReStock/Localization/en-us.cfg index f37e5be4..f31f3b80 100644 --- a/Distribution/Restock/GameData/ReStock/Localization/en-us.cfg +++ b/Distribution/Restock/GameData/ReStock/Localization/en-us.cfg @@ -16,6 +16,7 @@ Localization #LOC_Restock_variant-engine_radial = Radial #LOC_Restock_variant-engine_boattail = Boattail + #LOC_Restock_variant-mounting_classic = Classic #LOC_Restock_variant-mounting_truss = Truss #LOC_Restock_variant-mounting_compact = Compact @@ -32,6 +33,8 @@ Localization #LOC_Restock_variant-antenna_axial_reverse = Axial (Reversed) #LOC_Restock_variant-surface_metal = Metal + #LOC_Restock_variant-surface_yellow = Yellow + #LOC_Restock_variant-surface_black = Black #LOC_Restock_variant-service-bay-opaque = Solid Caps #LOC_Restock_variant-service-bay-transparent = Truss Caps diff --git a/Distribution/Restock/GameData/ReStock/Patches/CompoundParts/restock-fuelline.cfg b/Distribution/Restock/GameData/ReStock/Patches/CompoundParts/restock-fuelline.cfg new file mode 100644 index 00000000..af0d7baa --- /dev/null +++ b/Distribution/Restock/GameData/ReStock/Patches/CompoundParts/restock-fuelline.cfg @@ -0,0 +1,101 @@ +// Patches applying art changes to the fuel line +// Contents: +// - FTX-2 External Fuel Duct (fuelLine) + +// FTX-2 External Fuel Duct +@PART[fuelLine] +{ + @author = Andrew Cassidy + + !mesh = DELETE + MODEL + { + model = ReStock/Assets/CompoundParts/restock-fuelline-1 + } + rescaleFactor = 1.0 + !scale = DELETE + + !MODULE[CModuleLinkedMesh] {} + MODULE + { + name = ModuleRestockLinkedMesh + lineObjName = line + mainAnchorName = pipe_main_anchor + targetAnchorName = pipe_target_anchor + anchorCapName = pipe_main_cap + targetCapName = pipe_target_cap + targetColliderName = pipe_target_SPHERECOLLIDER + stretchAxis = x + stretchTextures = _MainTex _BumpMap + } + + MODULE + { + name = ModulePartVariants + useMultipleDragCubes = false + baseVariant = Yellow + VARIANT + { + name = Yellow + displayName = #LOC_Restock_variant-surface_yellow + themeName = YellowAndWhite + primaryColor = #B08D43 + secondaryColor = #999999 + GAMEOBJECTS + { + line_yellow = true + line_black = false + line_metal = false + line_sofi = false + } + } + + VARIANT + { + name = Black + displayName = #LOC_Restock_variant-surface_black + themeName = Dark + primaryColor = #4c4f47 + secondaryColor = #999999 + GAMEOBJECTS + { + line_yellow = false + line_black = true + line_metal = false + line_sofi = false + } + } + + VARIANT + { + name = Metal // 🤘 + displayName = #LOC_Restock_variant-surface_metal + themeName = Metal + primaryColor = #6f6e6d + secondaryColor = #999999 + GAMEOBJECTS + { + line_yellow = false + line_black = false + line_metal = true + line_sofi = false + } + } + + VARIANT + { + name = Orange + displayName = #autoLOC_8007123 + themeName = Orange + primaryColor = #B08D43 + secondaryColor = #999999 + GAMEOBJECTS + { + line_yellow = false + line_black = false + line_metal = false + line_sofi = true + } + } + } +} diff --git a/Distribution/Restock/GameData/ReStock/Patches/CompoundParts/restock-strut.cfg b/Distribution/Restock/GameData/ReStock/Patches/CompoundParts/restock-strut.cfg new file mode 100644 index 00000000..6d3b63f0 --- /dev/null +++ b/Distribution/Restock/GameData/ReStock/Patches/CompoundParts/restock-strut.cfg @@ -0,0 +1,69 @@ +// Patches applying art changes to the strut +// Contents: +// - EAS-4 Strut Connector (strutConnector) + +// EAS-4 Strut Connector +@PART[strutConnector] +{ + @author = Andrew Cassidy + + !mesh = DELETE + MODEL + { + model = ReStock/Assets/CompoundParts/restock-strut-1 + } + rescaleFactor = 1.0 + !scale = DELETE + + !MODULE[CModuleLinkedMesh] {} + MODULE + { + name = ModuleRestockLinkedMesh + lineObjName = strut + mainAnchorName = strut_main_anchor + targetAnchorName = strut_target_anchor + anchorCapName = strut_main_cap + targetCapName = strut_target_cap + targetColliderName = strut_target_SPHERECOLLIDER + stretchAxis = x + stretchTextures = _MainTex _BumpMap + } + + MODULE + { + name = ModulePartVariants + useMultipleDragCubes = false + baseVariant = Classic + VARIANT + { + name = Classic + displayName = #LOC_Restock_variant-mounting_classic + themeName = White + primaryColor = #6f6e6d + secondaryColor = #999999 + GAMEOBJECTS + { + strut_main_body_classic = true + strut_target_body_classic = true + strut_main_body_compact = false + strut_target_body_compact = false + } + } + + VARIANT + { + name = Compact + displayName = #LOC_Restock_variant-mounting_compact + themeName = White + primaryColor = #6f6e6d + secondaryColor = #999999 + GAMEOBJECTS + { + strut_main_body_classic = false + strut_target_body_classic = false + strut_main_body_compact = true + strut_target_body_compact = true + } + } + } +} diff --git a/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll b/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll index 2481f09f..65beed8a 100644 Binary files a/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll and b/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll differ diff --git a/Source/Restock/ModuleRestockLinkedMesh.cs b/Source/Restock/ModuleRestockLinkedMesh.cs index bb9ef2e8..006e7419 100644 --- a/Source/Restock/ModuleRestockLinkedMesh.cs +++ b/Source/Restock/ModuleRestockLinkedMesh.cs @@ -9,11 +9,13 @@ namespace Restock public class ModuleRestockLinkedMesh : CModuleLinkedMesh { // the direction along the texture that the pipe points. set to "x" or "y" - [KSPField] public string stretchAxis = "x"; + [KSPField] + public string stretchAxis = "x"; // space-seperated list of textures to be effected by the length, preferably all of the ones on the material // Unity has no good way to get all the texture names attached to a material so it has to be set manually, unfortunately - [KSPField] public string stretchTextures = "_MainTex"; + [KSPField] + public string stretchTextures = "_MainTex"; // reference to the material we will be modifying @@ -57,8 +59,14 @@ namespace Restock // default to 'x' if an invalid value is used pipeStretchIndex = stretchAxis != "y" ? 0 : 1; - baseStretch = line.localScale.z; + baseStretch = part.scaleFactor; + GameEvents.onEditorVariantApplied.Add(OnVariantApplied); + } + + private void OnDestroy() + { + GameEvents.onEditorVariantApplied.Remove(OnVariantApplied); } public override void OnTargetSet(Part target) @@ -79,6 +87,12 @@ namespace Restock UpdateStretch(); } + public void OnVariantApplied(Part part, PartVariant variant) + { + UpdateStretch(); + } + + // updates the texture stretch to match the pipe object's local scale private void UpdateStretch() {