mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Allow selectability in flight to be disabled
This commit is contained in:
parent
5fc9394908
commit
5db788ed37
Binary file not shown.
@ -1,11 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using ConformalDecals.MaterialProperties;
|
using ConformalDecals.MaterialProperties;
|
||||||
using ConformalDecals.Util;
|
using ConformalDecals.Util;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ConformalDecals {
|
namespace ConformalDecals {
|
||||||
public class ModuleConformalDecal : PartModule {
|
public class ModuleConformalDecal : PartModule {
|
||||||
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public enum DecalScaleMode {
|
public enum DecalScaleMode {
|
||||||
HEIGHT,
|
HEIGHT,
|
||||||
WIDTH,
|
WIDTH,
|
||||||
@ -54,7 +56,7 @@ namespace ConformalDecals {
|
|||||||
[KSPField] public int tileIndex = -1;
|
[KSPField] public int tileIndex = -1;
|
||||||
|
|
||||||
[KSPField] public bool updateBackScale = true;
|
[KSPField] public bool updateBackScale = true;
|
||||||
|
[KSPField] public bool selectableInFlight;
|
||||||
|
|
||||||
// INTERNAL VALUES
|
// INTERNAL VALUES
|
||||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-scale", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F2", guiUnits = "m"),
|
[KSPField(guiName = "#LOC_ConformalDecals_gui-scale", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F2", guiUnits = "m"),
|
||||||
@ -76,9 +78,8 @@ namespace ConformalDecals {
|
|||||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-wear", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F0"),
|
[KSPField(guiName = "#LOC_ConformalDecals_gui-wear", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F0"),
|
||||||
UI_FloatRange()]
|
UI_FloatRange()]
|
||||||
public float wear = 100;
|
public float wear = 100;
|
||||||
|
|
||||||
[KSPField(isPersistant = true)]
|
[KSPField(isPersistant = true)] public bool projectMultiple; // reserved for future features. do not modify
|
||||||
public bool projectMultiple; // reserved for future features. do not modify
|
|
||||||
|
|
||||||
[KSPField] public MaterialPropertyCollection materialProperties;
|
[KSPField] public MaterialPropertyCollection materialProperties;
|
||||||
|
|
||||||
@ -100,9 +101,9 @@ namespace ConformalDecals {
|
|||||||
private bool _isAttached;
|
private bool _isAttached;
|
||||||
private Matrix4x4 _orthoMatrix;
|
private Matrix4x4 _orthoMatrix;
|
||||||
|
|
||||||
private Material _decalMaterial;
|
private Material _decalMaterial;
|
||||||
private Material _previewMaterial;
|
private Material _previewMaterial;
|
||||||
private BoxCollider _boundsCollider;
|
private MeshRenderer _boundsRenderer;
|
||||||
|
|
||||||
private int DecalQueue {
|
private int DecalQueue {
|
||||||
get {
|
get {
|
||||||
@ -246,7 +247,7 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
materialProperties.RenderQueue = DecalQueue;
|
materialProperties.RenderQueue = DecalQueue;
|
||||||
|
|
||||||
_boundsCollider = decalColliderTransform.GetComponent<BoxCollider>();
|
_boundsRenderer = decalProjectorTransform.GetComponent<MeshRenderer>();
|
||||||
|
|
||||||
UpdateMaterials();
|
UpdateMaterials();
|
||||||
|
|
||||||
@ -263,6 +264,9 @@ namespace ConformalDecals {
|
|||||||
if (HighLogic.LoadedSceneIsFlight) {
|
if (HighLogic.LoadedSceneIsFlight) {
|
||||||
Part.layerMask |= 1 << DecalConfig.DecalLayer;
|
Part.layerMask |= 1 << DecalConfig.DecalLayer;
|
||||||
decalColliderTransform.gameObject.layer = DecalConfig.DecalLayer;
|
decalColliderTransform.gameObject.layer = DecalConfig.DecalLayer;
|
||||||
|
if (!selectableInFlight) {
|
||||||
|
decalColliderTransform.GetComponent<Collider>().enabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +416,7 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
// update projection
|
// update projection
|
||||||
foreach (var target in _targets) {
|
foreach (var target in _targets) {
|
||||||
target.Project(_orthoMatrix, decalProjectorTransform, _boundsCollider.bounds, useBaseNormal);
|
target.Project(_orthoMatrix, decalProjectorTransform, _boundsRenderer.bounds, useBaseNormal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user