-
Notifications
You must be signed in to change notification settings - Fork 36
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 #768 from zymex22/issue594
Added finer selection options to the Smart Hopper
- Loading branch information
Showing
5 changed files
with
204 additions
and
31 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
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,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ProjectRimFactory.Common | ||
{ | ||
internal interface IPickupSettings | ||
{ | ||
|
||
bool AllowGroundPickup { get; set; } | ||
bool AllowStockpilePickup { get; set; } | ||
bool AllowStoragePickup { get; set; } | ||
bool AllowForbiddenPickup { get; set; } | ||
bool AllowBeltPickup { get; set; } | ||
|
||
|
||
} | ||
} |
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,68 @@ | ||
using ProjectRimFactory.Common; | ||
using RimWorld; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
using Verse; | ||
|
||
namespace ProjectRimFactory.SAL3.Things | ||
{ | ||
public class ITab_SmartHopper : ITab | ||
{ | ||
|
||
private static readonly Vector2 WinSize = new Vector2(200f, 200f); | ||
|
||
private IPickupSettings hopper => this.SelThing as IPickupSettings; | ||
|
||
|
||
private bool GroundPickup = false; | ||
private bool Stockpile = false; | ||
private bool BuildingStorage = false; | ||
private bool Allowforbidden = false; | ||
private bool AllowBelt = false; | ||
|
||
public ITab_SmartHopper() | ||
{ | ||
this.size = WinSize; | ||
this.labelKey = "PRF.SmartHopper.ITab.Name"; | ||
} | ||
|
||
protected override void FillTab() | ||
{ | ||
Listing_Standard list = new Listing_Standard(); | ||
Rect rect = new Rect(0f, 0f, WinSize.x-20f, WinSize.y).ContractedBy(10f); | ||
list.Begin(rect); | ||
|
||
GroundPickup = hopper.AllowGroundPickup; | ||
Stockpile = hopper.AllowStockpilePickup; | ||
BuildingStorage = hopper.AllowStoragePickup; | ||
Allowforbidden = hopper.AllowForbiddenPickup; | ||
AllowBelt = hopper.AllowBeltPickup; | ||
|
||
|
||
list.Label("PRF.SmartHopper.ITab.Description".Translate()); | ||
rect = list.GetRect(30); | ||
Widgets.CheckboxLabeled(rect, "PRF.SmartHopper.ITab.AllowGround".Translate(), ref GroundPickup); | ||
rect = list.GetRect(30); | ||
Widgets.CheckboxLabeled(rect, "PRF.SmartHopper.ITab.AllowStockpile".Translate(), ref Stockpile); | ||
rect = list.GetRect(30); | ||
Widgets.CheckboxLabeled(rect, "PRF.SmartHopper.ITab.AllowStorage".Translate(), ref BuildingStorage); | ||
rect = list.GetRect(30); | ||
Widgets.CheckboxLabeled(rect, "PRF.SmartHopper.ITab.AllowForbidden".Translate(), ref Allowforbidden); | ||
rect = list.GetRect(30); | ||
Widgets.CheckboxLabeled(rect, "PRF.SmartHopper.ITab.AllowBelt".Translate(), ref AllowBelt); | ||
|
||
hopper.AllowGroundPickup = GroundPickup; | ||
hopper.AllowStockpilePickup = Stockpile; | ||
hopper.AllowStoragePickup = BuildingStorage; | ||
hopper.AllowForbiddenPickup = Allowforbidden; | ||
hopper.AllowBeltPickup = AllowBelt; | ||
|
||
list.End(); | ||
|
||
} | ||
} | ||
} |