forked from BahamutoD/BDArmory
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from PapaJoesSoup/support
Support
- Loading branch information
Showing
352 changed files
with
23,916 additions
and
14,204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
When reporting issues please provide the following information: | ||
|
||
[See this for more information on reporting issues for KSP Mods](http://forum.kerbalspaceprogram.com/?showtopic=83212) | ||
|
||
[See the Original Forum Post (OP) for additional info](http://forum.kerbalspaceprogram.com/?showtopic=155014) | ||
|
||
##### ISSUE TYPE | ||
<!-- Pick one below and delete the rest: --> | ||
- Support ( Need help getting something to work) | ||
- Bug Report (Something is broken) | ||
- Feature Idea (Something new you want to see) | ||
- Enhancement (Expand on existing features) | ||
|
||
|
||
##### KSP and BDA Version | ||
|
||
``` | ||
``` | ||
|
||
##### OS / ENVIRONMENT | ||
|
||
|
||
##### SUMMARY | ||
<!-- Explain the problem briefly --> | ||
|
||
##### STEPS TO REPRODUCE | ||
<!-- | ||
For bugs, show exactly how to reproduce the problem, using a minimal test-case. | ||
For new features, show how the feature would be used. | ||
--> | ||
|
||
|
||
##### Log Files | ||
<!-- /KSP Directory/KSP.log --> | ||
<!-- /KSP Directory/KSP_x64_Data/Output.txt --> | ||
<!-- You can also paste gist.github.com links for larger files --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using UniLinq; | ||
using UnityEngine; | ||
|
||
namespace BDArmory.Core | ||
{ | ||
[AttributeUsage(AttributeTargets.Field)] | ||
public class BDAPersistantSettingsField : Attribute | ||
{ | ||
public BDAPersistantSettingsField() | ||
{ | ||
} | ||
|
||
public static void Save() | ||
{ | ||
ConfigNode fileNode = ConfigNode.Load(BDArmorySettings.settingsConfigURL); | ||
|
||
if (!fileNode.HasNode("BDASettings")) | ||
{ | ||
fileNode.AddNode("BDASettings"); | ||
} | ||
|
||
ConfigNode settings = fileNode.GetNode("BDASettings"); | ||
IEnumerator<FieldInfo> field = typeof(BDArmorySettings).GetFields().AsEnumerable().GetEnumerator(); | ||
while (field.MoveNext()) | ||
{ | ||
if (field.Current == null) continue; | ||
if (!field.Current.IsDefined(typeof(BDAPersistantSettingsField), false)) continue; | ||
|
||
settings.SetValue(field.Current.Name, field.Current.GetValue(null).ToString(), true); | ||
} | ||
field.Dispose(); | ||
fileNode.Save(BDArmorySettings.settingsConfigURL); | ||
} | ||
|
||
public static void Load() | ||
{ | ||
ConfigNode fileNode = ConfigNode.Load(BDArmorySettings.settingsConfigURL); | ||
if (!fileNode.HasNode("BDASettings")) return; | ||
|
||
ConfigNode settings = fileNode.GetNode("BDASettings"); | ||
|
||
IEnumerator<FieldInfo> field = typeof(BDArmorySettings).GetFields().AsEnumerable().GetEnumerator(); | ||
while (field.MoveNext()) | ||
{ | ||
if (field.Current == null) continue; | ||
if (!field.Current.IsDefined(typeof(BDAPersistantSettingsField), false)) continue; | ||
|
||
if (!settings.HasValue(field.Current.Name)) continue; | ||
object parsedValue = ParseValue(field.Current.FieldType, settings.GetValue(field.Current.Name)); | ||
if (parsedValue != null) | ||
{ | ||
field.Current.SetValue(null, parsedValue); | ||
} | ||
} | ||
field.Dispose(); | ||
} | ||
public static object ParseValue(Type type, string value) | ||
{ | ||
if (type == typeof(string)) | ||
{ | ||
return value; | ||
} | ||
|
||
if (type == typeof(bool)) | ||
{ | ||
return Boolean.Parse(value); | ||
} | ||
else if (type.IsEnum) | ||
{ | ||
return System.Enum.Parse(type, value); | ||
} | ||
else if (type == typeof(float)) | ||
{ | ||
return Single.Parse(value); | ||
} | ||
else if (type == typeof(int)) | ||
{ | ||
return int.Parse(value); | ||
} | ||
else if (type == typeof(Single)) | ||
{ | ||
return Single.Parse(value); | ||
} | ||
else if (type == typeof(Rect)) | ||
{ | ||
string[] strings = value.Split(','); | ||
int xVal = Int32.Parse(strings[0].Split(':')[1].Split('.')[0]); | ||
int yVal = Int32.Parse(strings[1].Split(':')[1].Split('.')[0]); | ||
int wVal = Int32.Parse(strings[2].Split(':')[1].Split('.')[0]); | ||
int hVal = Int32.Parse(strings[3].Split(':')[1].Split('.')[0]); | ||
Rect rectVal = new Rect | ||
{ | ||
x = xVal, | ||
y = yVal, | ||
width = wVal, | ||
height = hVal | ||
}; | ||
return rectVal; | ||
} | ||
Debug.LogError("[BDArmory]: BDAPersistantSettingsField to parse settings field of type " + type + | ||
" and value " + value); | ||
|
||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
| ||
namespace BDArmory.Core | ||
{ | ||
public class BDArmorySettings | ||
{ | ||
public static string settingsConfigURL = "GameData/BDArmory/settings.cfg"; | ||
|
||
[BDAPersistantSettingsField] public static bool INSTAKILL = false; | ||
[BDAPersistantSettingsField] public static bool BULLET_HITS = true; | ||
[BDAPersistantSettingsField] public static bool BULLET_DECALS = true; | ||
[BDAPersistantSettingsField] public static float PHYSICS_RANGE = 0; //TODO: remove all references to this so it can be deprecated! | ||
[BDAPersistantSettingsField] public static bool EJECT_SHELLS = true; | ||
[BDAPersistantSettingsField] public static bool SHELL_COLLISIONS = true; | ||
[BDAPersistantSettingsField] public static bool INFINITE_AMMO = false; | ||
[BDAPersistantSettingsField] public static bool DRAW_DEBUG_LINES = false; | ||
[BDAPersistantSettingsField] public static bool DRAW_DEBUG_LABELS = false; | ||
[BDAPersistantSettingsField] public static bool DRAW_AIMERS = true; | ||
[BDAPersistantSettingsField] public static bool AIM_ASSIST = true; | ||
[BDAPersistantSettingsField] public static bool REMOTE_SHOOTING = false; | ||
[BDAPersistantSettingsField] public static bool BOMB_CLEARANCE_CHECK = true; | ||
[BDAPersistantSettingsField] public static float MAX_BULLET_RANGE = 8000f; //TODO: remove all references to this so it can be deprecated! all ranges should be supplied in part config! | ||
[BDAPersistantSettingsField] public static float TRIGGER_HOLD_TIME = 0.3f; | ||
[BDAPersistantSettingsField] public static bool ALLOW_LEGACY_TARGETING = true; //TODO: remove all references to this so it can be deprecated! legacy targeting should not be support anymore in future versions. | ||
[BDAPersistantSettingsField] public static float TARGET_CAM_RESOLUTION = 1024f; | ||
[BDAPersistantSettingsField] public static bool BW_TARGET_CAM = true; | ||
[BDAPersistantSettingsField] public static float SMOKE_DEFLECTION_FACTOR = 10f; | ||
[BDAPersistantSettingsField] public static float RWR_WINDOW_SCALE_MIN = 0.50f; | ||
[BDAPersistantSettingsField] public static float RWR_WINDOW_SCALE = 1f; | ||
[BDAPersistantSettingsField] public static float RWR_WINDOW_SCALE_MAX = 1.50f; | ||
[BDAPersistantSettingsField] public static float RADAR_WINDOW_SCALE_MIN = 0.50f; | ||
[BDAPersistantSettingsField] public static float RADAR_WINDOW_SCALE = 1f; | ||
[BDAPersistantSettingsField] public static float RADAR_WINDOW_SCALE_MAX = 1.50f; | ||
[BDAPersistantSettingsField] public static float TARGET_WINDOW_SCALE_MIN = 0.50f; | ||
[BDAPersistantSettingsField] public static float TARGET_WINDOW_SCALE = 1f; | ||
[BDAPersistantSettingsField] public static float TARGET_WINDOW_SCALE_MAX = 2f; | ||
[BDAPersistantSettingsField] public static float BDARMORY_UI_VOLUME = 0.35f; | ||
[BDAPersistantSettingsField] public static float BDARMORY_WEAPONS_VOLUME = 0.32f; | ||
[BDAPersistantSettingsField] public static float MAX_GUARD_VISUAL_RANGE = 40000f; | ||
[BDAPersistantSettingsField] public static float MAX_ACTIVE_RADAR_RANGE = 40000f; //NOTE: used ONLY for display range of radar windows! Actual radar range provided by part configs! | ||
[BDAPersistantSettingsField] public static float MAX_ENGAGEMENT_RANGE = 40000f; //NOTE: used ONLY for missile dlz parameters! | ||
[BDAPersistantSettingsField] public static float GLOBAL_LIFT_MULTIPLIER = 0.20f; | ||
[BDAPersistantSettingsField] public static float GLOBAL_DRAG_MULTIPLIER = 4f; | ||
[BDAPersistantSettingsField] public static float IVA_LOWPASS_FREQ = 2500f; | ||
[BDAPersistantSettingsField] public static bool PEACE_MODE = false; | ||
[BDAPersistantSettingsField] public static bool IGNORE_TERRAIN_CHECK = false; | ||
[BDAPersistantSettingsField] public static bool DISPLAY_PATHING_GRID = false; //laggy when the grid gets large | ||
[BDAPersistantSettingsField] public static bool ADVANCED_EDIT = false; //Used for debug fields not nomrally shown to regular users | ||
|
||
[BDAPersistantSettingsField] public static float RECOIL_FACTOR = 0.75f; | ||
[BDAPersistantSettingsField] public static float DMG_MULTIPLIER = 100f; | ||
[BDAPersistantSettingsField] public static float HITPOINT_MULTIPLIER = 2.0f; | ||
[BDAPersistantSettingsField] public static float EXP_DMG_MOD_BALLISTIC; | ||
[BDAPersistantSettingsField] public static float EXP_DMG_MOD_MISSILE; | ||
[BDAPersistantSettingsField] public static float EXP_IMP_MOD; | ||
[BDAPersistantSettingsField] public static int MAX_FIRES_PER_VESSEL = 10; //controls fx for penetration only for landed or splashed | ||
[BDAPersistantSettingsField] public static float FIRELIFETIME_IN_SECONDS = 90f; //controls fx for penetration only for landed or splashed | ||
[BDAPersistantSettingsField] public static bool PERFORMANCE_LOGGING = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using UnityEngine; | ||
|
||
namespace BDArmory.Core | ||
{ | ||
[KSPAddon(KSPAddon.Startup.MainMenu, false)] | ||
public class BuildingDamage : ScenarioDestructibles | ||
{ | ||
public override void OnAwake() | ||
{ | ||
Debug.Log("[BDArmory]: Modifying Buildings"); | ||
|
||
foreach (KeyValuePair<string, ProtoDestructible> bldg in protoDestructibles) | ||
{ | ||
DestructibleBuilding building = bldg.Value.dBuildingRefs[0]; | ||
building.damageDecay = 600f; | ||
building.impactMomentumThreshold *= 150; | ||
} | ||
|
||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using UnityEngine; | ||
|
||
namespace BDArmory.Core.Extension | ||
{ | ||
public class DamageFX : MonoBehaviour | ||
{ | ||
public static bool engineDamaged = false; | ||
|
||
public void Start() | ||
{ | ||
|
||
} | ||
|
||
public void FixedUpdate() | ||
{ | ||
if (engineDamaged) | ||
{ | ||
float probability = Utils.BDAMath.RangedProbability(new[] { 50f, 25f, 20f, 2f }); | ||
if (probability >= 3) | ||
{ | ||
ModuleEngines engine = gameObject.GetComponent<ModuleEngines>(); | ||
engine.flameout = true; | ||
engine.heatProduction *= 1.05f; | ||
engine.maxThrust *= 0.825f; | ||
} | ||
} | ||
} | ||
|
||
|
||
public static void SetEngineDamage(Part part) | ||
{ | ||
ModuleEngines engine; | ||
engine = part.GetComponent<ModuleEngines>(); | ||
engine.flameout = true; | ||
engine.heatProduction *= 1.0125f; | ||
engine.maxThrust *= 0.825f; | ||
} | ||
|
||
public static void SetWingDamage(Part part) | ||
{ | ||
ModuleLiftingSurface wing; | ||
wing = part.GetComponent<ModuleLiftingSurface>(); | ||
wing.deflectionLiftCoeff *= 0.825f; | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.