Merge branch 'ground' into develop

pull/767/head
Andrew Cassidy 5 years ago
commit 9ee549b29b
No known key found for this signature in database
GPG Key ID: 963017B38FD477A1

@ -1 +1 @@
Subproject commit 4ed21b89e8ab44cda6efbc7aae9634aa6b82af3a
Subproject commit c262ab1a8477caec6a2ef1961157aed5e2dbd3c5

@ -0,0 +1,166 @@
// Patches applying art changes to Landing Legs
// Contents:
// - LT-05 Micro Landing Strut (miniLandingLeg)
// - LT-1 Landing Strut (landingLeg1)
// - LT-2 Landing Strut (landingLeg1-2)
// LT-05 Micro Landing Strut
@PART[miniLandingLeg]
{
@author = Andrew Cassidy
!mesh = DELETE
MODEL
{
model = ReStock/Assets/Ground/restock-leg-1
}
@MODULE[ModuleWheelBase] {
@clipObject = leg1_piston_CAPSULECOLLIDER
}
@MODULE[ModuleWheelSuspension] {
@suspensionTransformName = leg1_piston
@suspensionColliderName = leg1_piston_CAPSULECOLLIDER
}
@MODULE[ModuleWheelDeployment] {
@animationTrfName = leg1
@animationStateName = restock-leg-1-deploy
@retractTransformName = leg1_piston
}
MODULE
{
name = ModulePartVariants
useMultipleDragCubes = false
baseVariant = Bare
VARIANT
{
name = Bare
displayName = #LOC_Restock_variant-probe-bare
primaryColor = #999999
secondaryColor = #999999
GAMEOBJECTS
{
leg1_body_gold = false
leg1_foot_gold = false
leg1_hydraulic_upper_1_gold = false
leg1_cylinder_gold = false
leg1_upper_arm_gold = false
leg1_body_silver = false
leg1_foot_silver = false
leg1_hydraulic_upper_1_silver = false
leg1_cylinder_silver = false
leg1_upper_arm_silver = false
}
}
VARIANT
{
name = Gold
displayName = #LOC_Restock_variant-probe-gold
themeName = Gold
primaryColor = #fccb0a
secondaryColor = #999999
GAMEOBJECTS
{
leg1_body_gold = true
leg1_foot_gold = true
leg1_hydraulic_upper_1_gold = true
leg1_cylinder_gold = true
leg1_upper_arm_gold = true
leg1_body_silver = false
leg1_foot_silver = false
leg1_hydraulic_upper_1_silver = false
leg1_cylinder_silver = false
leg1_upper_arm_silver = false
}
}
VARIANT
{
name = Silver
displayName = #LOC_Restock_variant-probe-silver
themeName = Silver
primaryColor = #cecece
secondaryColor = #999999
GAMEOBJECTS
{
leg1_body_gold = false
leg1_foot_gold = false
leg1_hydraulic_upper_1_gold = false
leg1_cylinder_gold = false
leg1_upper_arm_gold = false
leg1_body_silver = true
leg1_foot_silver = true
leg1_hydraulic_upper_1_silver = true
leg1_cylinder_silver = true
leg1_upper_arm_silver = true
}
}
}
}
// LT-1 Landing Strut
@PART[landingLeg1]
{
@author = Andrew Cassidy
!mesh = DELETE
MODEL
{
model = ReStock/Assets/Ground/restock-leg-2
}
@MODULE[ModuleWheelBase] {
@clipObject = leg2_piston_CAPSULECOLLIDER
}
@MODULE[ModuleWheelSuspension] {
@suspensionTransformName = leg2_piston
@suspensionColliderName = leg2_piston_CAPSULECOLLIDER
}
@MODULE[ModuleWheelDeployment] {
@animationTrfName = leg2
@animationStateName = restock-leg-2-deploy
@retractTransformName = leg2_piston
}
@MODULE[ModuleWheelBogey] {
@bogeyTransformName = leg2_foot
}
}
// LT-2 Landing Strut
@PART[landingLeg1-2]
{
@author = Andrew Cassidy
!mesh = DELETE
MODEL
{
model = ReStock/Assets/Ground/restock-leg-3
}
@MODULE[ModuleWheelBase] {
@clipObject = leg3_piston_CAPSULECOLLIDER
}
@MODULE[ModuleWheelSuspension] {
@suspensionTransformName = leg3_piston
@suspensionColliderName = leg3_piston_CAPSULECOLLIDER
}
@MODULE[ModuleWheelDeployment] {
@animationTrfName = leg3
@animationStateName = restock-leg-3-deploy
@retractTransformName = leg3_piston
}
@MODULE[ModuleWheelBogey] {
@bogeyTransformName = leg3_foot
}
}

@ -0,0 +1,28 @@
// Patches applying art changes to
// Contents:
// TT18-A Launch Stability Enhancer (launchClamp1)
// TT18-A Launch Stability Enhancer
@PART[launchClamp1]
{
@author = Andrew Cassidy
!mesh = DELETE
MODEL
{
model = ReStock/Assets/Structural/restock-launchclamp-1
}
!MODULE[LaunchClamp] {}
MODULE {
name = ModuleRestockLaunchClamp
trf_towerPivot_name = obj_girdercap
trf_towerStretch_name = obj_stretch
trf_towerGirder_name = obj_girder
trf_towerYoke_name = obj_yoke
trf_anchor_name = obj_ground
trf_animationRoot_name = restock-clamp-1
anim_decouple_name = RestockLaunchClamp_Deploy
}
}

@ -111,6 +111,10 @@ Squad/Parts/Utility/ServiceBay/
Squad/Parts/Utility/spotLightMk1/
Squad/Parts/Utility/spotLightMk2/
Squad/Parts/Utility/launchEscapeSystem/
Squad/Parts/Utility/launchClamp1/
Squad/Parts/Utility/landingLegLT-1/
Squad/Parts/Utility/landingLegLT-2/
Squad/Parts/Utility/landingLegLT-5/
Squad/Parts/Resources/RadialTank/
Squad/Parts/Resources/SmallTank/
Squad/Parts/Resources/LargeTank/

@ -29,6 +29,10 @@
- Kelus Mobility Enhancer (Nertea)
- Kelus-LV Bay Mobility Enhancer (Nertea)
- Launch Escape System (Andrew)
- Ground
- LT-05 Landing Strut (Andrew)
- LT-1 Landing Strut (Andrew)
- LT-2 Landing Strut (Andrew)
- Compound Parts
- FTX-2 External Fuel Duct (Andrew)
- EAS-4 Strut Connector (Andrew)

@ -0,0 +1,42 @@
// Proposed format:
// #LOC_RestockPlus_partconfigname_fieldname
// eg.
// #LOC_RestockPlus_restock-engine-375-3_title = ...
// #LOC_RestockPlus_restock-engine-375-3_description = ...
Localization
{
en-us
{
// ACTIONS AND BUTTONS
// ===================
#LOC_RestockRigidLegs_extend = Extend
#LOC_RestockRigidLegs_retract = Retract
#LOC_RestockRigidLegs_toggle = Toggle Leg
// PHYSICS MATERIALS
// ===================
#LOC_RestockRigidLegs_restock-low-grip = Low Grip
#LOC_RestockRigidLegs_restock-medium-grip = Medium Grip
#LOC_RestockRigidLegs_restock-high-grip = High Grip
#LOC_RestockRigidLegs_restock-extreme-grip = Extreme Grip
// LANDING LEGS
// ===================
#LOC_RestockRigidLegs_restock-leg-1-rigid_title = LTR-05 Micro Landing Strut
#LOC_RestockRigidLegs_restock-leg-1-rigid_description = After frustration with the recycled pogo sticks, erm, space-grade suspensions on the standard LT-05 landing struts, we developed this alternate version with the leg firmly superglued into place
#LOC_RestockRigidLegs_restock-leg-2-rigid_title = LTR-1 Landing Strut
#LOC_RestockRigidLegs_restock-leg-2-rigid_description = A larger rigid landing leg for medium sized craft, this landing leg is perfect for bounce-free landers or even small surface bases.
#LOC_RestockRigidLegs_restock-leg-3-rigid_title = LTR-2 Landing Strut
#LOC_RestockRigidLegs_restock-leg-3-rigid_description = While it appears similar to the LT-2 landing strut, this is actually a re-purposed outrigger from a mobile crane our engineers found next door. It was probably not needed.
#autoLOC_6011081 = Traction
}
}

@ -0,0 +1,145 @@
// ReStock+ 0.2.0
// Small Rigid Legs
PART
{
name = restock-leg-1-rigid
module = Part
author = Andrew Cassidy
MODEL
{
model = ReStock/Assets/Ground/restock-leg-1-rigid
}
rescaleFactor = 1.0
// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
attachRules = 1,1,0,0,0
node_attach = 0.0256775, 0.05144107, 0.0, 1.0, 0.0, 0.0
node_stack_bottom = 0.0945, 0.114, 0.0, 1.0, 0.0, 0.0, 0
TechRequired = survivability
entryCost = 820
cost = 200
mass = 0.015
category = Ground
subcategory = 0
title = #LOC_RestockRigidLegs_restock-leg-1-rigid_title // LTR-05 Micro Landing Strut
manufacturer = #autoLOC_501651 //#autoLOC_501651 = Moving Parts Experts Group
description = #LOC_RestockRigidLegs_restock-leg-1-rigid_description
// After frustration with the recycled pogo sticks, erm, space-grade suspensions on the standard LT-05 landing struts, we developed this alternate version with the leg firmly superglued into place
dragModelType = default
maximum_drag = 0.2
minimum_drag = 0.2
angularDrag = 2
crashTolerance = 20
maxTemp = 2000
bulkheadProfiles = srf
tags = #autoLOC_500875 //#autoLOC_500875 = ground land leg support
MODULE
{
name = ModuleAnimateGeneric
animationName = restock-leg-1-deploy-rigid
actionGUIName = #LOC_RestockRigidLegs_toggle // Toggle Leg
startEventGUIName = #LOC_RestockRigidLegs_extend // Extend
endEventGUIName = #LOC_RestockRigidLegs_retract // Retract
allowAnimationWhileShielded = False
allowDeployLimit = true
defaultActionGroup = Gear
}
MODULE
{
name = ModulePhysicMaterial
activePhysicMaterialName = restock-medium-grip
PhysicMaterialName = restock-low-grip
PhysicMaterialName = restock-medium-grip
PHYSICMATERIALCOLORS
{
MATERIALCOLOR
{
name = restock-low-grip
color = 1,1,1
}
MATERIALCOLOR
{
name = restock-medium-grip
color = 1,1,1
}
}
}
MODULE
{
name = ModulePartVariants
useMultipleDragCubes = false
baseVariant = Bare
VARIANT
{
name = Bare
displayName = #LOC_Restock_variant-probe-bare
primaryColor = #999999
secondaryColor = #999999
GAMEOBJECTS
{
leg1_body_gold = false
leg1_foot_gold = false
leg1_hydraulic_upper_1_gold = false
leg1_cylinder_gold = false
leg1_upper_arm_gold = false
leg1_body_silver = false
leg1_foot_silver = false
leg1_hydraulic_upper_1_silver = false
leg1_cylinder_silver = false
leg1_upper_arm_silver = false
}
}
VARIANT
{
name = Gold
displayName = #LOC_Restock_variant-probe-gold
themeName = Gold
primaryColor = #fccb0a
secondaryColor = #999999
GAMEOBJECTS
{
leg1_body_gold = true
leg1_foot_gold = true
leg1_hydraulic_upper_1_gold = true
leg1_cylinder_gold = true
leg1_upper_arm_gold = true
leg1_body_silver = false
leg1_foot_silver = false
leg1_hydraulic_upper_1_silver = false
leg1_cylinder_silver = false
leg1_upper_arm_silver = false
}
}
VARIANT
{
name = Silver
displayName = #LOC_Restock_variant-probe-silver
themeName = Silver
primaryColor = #cecece
secondaryColor = #999999
GAMEOBJECTS
{
leg1_body_gold = false
leg1_foot_gold = false
leg1_hydraulic_upper_1_gold = false
leg1_cylinder_gold = false
leg1_upper_arm_gold = false
leg1_body_silver = true
leg1_foot_silver = true
leg1_hydraulic_upper_1_silver = true
leg1_cylinder_silver = true
leg1_upper_arm_silver = true
}
}
}
}

@ -0,0 +1,79 @@
// ReStock+ 0.2.0
// Medium Rigid Legs
PART
{
name = restock-leg-2-rigid
module = Part
author = Andrew Cassidy
MODEL
{
model = ReStock/Assets/Ground/restock-leg-2-rigid
}
rescaleFactor = 1.0
// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
attachRules = 1,1,0,0,0
node_attach = 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
node_stack_bottom = 0.0, 0.0, -0.036, 0.0, 0.0, -1.0, 1
TechRequired = landing
entryCost = 2900
cost = 440
mass = 0.05
category = Ground
subcategory = 0
title = #LOC_RestockRigidLegs_restock-leg-2-rigid_title // LTR-1 Landing Strut
manufacturer = #autoLOC_501651 //#autoLOC_501651 = Moving Parts Experts Group
description = #LOC_RestockRigidLegs_restock-leg-2-rigid_description
// A larger rigid landing leg for medium sized craft, this landing leg is perfect for bounce-free landers or even small surface bases.
dragModelType = default
maximum_drag = 0.2
minimum_drag = 0.2
angularDrag = 2
crashTolerance = 25
maxTemp = 2000
bulkheadProfiles = srf
tags = #autoLOC_500875 //#autoLOC_500875 = ground land leg support
MODULE
{
name = ModuleAnimateGeneric
animationName = restock-leg-2-deploy-rigid
actionGUIName = #LOC_RestockRigidLegs_toggle // Toggle Leg
startEventGUIName = #LOC_RestockRigidLegs_extend // Extend
endEventGUIName = #LOC_RestockRigidLegs_retract // Retract
allowAnimationWhileShielded = False
allowDeployLimit = true
defaultActionGroup = Gear
}
MODULE
{
name = ModulePhysicMaterial
activePhysicMaterialName = restock-high-grip
PhysicMaterialName = restock-low-grip
PhysicMaterialName = restock-medium-grip
PhysicMaterialName = restock-high-grip
PHYSICMATERIALCOLORS
{
MATERIALCOLOR
{
name = restock-low-grip
color = 1,1,1
}
MATERIALCOLOR
{
name = restock-medium-grip
color = 1,1,1
}
MATERIALCOLOR
{
name = restock-high-grip
color = 1,1,1
}
}
}
}

@ -0,0 +1,86 @@
// ReStock+ 0.2.0
// Large Rigid Legs
PART
{
name = restock-leg-3-rigid
module = Part
author = Andrew Cassidy
MODEL
{
model = ReStock/Assets/Ground/restock-leg-3-rigid
}
rescaleFactor = 1.0
// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
attachRules = 1,1,0,0,0
node_attach = 0.0, 0.38619, -0.193188, 0.0, 0.0, 1.0
node_stack_bottom = 0.0, 0.38619, -0.2486, 0.0, 0.0, -1.0, 1
TechRequired = advLanding
entryCost = 4100
cost = 340
mass = 0.1
category = Ground
subcategory = 0
title = #LOC_RestockRigidLegs_restock-leg-3-rigid_title // LTR-2 Landing Strut
manufacturer = #autoLOC_501651 //#autoLOC_501651 = Moving Parts Experts Group
description = #LOC_RestockRigidLegs_restock-leg-3-rigid_description
// While it appears similar to the LT-2 landing strut, this is actually a re-purposed outrigger from a mobile crane our engineers found next door. It was probably not needed.
dragModelType = default
maximum_drag = 0.2
minimum_drag = 0.2
angularDrag = 2
crashTolerance = 30
maxTemp = 2000
bulkheadProfiles = srf
tags = #autoLOC_500875 //#autoLOC_500875 = ground land leg support
MODULE
{
name = ModuleAnimateGeneric
animationName = restock-leg-3-deploy-rigid
actionGUIName = #LOC_RestockRigidLegs_toggle // Toggle Leg
startEventGUIName = #LOC_RestockRigidLegs_extend // Extend
endEventGUIName = #LOC_RestockRigidLegs_retract // Retract
allowAnimationWhileShielded = False
allowDeployLimit = true
defaultActionGroup = Gear
}
MODULE
{
name = ModulePhysicMaterial
activePhysicMaterialName = restock-extreme-grip
PhysicMaterialName = restock-low-grip
PhysicMaterialName = restock-medium-grip
PhysicMaterialName = restock-high-grip
PhysicMaterialName = restock-extreme-grip
PHYSICMATERIALCOLORS
{
MATERIALCOLOR
{
name = restock-low-grip
color = 1,1,1
}
MATERIALCOLOR
{
name = restock-medium-grip
color = 1,1,1
}
MATERIALCOLOR
{
name = restock-high-grip
color = 1,1,1
}
MATERIALCOLOR
{
name = restock-extreme-grip
color = 1,1,1
}
}
}
}

@ -0,0 +1,43 @@
PHYSICMATERIAL_DEFINITION
{
name = restock-low-grip
displayName = #LOC_RestockRigidLegs_restock-low-grip // Low Grip
dynamicFriction = 0.4
staticFriction = 0.5
bounciness = 0
frictionCombine = Maximum
bounceCombine = Average
}
PHYSICMATERIAL_DEFINITION
{
name = restock-medium-grip
displayName = #LOC_RestockRigidLegs_restock-medium-grip // Medium Grip
dynamicFriction = 0.5
staticFriction = 0.6
bounciness = 0
frictionCombine = Maximum
bounceCombine = Average
}
PHYSICMATERIAL_DEFINITION
{
name = restock-high-grip
displayName = #LOC_RestockRigidLegs_restock-high-grip // High Grip
dynamicFriction = 0.7
staticFriction = 0.8
bounciness = 0
frictionCombine = Maximum
bounceCombine = Average
}
PHYSICMATERIAL_DEFINITION
{
name = restock-extreme-grip
displayName = #LOC_RestockRigidLegs_restock-extreme-grip // Extreme Grip
dynamicFriction = 0.9
staticFriction = 1.1
bounciness = 0
frictionCombine = Maximum
bounceCombine = Average
}

@ -0,0 +1,9 @@
CONFIGURATION
-------------
Configs are distributed under the MIT license
Copyright (c) 2019 the ReStock team
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,47 @@
========================
RESTOCK RIGID LEGS 0.3.0
========================
Restock Rigid Legs adds alternate versions of the stock legs without the suspension module. These legs are functionally just animated parts the are by default tied to the landing gear action group. The legs are added as their own parts and do not replace the existing legs, making them compatible with saves just like any other mod. They also take advantage of the physics material switcher module added in 1.7.3, allowing for an adjustable level of friction to prevent your landers from sliding down slopes.
============
DEPENDENCIES
============
Required:
- Restock (0.3.0)
- ModuleManager (4.0.2)
============
INSTALLATION
============
To install, drag the RestockRigidLegs folder and ModuleManager DLL from the GameData folder you downloaded into your Kerbal Space Program Gamedata folder. If installed correctly, you should see:
- Kerbal Space Program
- GameData
- Squad
- ReStock
- Assets
- Patches
- etc.
- ReStockRigidLegs
- Parts
- Resources
- etc.
- ModuleManager.4.0.2.dll
============
LOCALIZATION
============
This mod primarily uses vanilla-provided localization, but for additional strings, it provides localization support for the following languages:
- English
=========
LICENSING
=========
See the license.txt file for more information.
Any bundled mods are distributed under their own license:
- ModuleManager by blowfish and sarbian is distributed under a Creative Commons Sharealike license. More details, including source code, can be found here: http://forum.kerbalspaceprogram.com/threads/31342-0-20-ModuleManager-1-3-for-all-your-stock-modding-needs?p=528607&viewfull=1#post528607

@ -15,6 +15,10 @@ Localization
#LOC_RestockPlus_light_rotate_off = Base Rotation
#LOC_RestockPlus_light_rotate_toggle = Rotate Light
#LOC_RestockPlus_launch_clamp_extended_on = Extended
#LOC_RestockPlus_launch_clamp_extended_off = Clamp Extension
#LOC_RestockPlus_launch_clamp_extended_toggle = Extend Clamp
// ENGINES
// =======
// 3.75m

@ -0,0 +1,20 @@
//allows extending and retracting of launch clamps
// TT18-A Launch Stability Enhancer
@PART[launchClamp1]
{
MODULE
{
name = ModuleAnimateGeneric
animationName = RestockLaunchClamp_Extend
startEventGUIName = #LOC_RestockPlus_launch_clamp_extended_on
endEventGUIName = #LOC_RestockPlus_launch_clamp_extended_off
actionGUIName = #LOC_RestockPlus_launch_clamp_extended__toggle
allowDeployLimit = true
revClampDirection = false
revClampSpeed = true
revClampPercent = true
eventAvailableFlight = false
eventAvailableEVA = false
}
}

@ -0,0 +1,164 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
namespace Restock
{
public class ModuleRestockLaunchClamp : LaunchClamp
{
[KSPField] public string trf_towerGirder_name = "";
[KSPField] public string trf_towerYoke_name = "";
[KSPField] public Transform towerPivot;
[KSPField] public Transform towerYoke;
[KSPField] public Transform towerAnchor;
[KSPField] public Transform towerGirder;
[KSPField] public Transform towerStretch;
[KSPField] public Mesh girderSegmentMesh;
[KSPField] public Mesh girderMesh;
private List<Vector3> _girderVerts;
private List<Vector2> _girderUVs;
private List<Vector3> _girderNormals;
private List<Vector4> _girderTangents;
private List<Color32> _girderColors;
private List<int> _girderTris;
private int _girderSegments;
private bool _girderHasTangents = false;
private bool _girderHasColors = false;
private int _girderVertCount;
private int _girderTriCount;
private bool _flightUpdate = false;
public override void OnLoad(ConfigNode node)
{
Debug.Log("OnLoad Called");
towerPivot = base.part.FindModelTransform(trf_towerPivot_name);
towerYoke = base.part.FindModelTransform(trf_towerYoke_name);
towerAnchor = base.part.FindModelTransform(trf_anchor_name);
towerGirder = base.part.FindModelTransform(trf_towerGirder_name);
towerStretch = base.part.FindModelTransform(trf_towerStretch_name);
girderMesh = towerGirder.GetComponent<MeshFilter>().mesh;
girderSegmentMesh = Instantiate<Mesh>(girderMesh);
base.OnLoad(node);
}
public override void OnStart(StartState state)
{
Debug.Log("OnStart Called");
Debug.Log(girderSegmentMesh == null);
girderMesh = towerGirder.GetComponent<MeshFilter>().mesh;
_girderVertCount = girderSegmentMesh.vertexCount;
_girderTriCount = girderSegmentMesh.triangles.Length;
_girderVerts = new List<Vector3>(girderSegmentMesh.vertices);
_girderUVs = new List<Vector2>(girderSegmentMesh.uv);
_girderNormals = new List<Vector3>(girderSegmentMesh.normals);
if (girderSegmentMesh.tangents.Length > 0)
{
_girderHasTangents = true;
_girderTangents = new List<Vector4>(girderSegmentMesh.tangents);
}
if (girderSegmentMesh.colors32.Length > 0)
{
_girderHasColors = true;
_girderColors = new List<Color32>(girderSegmentMesh.colors32);
}
_girderTris = new List<int>(girderSegmentMesh.triangles);
_girderSegments = 1;
base.OnStart(state);
UpdateClamp();
}
public void LateUpdate()
{
if (!HighLogic.LoadedSceneIsEditor)
{
if (_flightUpdate) return;
else _flightUpdate = true;
}
UpdateClamp();
}
public void UpdateClamp()
{
var height = base.height;
var initialHeight = base.initialHeight;
towerAnchor.position = towerStretch.position - (towerStretch.up * height);
var vec1 = Vector3.down;
var vec2 = towerAnchor.localPosition - towerYoke.localPosition ;
towerYoke.localRotation = Quaternion.FromToRotation(vec1, vec2);
var segments = Mathf.CeilToInt(height / initialHeight);
if (segments != _girderSegments)
{
UpdateGirder(segments);
}
}
private void UpdateGirder(int length)
{
if (length > _girderSegments)
{
for (int i = _girderSegments; i < length; i++)
{
var offset = Vector3.down * base.initialHeight * i;
var indexOffset = _girderVertCount * i;
for (int v = 0; v < _girderVertCount; v++)
{
_girderVerts.Add(girderSegmentMesh.vertices[v] + offset);
}
_girderNormals.AddRange(girderSegmentMesh.normals);
_girderUVs.AddRange(girderSegmentMesh.uv);
if (_girderHasTangents) _girderTangents.AddRange(girderSegmentMesh.tangents);
if (_girderHasColors) _girderColors.AddRange(girderSegmentMesh.colors32);
for (int t = 0; t < _girderTriCount; t++)
{
_girderTris.Add(girderSegmentMesh.triangles[t] + indexOffset);
}
}
}
else
{
var startIndex = length * _girderVertCount;
var count = (_girderSegments - length) * _girderVertCount;
_girderVerts.RemoveRange(startIndex, count);
_girderNormals.RemoveRange(startIndex, count);
_girderUVs.RemoveRange(startIndex, count);
if (_girderHasTangents) _girderTangents.RemoveRange(startIndex, count);
if (_girderHasColors) _girderColors.RemoveRange(startIndex, count);
_girderTris.RemoveRange(length * _girderTriCount, (_girderSegments - length) * _girderTriCount);
}
girderMesh.Clear();
girderMesh.SetVertices(_girderVerts);
girderMesh.SetNormals(_girderNormals);
girderMesh.SetUVs(0, _girderUVs);
if (_girderHasTangents) girderMesh.SetTangents(_girderTangents);
if (_girderHasColors) girderMesh.SetColors(_girderColors);
girderMesh.SetTriangles(_girderTris, 0);
girderMesh.RecalculateBounds();
_girderSegments = length;
}
}
}

@ -47,6 +47,7 @@
<Compile Include="MaterialModifiers\IMaterialModifier.cs" />
<Compile Include="MaterialModifiers\MaterialModifierParser.cs" />
<Compile Include="MaterialModifiers\TexturePropertyMaterialModifier.cs" />
<Compile Include="ModuleRestockLaunchClamp.cs" />
<Compile Include="ModuleRestockLinkedMesh.cs" />
<Compile Include="ModuleRestockDepthMask.cs" />
<Compile Include="ModuleRestockHeatEffects.cs" />

Loading…
Cancel
Save