Add fuelline and strut

pull/630/head^2
Andrew Cassidy 5 years ago
parent 1ba8caa1ac
commit 17f73a1c05
No known key found for this signature in database
GPG Key ID: 963017B38FD477A1

@ -1 +1 @@
Subproject commit c40a3155dbfcdcb8d1f37cd6cd9ed4129f703124
Subproject commit 68fc76619b93ad0c262b119bc382a1f8813ee0c6

@ -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

@ -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
}
}
}
}

@ -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
}
}
}
}

@ -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()
{

Loading…
Cancel
Save