diff --git a/About/About.xml b/About/About.xml
index 0322c2c..90499b7 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -29,7 +29,7 @@ See the store page for all plans, and don't hesitate to suggest new features or
co.uk.epicguru.ingamewiki
In-game wiki
- steam://url/CommunityFilePage/MISSING
+ steam://url/CommunityFilePage/2113685739
https://github.com/Epicguru/InGameWiki/releases/latest
diff --git a/Defs/Buildings/Buildings.xml b/Defs/Buildings/Buildings.xml
index e776b60..2ab002d 100644
--- a/Defs/Buildings/Buildings.xml
+++ b/Defs/Buildings/Buildings.xml
@@ -71,8 +71,6 @@
Impassable
true
- True
- (0,0,-5)
diff --git a/Defs/Buildings/Production/AlloyFusionMachine.xml b/Defs/Buildings/Production/AlloyFusionMachine.xml
index ebcead2..c7da821 100644
--- a/Defs/Buildings/Production/AlloyFusionMachine.xml
+++ b/Defs/Buildings/Production/AlloyFusionMachine.xml
@@ -38,6 +38,46 @@ See the in-game wiki for more information and how to use.
6
(255,248,214,255)
+
+
+ 1
+ 0
+ 0
+ 40
+
+
+ Gold
+
+
+ true
+
+
+
+ 2
+ 0
+ 1
+ 30
+
+
+ AntimatterComposite_AA
+
+
+ true
+
+
+
+ 3
+ 0
+ 2
+ 20
+
+
+ Uranium
+
+
+ true
+
+
10
diff --git a/Defs/Buildings/Production/CompositeRefiner.xml b/Defs/Buildings/Production/CompositeRefiner.xml
index f52791a..04dfa43 100644
--- a/Defs/Buildings/Production/CompositeRefiner.xml
+++ b/Defs/Buildings/Production/CompositeRefiner.xml
@@ -10,14 +10,16 @@
See the in-game wiki for more information and how to use.
AntimatterAnnihilation/Buildings/CompositeRefiner
- Graphic_Single
+ Graphic_Multi
(3,2)
PassThroughOnly
true
(3, 2)
True
- (0,0,-1)
+ (0,0,2)
+ true
+ South
150
20
@@ -39,6 +41,33 @@ See the in-game wiki for more information and how to use.
5
(245,198,255,255)
+
+
+ 1
+ 0
+ 0
+ 60
+
+
+ Plasteel
+
+
+ true
+
+
+
+ 2
+ 0
+ 1
+ 1
+
+
+ AntimatterCanister_AA
+
+
+ true
+
+
7
diff --git a/Defs/Buildings/Production/InputTray.xml b/Defs/Buildings/Production/InputTray.xml
index 2da944a..e33c81b 100644
--- a/Defs/Buildings/Production/InputTray.xml
+++ b/Defs/Buildings/Production/InputTray.xml
@@ -2,8 +2,8 @@
InputTray_AA
- input tray
- A spacial container to store materials for a nearby machine to use.
+ input tray (legacy)
+ No longer used in this mod: machines now use a more simple refueling system.\nYou should deconstruct this to get steel back.
AntimatterAnnihilation.Buildings.Building_InputTray
AntimatterAnnihilation/Buildings/InputTray
@@ -46,7 +46,7 @@
Item
false
- Entry_AA
+ R_Megumin_AA
diff --git a/Defs/Buildings/Special/M3G_UMIN.xml b/Defs/Buildings/Special/M3G_UMIN.xml
index c83a79d..0c147a1 100644
--- a/Defs/Buildings/Special/M3G_UMIN.xml
+++ b/Defs/Buildings/Special/M3G_UMIN.xml
@@ -77,6 +77,7 @@ Firing the beam of energy creates a huge electromagnetic pulse in both the area
(2,2)
+ 600
1
1
1
diff --git a/Defs/Buildings/Turrets/MBD.xml b/Defs/Buildings/Turrets/MBD.xml
index e80f669..96b0dfa 100644
--- a/Defs/Buildings/Turrets/MBD.xml
+++ b/Defs/Buildings/Turrets/MBD.xml
@@ -14,7 +14,7 @@
false
(3,3)
- 650
+ 900
0.2
9000
220
diff --git a/Defs/Buildings/Turrets/Railgun.xml b/Defs/Buildings/Turrets/Railgun.xml
index aca2e1b..b2203b8 100644
--- a/Defs/Buildings/Turrets/Railgun.xml
+++ b/Defs/Buildings/Turrets/Railgun.xml
@@ -13,7 +13,7 @@
false
(5,5)
- 800
+ 1400
0.5
15000
400
@@ -101,7 +101,7 @@
AnnihilationExplosionRailgun_AA
50000
- 8.5
+ 7.5
true
Artillery_HitThickRoof
MortarBomb_Explode
diff --git a/Defs/Buildings/Turrets/ThunderGun.xml b/Defs/Buildings/Turrets/ThunderGun.xml
index 03529f0..89ad87a 100644
--- a/Defs/Buildings/Turrets/ThunderGun.xml
+++ b/Defs/Buildings/Turrets/ThunderGun.xml
@@ -14,7 +14,7 @@
false
(3,3)
- 500
+ 800
0.4
9000
200
diff --git a/Defs/Factions/Pawn Kinds/UltratechPawns.xml b/Defs/Factions/Pawn Kinds/UltratechPawns.xml
index 6785f3e..32e80b3 100644
--- a/Defs/Factions/Pawn Kinds/UltratechPawns.xml
+++ b/Defs/Factions/Pawn Kinds/UltratechPawns.xml
@@ -9,7 +9,8 @@
Normal
0.2
55
- 0.15
+ 16
+ 0.1
0~1
0.2
@@ -25,11 +26,10 @@
- 0.15
- 900~1800
+ 0.1
+ 900~1300
Advanced
- ImplantEmpireCommon
@@ -37,15 +37,16 @@
Abstract to allow death acidifer version (dlc only?)-->
ultratech gunner
- 120
+ 130
0.85~3.8
- IndustrialAdvanced
+ IndustrialMilitaryBasic
IndustrialMilitaryAdvanced
+ IndustrialAdvanced
BeltDefensePop
SpacerMilitary
- 1500~2600
+ 2200~2800
0.55
450~1100
@@ -83,7 +84,7 @@
UltratechGunnerAdvanced_AA
ultratech elite gunner
- 160
+ 170
0.95~4.0
IndustrialAdvanced
@@ -93,8 +94,6 @@
BionicEye
- ArchotechArm
- BionicLeg
3000~4500
0.8
@@ -128,14 +127,15 @@
ultratech sniper
- 130
+ 135
0.7~3.0
+ IndustrialMilitaryBasic
IndustrialAdvanced
IndustrialMilitaryAdvanced
SpacerMilitary
- 900~1900
+ 2000~2600
0.1
2000~4000
@@ -170,14 +170,14 @@
UltratechSniperAdvanced_AA
ultratech elite sniper
- 155
+ 150
0.7~3.0
IndustrialAdvanced
IndustrialMilitaryAdvanced
SpacerMilitary
- 1200~2500
+ 26000~3300
0.1
3500~7000
@@ -185,7 +185,7 @@
SniperRifleUltra
- ArchotechEye
+ BionicEye
@@ -206,14 +206,15 @@
ultratech slasher
- 130
+ 135
0.5~2.5
+ IndustrialMilitaryBasic
IndustrialAdvanced
IndustrialMilitaryAdvanced
SpacerMilitary
- 900~1700
+ 1500~2000
0.05
1600~2600
@@ -245,7 +246,7 @@
UltratechMeleeAdvanced_AA
ultratech elite slasher
- 160
+ 165
0.7~3.5
2500~4000
0.4
@@ -258,7 +259,6 @@
Apparel_ShieldBelt
- ArchotechEye
BionicLeg
BionicLeg
diff --git a/Defs/Factions/Ultratech.xml b/Defs/Factions/Ultratech.xml
index be4bb93..27949a7 100644
--- a/Defs/Factions/Ultratech.xml
+++ b/Defs/Factions/Ultratech.xml
@@ -50,10 +50,10 @@
-60~60
- (0,35)
- (70, 50)
- (700, 100)
- (1300, 150)
+ (0,25)
+ (70, 40)
+ (700, 90)
+ (1300, 140)
(100000, 10000)
diff --git a/Defs/Items/Guns/Antimatter Bullet.xml b/Defs/Items/Guns/Antimatter Bullet.xml
index 23db4b9..ed452c0 100644
--- a/Defs/Items/Guns/Antimatter Bullet.xml
+++ b/Defs/Items/Guns/Antimatter Bullet.xml
@@ -11,7 +11,7 @@
Annihilate_AA
16
- 0.35
+ 0.48
65
1.0
diff --git a/Defs/Items/Guns/DevastatorLMG.xml b/Defs/Items/Guns/DevastatorLMG.xml
index d45a40a..ecdbb93 100644
--- a/Defs/Items/Guns/DevastatorLMG.xml
+++ b/Defs/Items/Guns/DevastatorLMG.xml
@@ -27,8 +27,8 @@ This weapon incorporates archotech technology. Even with a good understanding of
Bullet_DevastatorLMG_AA
1.6
25
- 8
- 16
+ 6
+ 14
Shot_AntimatterBlaster_AA
GunTail_Heavy
12
@@ -64,10 +64,10 @@ This weapon incorporates archotech technology. Even with a good understanding of
Annihilate_AA
- 11
+ 14
1.5
- 0.65
- 65
+ 0.95
+ 90
diff --git a/Defs/Items/Guns/DevastatorSniperRifle.xml b/Defs/Items/Guns/DevastatorSniperRifle.xml
index 50e54ef..d666cce 100644
--- a/Defs/Items/Guns/DevastatorSniperRifle.xml
+++ b/Defs/Items/Guns/DevastatorSniperRifle.xml
@@ -66,8 +66,8 @@ This weapon incorporates archotech technology. Even with a good understanding of
Annihilate_AA
3
- 55
- 0.85
+ 70
+ 1.05
200
diff --git a/Defs/Items/Guns/Light Antimatter Bullet.xml b/Defs/Items/Guns/Light Antimatter Bullet.xml
index d5d4e66..b51609a 100644
--- a/Defs/Items/Guns/Light Antimatter Bullet.xml
+++ b/Defs/Items/Guns/Light Antimatter Bullet.xml
@@ -11,7 +11,7 @@
Annihilate_AA
12
- 0.15
+ 0.30
1.0
75
diff --git a/Defs/Recipies/AntigrainWarhead.xml b/Defs/Recipies/AntigrainWarhead.xml
new file mode 100644
index 0000000..524a96a
--- /dev/null
+++ b/Defs/Recipies/AntigrainWarhead.xml
@@ -0,0 +1,61 @@
+
+
+
+
+ Make_AntigrainWarhead_AA
+ make antigrain warhead
+ Make an antigrain warhead using antimatter.
+ Making an antigrain warhead.
+ GeneralLaborSpeed
+ Cook
+
+ TableMachining
+
+ Recipe_Machining
+ 1100
+ UnfinishedComponent
+
+
+
+
+ Steel
+
+
+ 30
+
+
+
+
+ Plasteel
+
+
+ 10
+
+
+
+
+ AntimatterCanister_AA
+
+
+ 2
+
+
+
+
+
+ AntimatterCanister_AA
+ Steel
+ Plasteel
+
+
+
+ 1
+
+ AntimatterExplosives_AA
+
+ 7
+
+ Crafting
+
+
+
\ No newline at end of file
diff --git a/Defs/Sounds/Lasers.xml b/Defs/Sounds/Lasers.xml
index 4acbdfa..724c9f3 100644
--- a/Defs/Sounds/Lasers.xml
+++ b/Defs/Sounds/Lasers.xml
@@ -57,8 +57,8 @@
AntimatterAnnihilation/LaserHum
- 18
- 10~40
+ 14
+ 10~35
diff --git a/Languages/English/Keyed/Keys.xml b/Languages/English/Keyed/Keys.xml
index 441e841..3db8cd0 100644
--- a/Languages/English/Keyed/Keys.xml
+++ b/Languages/English/Keyed/Keys.xml
@@ -32,6 +32,7 @@
Power generation multiplier: {0}%
Fuel consumption multiplier: {0}%
+Injector hum volume: {0}%
Enable easter eggs:
@@ -84,9 +85,7 @@
Output side: {0}
Change output side
-Change the side where the output goes. The inputs go on the 3 other sides.
-{0} is in the output spot ({1}), move it to an input spot or change the output direction.
-Stored: {0}/{1} gold, {2}/{3} antimatter composite, {4}/{5} uranium.
+Change the side where the output goes.
Running: {0} hours until output.
Not running: No power.
Not running: Required min. {0} gold, {1} composite, {2} uranium.
diff --git a/Source/AntimatterAnnihilation/AntimatterAnnihilation.csproj b/Source/AntimatterAnnihilation/AntimatterAnnihilation.csproj
index 16eaa32..417e57d 100644
--- a/Source/AntimatterAnnihilation/AntimatterAnnihilation.csproj
+++ b/Source/AntimatterAnnihilation/AntimatterAnnihilation.csproj
@@ -98,6 +98,7 @@
+
@@ -134,6 +135,8 @@
+
+
diff --git a/Source/AntimatterAnnihilation/Buildings/Building_AATurret.cs b/Source/AntimatterAnnihilation/Buildings/Building_AATurret.cs
index abe0c9a..370a2db 100644
--- a/Source/AntimatterAnnihilation/Buildings/Building_AATurret.cs
+++ b/Source/AntimatterAnnihilation/Buildings/Building_AATurret.cs
@@ -1,8 +1,8 @@
using AntimatterAnnihilation.ThingComps;
+using AntimatterAnnihilation.Utils;
using RimWorld;
using System;
using System.Collections.Generic;
-using System.Globalization;
using System.Linq;
using System.Text;
using UnityEngine;
@@ -329,7 +329,18 @@ public override void Tick()
}
}
- protected void TryStartShootSomething(bool canBeginBurstImmediately)
+ public override void PreApplyDamage(ref DamageInfo dinfo, out bool absorbed)
+ {
+ if (dinfo.Def == AADefOf.AnnihilationExplosionRailgun_AA || dinfo.Def == AADefOf.AnnihilationExplosion_AA)
+ {
+ //Log.Message($"This {this.LabelCap} took Annihilate explosion damage, reducing to 50%");
+ dinfo.SetAmount(dinfo.Amount * 0.5f);
+ }
+
+ base.PreApplyDamage(ref dinfo, out absorbed);
+ }
+
+ protected void TryStartShootSomething(bool canBeginBurstImmediately)
{
if (!base.Spawned || (this.holdFire && this.CanToggleHoldFire) || (this.AttackVerb.ProjectileFliesOverhead() && base.Map.roofGrid.Roofed(base.Position)) || !this.AttackVerb.Available())
{
diff --git a/Source/AntimatterAnnihilation/Buildings/Building_AlloyFusionMachine.cs b/Source/AntimatterAnnihilation/Buildings/Building_AlloyFusionMachine.cs
index f89feda..7a1884d 100644
--- a/Source/AntimatterAnnihilation/Buildings/Building_AlloyFusionMachine.cs
+++ b/Source/AntimatterAnnihilation/Buildings/Building_AlloyFusionMachine.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using AntimatterAnnihilation.ThingComps;
using AntimatterAnnihilation.Utils;
using RimWorld;
using UnityEngine;
@@ -7,7 +8,7 @@
namespace AntimatterAnnihilation.Buildings
{
- public class Building_AlloyFusionMachine : Building_TrayPuller, IConditionalGlower
+ public class Building_AlloyFusionMachine : Building_MultiRefuelable, IConditionalGlower
{
public const int TICKS_PER_FRAME = 3;
public const int FRAME_COUNT = 20;
@@ -24,10 +25,6 @@ public class Building_AlloyFusionMachine : Building_TrayPuller, IConditionalGlow
public const float POWER_DRAW_OVERCLOCKED = POWER_DRAW_NORMAL * 2 + 1000; // 2x speed
public const float POWER_DRAW_INSANITY = POWER_DRAW_NORMAL * 4 + 5000; // 4x speed
- public const int MAX_GOLD_STORED = GOLD_PER_HYPER * 4;
- public const int MAX_COMPOSITE_STORED = COMPOSITE_PER_HYPER * 4;
- public const int MAX_URANIUM_STORED = URANIUM_PER_HYPER * 4;
-
private static Graphic[] activeGraphics;
private static void LoadGraphics(Building thing)
@@ -86,21 +83,45 @@ public int GoldToFill
{
get
{
- return MAX_GOLD_STORED - storedGold;
+ var f = GetFuelComp(1);
+ return (int)(f.Props.fuelCapacity - f.Fuel);
}
}
public int CompositeToFill
{
get
{
- return MAX_COMPOSITE_STORED - storedComposite;
+ var f = GetFuelComp(2);
+ return (int)(f.Props.fuelCapacity - f.Fuel);
}
}
public int UraniumToFill
{
get
{
- return MAX_URANIUM_STORED - storedUranium;
+ var f = GetFuelComp(3);
+ return (int)(f.Props.fuelCapacity - f.Fuel);
+ }
+ }
+ public int StoredGold
+ {
+ get
+ {
+ return (int) GetFuelComp(1).Fuel;
+ }
+ }
+ public int StoredComposite
+ {
+ get
+ {
+ return (int)GetFuelComp(2).Fuel;
+ }
+ }
+ public int StoredUranium
+ {
+ get
+ {
+ return (int)GetFuelComp(3).Fuel;
}
}
public bool ShouldBeGlowingNow
@@ -116,11 +137,6 @@ public bool ShouldBeGlowingNow
private int frameNumber;
private long tickCount;
private int outputSide = 2;
- private int storedComposite;
- private int storedGold;
- private int storedUranium;
- private bool hasError;
- private string errorThingKey;
private byte reasonNotRunning;
private int ticksUntilOutput = -1;
private int powerMode;
@@ -130,9 +146,6 @@ public override void ExposeData()
base.ExposeData();
Scribe_Values.Look(ref isActiveInt, "isFusionActive");
Scribe_Values.Look(ref outputSide, "outputSide", 2);
- Scribe_Values.Look(ref storedComposite, "storedComposite");
- Scribe_Values.Look(ref storedGold, "storedGold");
- Scribe_Values.Look(ref storedUranium, "storedUranium");
Scribe_Values.Look(ref ticksUntilOutput, "ticksUntilOutput", -1);
Scribe_Values.Look(ref powerMode, "powerMode");
}
@@ -171,14 +184,10 @@ public override void Tick()
CompGlower?.ReceiveCompSignal("PowerTurnedOn"); // Obviously the power hasn't actually just been turned on, but it's just a way to trigger UpdateLit to be called.
}
- // Pull resources as long as there is power.
- UpdatePullResources();
-
if (!IsActive)
{
frameNumber = 0;
activeGraphic = base.DefaultGraphic;
- hasError = false;
return;
}
@@ -227,32 +236,6 @@ public int GetActiveSpeed()
}
}
- private void UpdatePullResources()
- {
- if (tickCount % PULL_INTERVAL == 0 && PowerTraderComp.PowerOn)
- {
- hasError = false;
- storedUranium += TryPullFromAll("Uranium", UraniumToFill, out bool err);
- if (err)
- {
- hasError = true;
- errorThingKey = "AA.Uranium";
- }
- storedGold += TryPullFromAll("Gold", GoldToFill, out err);
- if (err)
- {
- hasError = true;
- errorThingKey = "AA.Gold";
- }
- storedComposite += TryPullFromAll("AntimatterComposite_AA", CompositeToFill, out err);
- if (err)
- {
- hasError = true;
- errorThingKey = "AA.AntimatterComposite";
- }
- }
- }
-
private void UpdateActiveState()
{
IsActive = true; // Assume running for now.
@@ -262,7 +245,7 @@ private void UpdateActiveState()
reasonNotRunning = 1;
IsActive = false;
}
- else if (storedGold < GOLD_PER_HYPER || storedComposite < COMPOSITE_PER_HYPER || storedUranium < URANIUM_PER_HYPER)
+ else if (StoredGold < GOLD_PER_HYPER || StoredComposite < COMPOSITE_PER_HYPER || StoredUranium < URANIUM_PER_HYPER)
{
reasonNotRunning = 2;
IsActive = false;
@@ -284,14 +267,19 @@ private void UpdateOutput()
PlaceOutput(1);
// Remove internal resources.
- storedComposite -= COMPOSITE_PER_HYPER;
- storedGold -= GOLD_PER_HYPER;
- storedUranium -= URANIUM_PER_HYPER;
+ SubtractFuel(GetFuelComp(1), GOLD_PER_HYPER);
+ SubtractFuel(GetFuelComp(2), COMPOSITE_PER_HYPER);
+ SubtractFuel(GetFuelComp(3), URANIUM_PER_HYPER);
// Flag timer to be reset.
ticksUntilOutput = -1;
}
}
+
+ void SubtractFuel(CompRefuelableMulti f, float amountLess)
+ {
+ f.SetFuelLevel(f.Fuel - amountLess);
+ }
}
private void UpdateActiveGraphics()
@@ -310,45 +298,6 @@ private void UpdateActiveGraphics()
}
}
- public int TryPullFromAll(string defName, int count, out bool hasInOutputSpot)
- {
- if (string.IsNullOrEmpty(defName))
- throw new ArgumentNullException(nameof(defName));
-
- hasInOutputSpot = false;
- if (count <= 0)
- {
- return 0;
- }
-
- int remaining = count;
- for (int i = 0; i < 4; i++)
- {
- var tray = GetTray(GetSpotOffset(i));
- if (tray == null)
- continue;
-
- if (i == outputSide)
- {
- // Give player a warning if there is an input item in the output slot.
- if(TrayHasItem(tray, defName, 0))
- {
- hasInOutputSpot = true;
- }
- // Don't pull from output side tray.
- continue;
- }
-
- int pulled = TryPullFromTray(tray, defName, remaining);
- remaining -= pulled;
- if (remaining <= 0)
- break;
- }
-
- int totalGot = count - remaining;
- return totalGot;
- }
-
public void PlaceOutput(int count)
{
if (count <= 0)
@@ -402,7 +351,7 @@ public override string GetInspectString()
}
}
- return base.GetInspectString() + $"\n{runningStatus}\n{"AA.AFMStoredAmount".Translate(storedGold, MAX_GOLD_STORED, storedComposite, MAX_COMPOSITE_STORED, storedUranium, MAX_URANIUM_STORED)}{(hasError ? $"\n{"AA.AFMSlotError".Translate(errorThingKey.Translate().CapitalizeFirst(), cardRot)} " : "")}\n{"AA.AFMOutputSide".Translate(cardRot)}";
+ return base.GetInspectString() + $"\n{runningStatus}\n{"AA.AFMOutputSide".Translate(cardRot)}";
}
public override IEnumerable GetGizmos()
diff --git a/Source/AntimatterAnnihilation/Buildings/Building_CompositeRefiner.cs b/Source/AntimatterAnnihilation/Buildings/Building_CompositeRefiner.cs
index 241baa3..f92884b 100644
--- a/Source/AntimatterAnnihilation/Buildings/Building_CompositeRefiner.cs
+++ b/Source/AntimatterAnnihilation/Buildings/Building_CompositeRefiner.cs
@@ -4,7 +4,7 @@
namespace AntimatterAnnihilation.Buildings
{
- public class Building_CompositeRefiner : Building_TrayPuller, IConditionalGlower
+ public class Building_CompositeRefiner : Building_MultiRefuelable, IConditionalGlower
{
public bool ShouldBeGlowingNow
{
@@ -38,36 +38,63 @@ public IntVec3 OutputPos
{
get
{
- IntVec3 pos = this.Position + new IntVec3(0, 0, -1);
- return pos;
+ //IntVec3 pos = this.Position + base.Rotation.FacingCell;
+ return InteractionCell;
}
}
- public int MissingPlasteel
+ // Recipe: 60 plasteel + 1 canister is 30 antimatter composite.
+
+ public float CurrentPlasteelCount
+ {
+ get
+ {
+ return GetFuelComp(1).Fuel;
+ }
+ }
+ public float CurrentAntimatterCount
+ {
+ get
+ {
+ return GetFuelComp(2).Fuel;
+ }
+ }
+ public float MaxPlasteel
+ {
+ get
+ {
+ return GetFuelComp(1).Props.fuelCapacity;
+ }
+ }
+ public float MaxAntimatter
+ {
+ get
+ {
+ return GetFuelComp(2).Props.fuelCapacity;
+ }
+ }
+ public float MissingPlasteel
{
get
{
- return MaxPlasteel - CurrentPlasteelCount;
+ var f = GetFuelComp(1);
+ return f.Props.fuelCapacity - f.Fuel;
}
}
- public int MissingAntimatter
+ public float MissingAntimatter
{
get
{
- return MaxAntimatter - CurrentAntimatterCount;
+ var f = GetFuelComp(2);
+ return f.Props.fuelCapacity - f.Fuel;
}
}
public int TicksToProduceOutput = 15000; // 6 in-game hours.
- public int MaxPlasteel = 60;
- public int MaxAntimatter = 1;
public int OutputAmount = 30;
- public int CurrentPlasteelCount;
- public int CurrentAntimatterCount;
public int ProductionTicks;
- private ulong tickCount;
private bool lastFrameRunning;
public override void SpawnSetup(Map map, bool respawningAfterLoad)
@@ -94,8 +121,6 @@ public override void Tick()
{
base.Tick();
- tickCount++;
-
bool isRunning = GetShouldBeRunning();
if (isRunning)
{
@@ -103,8 +128,10 @@ public override void Tick()
if (ProductionTicks >= TicksToProduceOutput)
{
ProductionTicks = 0;
- CurrentAntimatterCount = 0;
- CurrentPlasteelCount = 0;
+
+ // Delete fuel from comps.
+ GetFuelComp(1).SetFuelLevel(0);
+ GetFuelComp(2).SetFuelLevel(0);
PlaceOutput(OutputAmount);
}
@@ -115,32 +142,6 @@ public override void Tick()
CompGlower?.ReceiveCompSignal("PowerTurnedOn"); // Obviously the power hasn't actually just been turned on, but it's just a way to trigger UpdateLit to be called.
}
lastFrameRunning = isRunning;
-
- if (tickCount % 120 == 0 && PowerTraderComp.PowerOn)
- {
- Building_InputTray lt = null;
- Building_InputTray rt = null;
- if (MissingPlasteel != 0)
- {
- lt = GetLeftTray();
- rt = GetRightTray();
-
- CurrentPlasteelCount += TryPullFromTray(rt, "Plasteel", MissingPlasteel);
- CurrentPlasteelCount += TryPullFromTray(lt, "Plasteel", MissingPlasteel);
- }
-
- if (MissingAntimatter != 0)
- {
- if(lt == null)
- {
- lt = GetLeftTray();
- rt = GetRightTray();
- }
-
- CurrentAntimatterCount += TryPullFromTray(lt, "AntimatterCanister_AA", MissingAntimatter);
- CurrentAntimatterCount += TryPullFromTray(rt, "AntimatterCanister_AA", MissingAntimatter);
- }
- }
}
public void PlaceOutput(int count)
@@ -158,21 +159,9 @@ public override void ExposeData()
{
base.ExposeData();
- Scribe_Values.Look(ref CurrentAntimatterCount, "currentAntimatter");
- Scribe_Values.Look(ref CurrentPlasteelCount, "currentPlasteel");
Scribe_Values.Look(ref ProductionTicks, "productionTicks");
}
- public Building_InputTray GetLeftTray()
- {
- return GetTray(new IntVec3(-2, 0, 0));
- }
-
- public Building_InputTray GetRightTray()
- {
- return GetTray(new IntVec3(2, 0, 0));
- }
-
public bool GetShouldBeRunning()
{
return GetReasonNotRunning() == null;
@@ -196,7 +185,7 @@ public override string GetInspectString()
{
string reasonNotRunning = GetReasonNotRunning();
string hours = $"{(TicksToProduceOutput - ProductionTicks) / 2500f:F1}";
- return base.GetInspectString() + $"\n{(reasonNotRunning == null ? "AA.RunningInfo".Translate(hours) : "AA.NotRunningInfo".Translate(reasonNotRunning))}\n{"AA.Plasteel".Translate().CapitalizeFirst()}: {CurrentPlasteelCount}/{MaxPlasteel}\n{"AA.Antimatter".Translate().CapitalizeFirst()}: {CurrentAntimatterCount}/{MaxAntimatter}";
+ return base.GetInspectString() + $"\n{(reasonNotRunning == null ? "AA.RunningInfo".Translate(hours) : "AA.NotRunningInfo".Translate(reasonNotRunning))}";
}
}
}
diff --git a/Source/AntimatterAnnihilation/Buildings/Building_InputTray.cs b/Source/AntimatterAnnihilation/Buildings/Building_InputTray.cs
index d12d5a6..83981e8 100644
--- a/Source/AntimatterAnnihilation/Buildings/Building_InputTray.cs
+++ b/Source/AntimatterAnnihilation/Buildings/Building_InputTray.cs
@@ -127,7 +127,7 @@ public override string GetInspectString()
int count = s.filter.AllowedDefCount;
string stored = count == 0 ? (string)"AA.TrayStoredNothing".Translate() : count == 1 ? s.filter.Summary.CapitalizeFirst() : (string)"AA.TrayStoredMultiple".Translate();
- return "AA.TrayCurrentlyStored".Translate(stored);
+ return "AA.TrayCurrentlyStored".Translate(stored) + "\n[LEGACY] You should deconstruct this, it isn't used in the mod anymore.";
}
}
}
diff --git a/Source/AntimatterAnnihilation/Buildings/Building_MultiRefuelable.cs b/Source/AntimatterAnnihilation/Buildings/Building_MultiRefuelable.cs
new file mode 100644
index 0000000..98e8e3e
--- /dev/null
+++ b/Source/AntimatterAnnihilation/Buildings/Building_MultiRefuelable.cs
@@ -0,0 +1,160 @@
+using AntimatterAnnihilation.ThingComps;
+using RimWorld;
+using System.Collections.Generic;
+using Verse;
+
+namespace AntimatterAnnihilation.Buildings
+{
+ public abstract class Building_MultiRefuelable : Building
+ {
+ private static List tempComps = new List();
+
+ public int ShuffleInterval = 5;
+ public bool AllowAutoRefuelToggle = true;
+ public CompRefuelableMulti[] RefuelComps { get; protected set; }
+ public bool MissingComps { get; private set; }
+
+ private long tick;
+
+ public Building_MultiRefuelable()
+ {
+
+ }
+
+ public override void SpawnSetup(Map map, bool respawningAfterLoad)
+ {
+ if (RefuelComps != null)
+ return;
+
+ tempComps.Clear();
+
+ foreach (var comp in base.AllComps)
+ {
+ if (comp is CompRefuelableMulti s)
+ tempComps.Add(s);
+ }
+
+ RefuelComps = new CompRefuelableMulti[tempComps.Count];
+ for (int i = 0; i < RefuelComps.Length; i++)
+ {
+ RefuelComps[i] = tempComps[i];
+ if (RefuelComps[i].Id == 0)
+ {
+ Log.Error($"A CompRefuelableSpecial on this {LabelCap} has default 'id' value of 0. Please change it to a unique ID.");
+ }
+ }
+
+ tempComps.Clear();
+
+ Log.Message($"RefuelComps: {RefuelComps.Length}");
+ if (RefuelComps == null || RefuelComps.Length == 0)
+ {
+ Log.Error($"Missing refuel comps on this {this.LabelCap}.");
+ MissingComps = true;
+ }
+
+ base.SpawnSetup(map, respawningAfterLoad);
+ }
+
+ public virtual bool MeetsRefuelCondition(CompRefuelableMulti s)
+ {
+ return s.FuelPercentOfMax < 0.99999f;
+ }
+
+ public virtual float GetFuelPriority(CompRefuelableMulti s)
+ {
+ return s.FuelPriority;
+ }
+
+ public CompRefuelableMulti GetFuelComp(int id)
+ {
+ foreach (var comp in RefuelComps)
+ {
+ if (comp.Id == id)
+ return comp;
+ }
+ return null;
+ }
+
+ public override void Tick()
+ {
+ base.Tick();
+
+ tick++;
+
+ // Re-shuffle the components to trick rimworld into accepting multiple refuelable comps.
+ bool shouldShuffle = ShuffleInterval <= 0 || tick % ShuffleInterval == 0;
+ if (!shouldShuffle)
+ return;
+ if (RefuelComps == null)
+ return;
+
+ CompRefuelableMulti toPutFirst = null;
+ float lowest = float.MaxValue;
+ foreach (var s in RefuelComps)
+ {
+ float priority = GetFuelPriority(s);
+
+ if (priority >= lowest)
+ continue;
+
+ if (MeetsRefuelCondition(s))
+ {
+ lowest = priority;
+ toPutFirst = s;
+ }
+ }
+
+ if (toPutFirst == null)
+ return;
+
+ int targetPos = 0;
+ for (int i = 0; i < AllComps.Count; i++)
+ {
+ var c = AllComps[i];
+
+ if (c == toPutFirst)
+ return; // It is already in first place.
+
+ if (c is CompRefuelableConditional)
+ {
+ // Needs to go before other refuel comps.
+ targetPos = i;
+ break;
+ }
+ }
+
+ base.AllComps.Remove(toPutFirst);
+ base.AllComps.Insert(targetPos, toPutFirst); // This makes rimworld treat this as 'THE' refuelable comp, even though there are others.
+ }
+
+ public override IEnumerable GetGizmos()
+ {
+ foreach (var g in base.GetGizmos())
+ yield return g;
+
+ if (RefuelComps == null || RefuelComps.Length == 0)
+ yield break;
+
+ if (AllowAutoRefuelToggle)
+ {
+ bool areEnabled = RefuelComps[0].allowAutoRefuel;
+ yield return new Command_Toggle
+ {
+ defaultLabel = "CommandToggleAllowAutoRefuel".Translate(),
+ defaultDesc = "CommandToggleAllowAutoRefuelDesc".Translate(),
+ hotKey = KeyBindingDefOf.Command_ItemForbid,
+ icon = areEnabled ? TexCommand.ForbidOff : TexCommand.ForbidOn,
+ isActive = () => areEnabled,
+ toggleAction = () =>
+ {
+ foreach (var comp in RefuelComps)
+ {
+ comp.allowAutoRefuel = !comp.allowAutoRefuel;
+ }
+ }
+ };
+ }
+ }
+ }
+}
diff --git a/Source/AntimatterAnnihilation/Buildings/Building_ParticleAccelerator.cs b/Source/AntimatterAnnihilation/Buildings/Building_ParticleAccelerator.cs
index ac8f3d2..4217d63 100644
--- a/Source/AntimatterAnnihilation/Buildings/Building_ParticleAccelerator.cs
+++ b/Source/AntimatterAnnihilation/Buildings/Building_ParticleAccelerator.cs
@@ -2,6 +2,7 @@
using AntimatterAnnihilation.Utils;
using RimWorld;
using System;
+using System.Collections.Generic;
using Verse;
namespace AntimatterAnnihilation.Buildings
@@ -43,7 +44,27 @@ public IntVec3 OutputPos
{
get
{
- IntVec3 pos = this.Position + new IntVec3(0, 0, -5);
+ IntVec3 dir;
+ switch (outputRotation)
+ {
+ case 0:
+ dir = IntVec3.North;
+ break;
+ case 1:
+ dir = IntVec3.East;
+ break;
+ case 2:
+ dir = IntVec3.South;
+ break;
+ case 3:
+ dir = IntVec3.West;
+ break;
+ default:
+ dir = IntVec3.South;
+ break;
+ }
+
+ IntVec3 pos = Position + dir * 5;
return pos;
}
}
@@ -55,17 +76,14 @@ public int ProductionTickInterval
}
}
+ private int outputRotation = 2;
+
private int tickCounter;
public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
base.SpawnSetup(map, respawningAfterLoad);
- if (!respawningAfterLoad)
- {
- CreateZone();
- }
-
FuelComp.FuelConsumeCondition = _ => PowerTraderComp.PowerOn;
}
@@ -74,6 +92,7 @@ public override void ExposeData()
base.ExposeData();
Scribe_Values.Look(ref tickCounter, "canisterProductionTick");
+ Scribe_Values.Look(ref outputRotation, "outputRotation", 2);
}
public override void Tick()
@@ -91,16 +110,6 @@ public override void Tick()
}
}
- private void CreateZone()
- {
- var zone = new Zone_Stockpile(StorageSettingsPreset.DefaultStockpile, Map.zoneManager);
- zone.settings.filter.SetDisallowAll();
- zone.settings.Priority = StoragePriority.Low;
- zone.settings.filter.SetAllow(AADefOf.AntimatterCanister_AA, true);
- Map.zoneManager.RegisterZone(zone);
- zone.AddCell(OutputPos);
- }
-
public void OutputAntimatter(int count)
{
Thing thing = ThingMaker.MakeThing(AADefOf.AntimatterCanister_AA);
@@ -115,5 +124,25 @@ public override string GetInspectString()
string whenNotRunning = PowerTraderComp.PowerOn ? "AA.PANotRunningNoPlasteel".Translate() : "AA.PANotRunningNoPower".Translate();
return base.GetInspectString() + '\n' + (!IsRunning ? whenNotRunning : whenRunning);
}
+
+ public override IEnumerable GetGizmos()
+ {
+ foreach (var g in base.GetGizmos())
+ yield return g;
+
+ var cmd = new Command_Action();
+ cmd.defaultLabel = "AA.AFMChangeOutputSide".Translate();
+ cmd.defaultDesc = "AA.AFMChangeOutputSideDesc".Translate();
+ cmd.icon = Content.ArrowIcon;
+ cmd.iconAngle = outputRotation * 90f;
+ cmd.action = () =>
+ {
+ outputRotation++;
+ if (outputRotation >= 4)
+ outputRotation = 0;
+ };
+
+ yield return cmd;
+ }
}
}
diff --git a/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs b/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs
index 8a0a98b..7dabd90 100644
--- a/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs
+++ b/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs
@@ -217,7 +217,11 @@ public override void Tick()
humSustainer = AADefOf.LaserHum_AA.TrySpawnSustainer(info);
}
- humSustainer?.Maintain();
+ if(humSustainer != null)
+ {
+ humSustainer.info.volumeFactor = Settings.InjectorHumVolume;
+ humSustainer.Maintain();
+ }
}
Beam.Tick();
diff --git a/Source/AntimatterAnnihilation/Hook.cs b/Source/AntimatterAnnihilation/Hook.cs
index 2069a8d..fab256d 100644
--- a/Source/AntimatterAnnihilation/Hook.cs
+++ b/Source/AntimatterAnnihilation/Hook.cs
@@ -19,6 +19,8 @@ private void Awake()
private void OnGUI()
{
+ return;
+
try
{
GUILayout.Space(120);
diff --git a/Source/AntimatterAnnihilation/ModCore.cs b/Source/AntimatterAnnihilation/ModCore.cs
index c0e6062..09fbbe0 100644
--- a/Source/AntimatterAnnihilation/ModCore.cs
+++ b/Source/AntimatterAnnihilation/ModCore.cs
@@ -44,8 +44,7 @@ private void PatchAll()
public static void Log(string msg)
{
- Verse.Log.Message(msg ?? "");
-
+ Verse.Log.Message(msg ?? "");
}
public static void Trace(string msg)
diff --git a/Source/AntimatterAnnihilation/Settings.cs b/Source/AntimatterAnnihilation/Settings.cs
index 5482b48..b59267e 100644
--- a/Source/AntimatterAnnihilation/Settings.cs
+++ b/Source/AntimatterAnnihilation/Settings.cs
@@ -7,27 +7,33 @@ public class Settings : ModSettings
{
public static float PowerGenMulti = 1f;
public static float FuelConsumeRate = 1f;
+ public static float InjectorHumVolume = 1f;
public static bool EnableEasterEggs = true;
public override void ExposeData()
{
Scribe_Values.Look(ref PowerGenMulti, "PowerGenMulti", 1f);
Scribe_Values.Look(ref FuelConsumeRate, "FuelConsumeRate", 1f);
+ Scribe_Values.Look(ref InjectorHumVolume, "InjectorHumVolume", 1f);
Scribe_Values.Look(ref EnableEasterEggs, "EnableEasterEggs", true);
}
public static void DoWindow(Rect window)
{
+ DoLabel("AA.InjectorVolume".Translate($"{InjectorHumVolume * 100f:F0}"));
+ InjectorHumVolume = Widgets.HorizontalSlider(new Rect(window.x, window.y, window.width * 0.5f, 32), InjectorHumVolume, 0f, 1f, leftAlignedLabel: "0%", rightAlignedLabel: "100%", roundTo: 0.05f);
+ MoveDown(32 + 5f);
+
DoLabel("AA.PowerGenMulti".Translate($"{PowerGenMulti*100f:F0}"));
PowerGenMulti = Widgets.HorizontalSlider(new Rect(window.x, window.y, window.width * 0.5f, 32), PowerGenMulti, 0.1f, 5f, leftAlignedLabel: "10%", rightAlignedLabel: "500%", roundTo: 0.05f);
- MoveDown(32 + 10f);
+ MoveDown(32 + 5f);
DoLabel("AA.FuelConsumeRate".Translate($"{FuelConsumeRate * 100f:F0}"));
FuelConsumeRate = Widgets.HorizontalSlider(new Rect(window.x, window.y, window.width * 0.5f, 32), FuelConsumeRate, 0.05f, 5f, leftAlignedLabel: "5%", rightAlignedLabel: "500%", roundTo: 0.05f);
- MoveDown(32 + 10f);
+ MoveDown(32 + 5f);
Widgets.CheckboxLabeled(new Rect(window.x, window.y, 350, 32), "AA.EnableEasterEggs".Translate(), ref EnableEasterEggs, placeCheckboxNearText: true);
- MoveDown(32 + 10f);
+ MoveDown(32 + 5f);
void DoLabel(string label)
{
diff --git a/Source/AntimatterAnnihilation/ThingComps/CompProperties_RefuelableMulti.cs b/Source/AntimatterAnnihilation/ThingComps/CompProperties_RefuelableMulti.cs
new file mode 100644
index 0000000..d76d8a9
--- /dev/null
+++ b/Source/AntimatterAnnihilation/ThingComps/CompProperties_RefuelableMulti.cs
@@ -0,0 +1,15 @@
+using RimWorld;
+
+namespace AntimatterAnnihilation.ThingComps
+{
+ public class CompProperties_RefuelableMulti : CompProperties_Refuelable
+ {
+ public int id;
+ public int fuelPriority;
+
+ public CompProperties_RefuelableMulti()
+ {
+ base.compClass = typeof(CompRefuelableMulti);
+ }
+ }
+}
diff --git a/Source/AntimatterAnnihilation/ThingComps/CompRefuelableConditional.cs b/Source/AntimatterAnnihilation/ThingComps/CompRefuelableConditional.cs
index a9ea4a9..db2918f 100644
--- a/Source/AntimatterAnnihilation/ThingComps/CompRefuelableConditional.cs
+++ b/Source/AntimatterAnnihilation/ThingComps/CompRefuelableConditional.cs
@@ -65,6 +65,12 @@ public override void ReceiveCompSignal(string signal)
public void SetFuelLevel(float fuelLevel)
{
+ if (fuelLevel == this.Fuel)
+ return;
+
+ if (fuelLevel <= 0)
+ fuelLevel = 0f;
+
if (fInfo == null)
fInfo = typeof(CompRefuelable).GetField("fuel", BindingFlags.Instance | BindingFlags.NonPublic);
diff --git a/Source/AntimatterAnnihilation/ThingComps/CompRefuelableMulti.cs b/Source/AntimatterAnnihilation/ThingComps/CompRefuelableMulti.cs
new file mode 100644
index 0000000..c107364
--- /dev/null
+++ b/Source/AntimatterAnnihilation/ThingComps/CompRefuelableMulti.cs
@@ -0,0 +1,80 @@
+using System.Collections.Generic;
+using System.Linq;
+using Verse;
+
+namespace AntimatterAnnihilation.ThingComps
+{
+ ///
+ /// Version of conditional refuelable that is designed to be shuffled within the component list to trick rimworld into accepting multiple refuelable components.
+ ///
+ [StaticConstructorOnStartup]
+ public class CompRefuelableMulti : CompRefuelableConditional
+ {
+ public int Id
+ {
+ get
+ {
+ return (Props as CompProperties_RefuelableMulti).id;
+ }
+ }
+
+ public string FriendlyName
+ {
+ get
+ {
+ return Props.fuelFilter.Summary.CapitalizeFirst();
+ }
+ }
+
+ public ThingDef FuelDef
+ {
+ get
+ {
+ if (cachedFuelDef == null)
+ {
+ var h = (HashSet)Props.fuelFilter.AllowedThingDefs;
+ cachedFuelDef = h.First(); // Yeah this is clunky.
+ }
+ return cachedFuelDef;
+
+ }
+ }
+
+ public int FuelPriority
+ {
+ get
+ {
+ return (Props as CompProperties_RefuelableMulti).fuelPriority;
+ }
+ }
+
+ private ThingDef cachedFuelDef;
+
+ public override string CompInspectStringExtra()
+ {
+ return FriendlyName + ": " + Fuel.ToStringDecimalIfSmall() + " / " + Props.fuelCapacity.ToStringDecimalIfSmall();
+ }
+
+ public override IEnumerable CompGetGizmosExtra()
+ {
+ yield break;
+ }
+
+ public override void PostExposeData()
+ {
+ float fuel = this.Fuel;
+ Scribe_Values.Look(ref fuel, $"fuel_{Id}");
+ base.SetFuelLevel(fuel);
+
+ // Not supported:
+ //Scribe_Values.Look(ref this.configuredTargetFuelLevel, "configuredTargetFuelLevel", -1f, false);
+
+ Scribe_Values.Look(ref allowAutoRefuel, $"allowAutoRefuel_{Id}");
+
+ if (Scribe.mode == LoadSaveMode.PostLoadInit && !this.Props.showAllowAutoRefuelToggle)
+ {
+ this.allowAutoRefuel = this.Props.initialAllowAutoRefuel;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/AntimatterAnnihilation/Utils/AADefOf.cs b/Source/AntimatterAnnihilation/Utils/AADefOf.cs
index cb5b087..98ffb2a 100644
--- a/Source/AntimatterAnnihilation/Utils/AADefOf.cs
+++ b/Source/AntimatterAnnihilation/Utils/AADefOf.cs
@@ -13,9 +13,12 @@ static AADefOf()
public static DamageDef Annihilate_AA;
public static DamageDef EnergyBurn_AA;
+ public static DamageDef AnnihilationExplosion_AA;
+ public static DamageDef AnnihilationExplosionRailgun_AA;
public static ThingDef Mote_MeguminBeam_AA;
+ public static ThingDef CompositeRefiner_AA;
public static ThingDef AntimatterCanister_AA;
public static ThingDef AntimatterComposite_AA;
public static ThingDef HyperAlloy_AA;
diff --git a/Source/Content/Models/MiscBuildings_Medium.blend b/Source/Content/Models/MiscBuildings_Medium.blend
index d3d5869..db8f620 100644
Binary files a/Source/Content/Models/MiscBuildings_Medium.blend and b/Source/Content/Models/MiscBuildings_Medium.blend differ
diff --git a/Source/Content/Promo Stuff/QuickOverview.pdn b/Source/Content/Promo Stuff/QuickOverview.pdn
new file mode 100644
index 0000000..186491b
--- /dev/null
+++ b/Source/Content/Promo Stuff/QuickOverview.pdn
@@ -0,0 +1,1269 @@
+PDN3d