mirror of
https://github.com/Xevion/RimWorld-Hydroponics-Expanded.git
synced 2025-12-11 00:08:26 -06:00
Match rotation, move materials to static context, add StaticConstructorOnStartup to mainthread asset loading
This commit is contained in:
@@ -9,6 +9,7 @@ using Verse;
|
|||||||
using Verse.Sound;
|
using Verse.Sound;
|
||||||
|
|
||||||
namespace HydroponicsExpanded {
|
namespace HydroponicsExpanded {
|
||||||
|
[StaticConstructorOnStartup]
|
||||||
public class BuildingDenseHydroponicsBasin : Building_PlantGrower, IThingHolder, IPlantToGrowSettable {
|
public class BuildingDenseHydroponicsBasin : Building_PlantGrower, IThingHolder, IPlantToGrowSettable {
|
||||||
private ThingOwner _innerContainer;
|
private ThingOwner _innerContainer;
|
||||||
private int _capacity = 4;
|
private int _capacity = 4;
|
||||||
@@ -82,6 +83,9 @@ namespace HydroponicsExpanded {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void HarvestTick() {
|
private void HarvestTick() {
|
||||||
|
// var plantsLeft = _innerContainer.Count;
|
||||||
|
// var potentialCellCount = this.OccupiedRect().Area;
|
||||||
|
|
||||||
// Try to place every plant in the container in any cell.
|
// Try to place every plant in the container in any cell.
|
||||||
foreach (Thing nextInnerThing in _innerContainer) {
|
foreach (Thing nextInnerThing in _innerContainer) {
|
||||||
var nextPlant = (Plant)nextInnerThing;
|
var nextPlant = (Plant)nextInnerThing;
|
||||||
@@ -143,6 +147,15 @@ namespace HydroponicsExpanded {
|
|||||||
((Plant)thing).TakeDamage(new DamageInfo(DamageDefOf.Rotting, 1f));
|
((Plant)thing).TakeDamage(new DamageInfo(DamageDefOf.Rotting, 1f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static readonly Material HydroponicPoweredFillMaterial =
|
||||||
|
SolidColorMaterials.SimpleSolidColorMaterial(new Color(0.2f, 0.85f, 0.2f));
|
||||||
|
|
||||||
|
private static readonly Material HydroponicUnpoweredFillMaterial =
|
||||||
|
SolidColorMaterials.SimpleSolidColorMaterial(new Color(0.82f, 0f, 0f));
|
||||||
|
|
||||||
|
private static readonly Material HydroponicUnfilledMaterial =
|
||||||
|
SolidColorMaterials.SimpleSolidColorMaterial(new Color(0.3f, 0.3f, 0.3f));
|
||||||
|
|
||||||
public override void Draw() {
|
public override void Draw() {
|
||||||
base.Draw();
|
base.Draw();
|
||||||
|
|
||||||
@@ -156,15 +169,16 @@ namespace HydroponicsExpanded {
|
|||||||
bar.fillPercent = _highestGrowth;
|
bar.fillPercent = _highestGrowth;
|
||||||
|
|
||||||
// Switch to red when no power is provided.
|
// Switch to red when no power is provided.
|
||||||
bar.filledMat = SolidColorMaterials.SimpleSolidColorMaterial(base.CanAcceptSowNow()
|
bar.filledMat = base.CanAcceptSowNow()
|
||||||
? new Color(0.2f, 0.85f, 0.2f)
|
? HydroponicPoweredFillMaterial
|
||||||
: new Color(0.82f, 0f, 0f));
|
: HydroponicUnpoweredFillMaterial;
|
||||||
bar.unfilledMat = SolidColorMaterials.SimpleSolidColorMaterial(new Color(0.3f, 0.3f, 0.3f));
|
bar.unfilledMat = HydroponicUnfilledMaterial;
|
||||||
|
|
||||||
|
|
||||||
Rot4 rotation = base.Rotation;
|
// Rot4 rotation = base.Rotation;
|
||||||
rotation.Rotate(RotationDirection.Clockwise);
|
// rotation.Rotate(RotationDirection.Clockwise);
|
||||||
bar.rotation = rotation;
|
// bar.rotation = rotation;
|
||||||
|
bar.rotation = Rotation;
|
||||||
|
|
||||||
GenDraw.DrawFillableBar(bar);
|
GenDraw.DrawFillableBar(bar);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user