Skip to content

Commit

Permalink
Add new settings allowing to configure android "battery overload" fea…
Browse files Browse the repository at this point in the history
…ture

-Following the request of  @DJDANNY123
  • Loading branch information
aRandomKiwi committed Aug 1, 2021
1 parent afec7e4 commit b4b6399
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 11 deletions.
Binary file modified 1.3/Assemblies/AndroidTiers.dll
Binary file not shown.
8 changes: 8 additions & 0 deletions Languages/English/Keyed/Misc_Gameplay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@
<ATPP_SettingsSectionVX2>VX2 Neural Chip</ATPP_SettingsSectionVX2>
<ATPP_SettingsSectionVX3>VX3 Neural Chip</ATPP_SettingsSectionVX3>
<ATPP_SettingsSectionSkills>T1/T2 skills</ATPP_SettingsSectionSkills>
<ATPP_SettingsSectionBatteryOverload>Battery overload</ATPP_SettingsSectionBatteryOverload>

<ATPP_SettingsDefaultAndroidGeneratorMode>Android default energy mode:</ATPP_SettingsDefaultAndroidGeneratorMode>
<ATPP_SettingsDefaultAndroidGeneratorModeBiomass>Use biomass generator (they eat)</ATPP_SettingsDefaultAndroidGeneratorModeBiomass>
Expand Down Expand Up @@ -506,4 +507,11 @@
<ATPP_SettingsChanceRecruitedSurrogateControllerCanEscapeAndJoin>Chance recruited surrogate controller join your faction without being arrested ({0}%)</ATPP_SettingsChanceRecruitedSurrogateControllerCanEscapeAndJoin>
<ATPP_SettingsMinHourBeforeKidnapperDisconnectM8>Minimum number of hours before kidnapped M8 will be disconnected from SkyMind ({0}h)</ATPP_SettingsMinHourBeforeKidnapperDisconnectM8>
<ATPP_SettingsMaxHourBeforeKidnapperDisconnectM8>Maximum number of hours before kidnapped M8 will be disconnected from SkyMind ({0}h)</ATPP_SettingsMaxHourBeforeKidnapperDisconnectM8>

<ATPP_SettingsAndroidOverloadBatteryProrata>The power of the explosion and proportional to the battery level</ATPP_SettingsAndroidOverloadBatteryProrata>
<ATPP_SettingsAndroidOverloadRadius>Android explosion radius ({0})</ATPP_SettingsAndroidOverloadRadius>
<ATPP_SettingsM7OverloadRadius>M7 explosion radius ({0})</ATPP_SettingsM7OverloadRadius>
<ATPP_SettingsAndroidOverloadExplosionType>Type of explosion</ATPP_SettingsAndroidOverloadExplosionType>
<ATPP_SettingsAndroidOverloadExplosionTypeDefault>Fragmentation</ATPP_SettingsAndroidOverloadExplosionTypeDefault>
<ATPP_SettingsAndroidOverloadExplosionTypeFire>Incendiary</ATPP_SettingsAndroidOverloadExplosionTypeFire>
</LanguageData>
8 changes: 8 additions & 0 deletions Languages/French/Keyed/Misc_Gameplay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@
<ATPP_SettingsSectionVX2>Puce neuronal VX2</ATPP_SettingsSectionVX2>
<ATPP_SettingsSectionVX3>Puce neuronal VX3</ATPP_SettingsSectionVX3>
<ATPP_SettingsSectionSkills>Compétences T1/T2</ATPP_SettingsSectionSkills>
<ATPP_SettingsSectionBatteryOverload>Surcharge de batterie</ATPP_SettingsSectionBatteryOverload>

<ATPP_SettingsDefaultAndroidGeneratorMode>Mode d'énergie par défaut des androides :</ATPP_SettingsDefaultAndroidGeneratorMode>
<ATPP_SettingsDefaultAndroidGeneratorModeBiomass>Utiliser le générateur à biomasse (ils mangent)</ATPP_SettingsDefaultAndroidGeneratorModeBiomass>
Expand Down Expand Up @@ -503,4 +504,11 @@
<ATPP_SettingsChanceRecruitedSurrogateControllerCanEscapeAndJoin>Chance qu'un controleur d'androide de substitution puisse rejoindre votre faction sans être arrêté ({0}%)</ATPP_SettingsChanceRecruitedSurrogateControllerCanEscapeAndJoin>
<ATPP_SettingsMinHourBeforeKidnapperDisconnectM8>Nombre minimum d'heures avant qu'un M8 kidnappé soit déconnecté de SkyMind ({0}h)</ATPP_SettingsMinHourBeforeKidnapperDisconnectM8>
<ATPP_SettingsMaxHourBeforeKidnapperDisconnectM8>Nombre maximum d'heures avant qu'un M8 kidnappé soit déconnecté de SkyMind ({0}h)</ATPP_SettingsMaxHourBeforeKidnapperDisconnectM8>

<ATPP_SettingsAndroidOverloadBatteryProrata>La puissance de l'explosion est proportionelle à la charge de la batterie</ATPP_SettingsAndroidOverloadBatteryProrata>
<ATPP_SettingsAndroidOverloadRadius>Rayon d'explosion de androides ({0})</ATPP_SettingsAndroidOverloadRadius>
<ATPP_SettingsM7OverloadRadius>Rayon d'explosion des M7 ({0})</ATPP_SettingsM7OverloadRadius>
<ATPP_SettingsAndroidOverloadExplosionType>Type d'explosion</ATPP_SettingsAndroidOverloadExplosionType>
<ATPP_SettingsAndroidOverloadExplosionTypeDefault>Fragmentation</ATPP_SettingsAndroidOverloadExplosionTypeDefault>
<ATPP_SettingsAndroidOverloadExplosionTypeFire>Incendiaire</ATPP_SettingsAndroidOverloadExplosionTypeFire>
</LanguageData>
4 changes: 2 additions & 2 deletions Source/Androids For RW1.3/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyVersion("3.0.0.2")]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue | DebuggableAttribute.DebuggingModes.DisableOptimizations)]
Expand All @@ -17,4 +17,4 @@
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4ed7b8ad-47e8-4436-a9bf-e664b17196d7")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.2")]
42 changes: 39 additions & 3 deletions Source/Androids For RW1.3/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ namespace MOARANDROIDS
{
public class Settings : ModSettings
{
public static bool batteryLevelDetermineExplosionIntensity = true;
public static int androidOverloadExplosionType = 0;
public static int m7OverloadRadius = 12;
public static int androidOverloadRadius = 5;
public static int nbMinHoursBeforeKidnappedM8Disconnected = 6;
public static int nbMaxHoursBeforeKidnappedM8Disconnected = 48;
public static float chanceRecruitedSurrogateControllerCanEscapeAndJoin = 0.65f;
Expand Down Expand Up @@ -217,6 +221,12 @@ public static void DoSettingsWindowContents(Rect inRect)
list.CheckboxLabeled("ATPP_SettingsAllowSurrogateConnectionInitMalus".Translate(), ref allowSurrogateConnectionInitMalus);
list.CheckboxLabeled("ATPP_SettingsVX0KeepBodyBackstory".Translate(), ref keepPuppetBackstory);

list.Label("ATPP_SettingsMinDaysBeforeAndroidsPaintingCanRust".Translate(minDaysAndroidPaintingCanRust));
minDaysAndroidPaintingCanRust = (int)list.Slider(minDaysAndroidPaintingCanRust, 1, 200);

list.Label("ATPP_SettingsMinDaysBeforeAndroidsPaintingCanRust".Translate(minDaysAndroidPaintingCanRust));
minDaysAndroidPaintingCanRust = (int)list.Slider(minDaysAndroidPaintingCanRust, 1, 200);

if (Utils.ANDROIDTIERSGYNOID_LOADED)
{
list.Label("ATPP_SettingsChanceCreatedAndroidsAreMale".Translate((int)(percentageChanceMaleAndroidModel * 100)));
Expand Down Expand Up @@ -500,8 +510,6 @@ public static void DoSettingsWindowContents(Rect inRect)
list.Label("ATPP_SettingsCharchingStationWattIncrease".Translate("NSolution"));
list.TextFieldNumeric(ref wattConsumedByFENNEC, ref buffWattConsumedByFENNEC, 1, 999999);




list.GapLine();
list.Gap(10);
Expand Down Expand Up @@ -816,8 +824,31 @@ public static void DoSettingsWindowContents(Rect inRect)
list.Label("ATPP_SettingsMindDuplicationDuration".Translate((int)(mindDuplicationHours)));
mindDuplicationHours = (int)list.Slider(mindDuplicationHours, 1, 72);

list.Gap(3);
list.GapLine();
list.Gap(10);
GUI.color = Color.cyan;
list.Label("ATPP_SettingsSectionBatteryOverload".Translate());
GUI.color = Color.white;
list.Gap(10);
list.GapLine();

list.CheckboxLabeled("ATPP_SettingsAndroidOverloadBatteryProrata".Translate(), ref batteryLevelDetermineExplosionIntensity);

list.Label("ATPP_SettingsAndroidOverloadRadius".Translate(androidOverloadRadius));
androidOverloadRadius = (int)list.Slider(androidOverloadRadius, 1, 50);

list.Label("ATPP_SettingsM7OverloadRadius".Translate(m7OverloadRadius));
m7OverloadRadius = (int)list.Slider(m7OverloadRadius, 1, 50);

GUI.color = Color.yellow;
list.Label("ATPP_SettingsAndroidOverloadExplosionType".Translate());
GUI.color = Color.white;
if (list.RadioButton("ATPP_SettingsAndroidOverloadExplosionTypeDefault".Translate(), (androidOverloadExplosionType == 0)))
androidOverloadExplosionType = 0;
if (list.RadioButton("ATPP_SettingsAndroidOverloadExplosionTypeFire".Translate(), (androidOverloadExplosionType == 1)))
androidOverloadExplosionType = 1;



list.End();
Widgets.EndScrollView();
Expand Down Expand Up @@ -1015,6 +1046,11 @@ public override void ExposeData()
Scribe_Values.Look<int>(ref nbMaxHoursBeforeKidnappedM8Disconnected, "nbMaxHoursBeforeKidnappedM8Disconnected", 48);
Scribe_Values.Look<int>(ref nbMinHoursBeforeKidnappedM8Disconnected, "nbMinHoursBeforeKidnappedM8Disconnected", 6);

Scribe_Values.Look<int>(ref androidOverloadExplosionType, "androidOverloadExplosionType", 0);
Scribe_Values.Look<int>(ref androidOverloadRadius, "androidOverloadRadius", 5);
Scribe_Values.Look<int>(ref m7OverloadRadius, "m7OverloadRadius", 12);
Scribe_Values.Look<bool>(ref batteryLevelDetermineExplosionIntensity, "batteryLevelDetermineExplosionIntensity", true);

}
}
}
17 changes: 12 additions & 5 deletions Source/Androids For RW1.3/Utils/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2885,24 +2885,31 @@ public static void makeAndroidBatteryOverload(Pawn android)
{
float batteryLevel = 1.0f;

if(android.needs.food != null)
batteryLevel = android.needs.food.CurLevelPercentage;
if (Settings.batteryLevelDetermineExplosionIntensity)
{
if (android.needs.food != null)
batteryLevel = android.needs.food.CurLevelPercentage;
}

float radius = 0;

if (android.def.defName == Utils.M7)
{
radius = 12 * batteryLevel;
radius = Settings.m7OverloadRadius * batteryLevel;
}
else
{
radius = 5 * batteryLevel;
radius = Settings.androidOverloadRadius * batteryLevel;
}

if (radius == 0)
radius = 1;

GenExplosion.DoExplosion(android.Position, android.Map, radius, DamageDefOf.Bomb, android, -1, -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false);
DamageDef ddf = DamageDefOf.Bomb;
if (Settings.androidOverloadExplosionType == 1)
ddf = DamageDefOf.Flame;

GenExplosion.DoExplosion(android.Position, android.Map, radius, ddf, android, -1, -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false);

if (!android.Dead)
android.Kill(null, null);
Expand Down
Binary file modified Source/Androids For RW1.3/obj/Debug/AndroidTiers.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ C:\Users\AaronDB\Desktop\Mods Folder for Mod Folders\Rimworld\Android-Tiers-Core
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\mods\Android-Tiers-Core\1.3\Assemblies\AndroidTiers.dll
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\mods\Android-Tiers-Core\Source\Androids For RW1.3\obj\Debug\Androids.csproj.CoreCompileInputs.cache
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\mods\Android-Tiers-Core\Source\Androids For RW1.3\obj\Debug\AndroidTiers.dll
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\mods\Android-Tiers-Core\Source\Androids For RW1.3\obj\Debug\Androids.csprojAssemblyReference.cache

0 comments on commit b4b6399

Please sign in to comment.