Skip to content

Commit

Permalink
Merge pull request #194 from Byte-Nova/wip/site-rework
Browse files Browse the repository at this point in the history
Wip/site rework
  • Loading branch information
Byte-Nova authored Nov 1, 2024
2 parents 18d2b35 + 30c7344 commit f908b7e
Show file tree
Hide file tree
Showing 54 changed files with 1,205 additions and 794 deletions.
18 changes: 9 additions & 9 deletions Builders/Result/3005289691/1.4/Defs/SitePartDefs/SiteParts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<SitePartDef>
<defName>RTFarmland</defName>
<label>Farmland</label>
<description>Online Site</description>
<description>The Farmland is primarly used in growing crops, such as rice or potatoes.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Farmland</expandingIconTexture>
Expand All @@ -13,7 +13,7 @@
<SitePartDef>
<defName>RTQuarry</defName>
<label>Quarry</label>
<description>Online Site</description>
<description>The Quarry is where stones and various ores are collected.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Quarry</expandingIconTexture>
Expand All @@ -24,7 +24,7 @@
<SitePartDef>
<defName>RTSawmill</defName>
<label>Sawmill</label>
<description>Online Site</description>
<description>The Sawmill has one job and it does it very well, collect as much wood as possible.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Sawmill</expandingIconTexture>
Expand All @@ -35,7 +35,7 @@
<SitePartDef>
<defName>RTBank</defName>
<label>Bank</label>
<description>Online Site</description>
<description>The Bank simply produces silver and other exotic resources, simple as that.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Bank</expandingIconTexture>
Expand All @@ -46,7 +46,7 @@
<SitePartDef>
<defName>RTLaboratory</defName>
<label>Laboratory</label>
<description>Online Site</description>
<description>The Laboratory is where your expert team of researcher can craft components and other goods.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Laboratory</expandingIconTexture>
Expand All @@ -57,7 +57,7 @@
<SitePartDef>
<defName>RTRefinery</defName>
<label>Refinery</label>
<description>Online Site</description>
<description>The Refinery is where you can create products such as chemfuel.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Refinery</expandingIconTexture>
Expand All @@ -68,7 +68,7 @@
<SitePartDef>
<defName>RTHerbalWorkshop</defName>
<label>Herbal workshop</label>
<description>Online Site</description>
<description>The herbal workshop is a simple site capable of creating basic medicine.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/HerbalWorkshop</expandingIconTexture>
Expand All @@ -79,7 +79,7 @@
<SitePartDef>
<defName>RTTextileFactory</defName>
<label>Textile factory</label>
<description>Online Site</description>
<description>The textile factory lets you produce large amount of cloth and other textiles.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/TextileFactory</expandingIconTexture>
Expand All @@ -90,7 +90,7 @@
<SitePartDef>
<defName>RTFoodProcessor</defName>
<label>Food Processor</label>
<description>Online Site</description>
<description>The food processor is basically a giant nutrient paste dispenser, letting you cook a variety of meals.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/FoodProcessor</expandingIconTexture>
Expand Down
33 changes: 22 additions & 11 deletions Builders/Result/3005289691/Current/Defs/SitePartDefs/SiteParts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,29 @@
<SitePartDef>
<defName>RTFarmland</defName>
<label>Farmland</label>
<description>Online Site</description>
<description>A simple farmland, typically used to grow crops such as corn and rice.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Farmland</expandingIconTexture>
<applyFactionColorToSiteTexture>true</applyFactionColorToSiteTexture>
<minThreatPoints>5000</minThreatPoints>
</SitePartDef>

<SitePartDef>
<defName>RTHunterCamp</defName>
<label>Hunting Camp</label>
<description>This hunting camp is capable of providing leather and meat.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/HuntingCamp</expandingIconTexture>
<applyFactionColorToSiteTexture>true</applyFactionColorToSiteTexture>
<minThreatPoints>5000</minThreatPoints>
</SitePartDef>

<SitePartDef>
<defName>RTQuarry</defName>
<label>Quarry</label>
<description>Online Site</description>
<description>This glorified hole in the ground is used to extract the most precious of rocks and stones, such as granite and marble.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Quarry</expandingIconTexture>
Expand All @@ -24,7 +35,7 @@
<SitePartDef>
<defName>RTSawmill</defName>
<label>Sawmill</label>
<description>Online Site</description>
<description>A simple site capable of giving you large amount of wood.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Sawmill</expandingIconTexture>
Expand All @@ -35,7 +46,7 @@
<SitePartDef>
<defName>RTBank</defName>
<label>Bank</label>
<description>Online Site</description>
<description>Your pawns worked on hard on this one. Banks are capable of magically generating silver and other precious metals out of mid air. Fancy that!</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Bank</expandingIconTexture>
Expand All @@ -46,7 +57,7 @@
<SitePartDef>
<defName>RTLaboratory</defName>
<label>Laboratory</label>
<description>Online Site</description>
<description>Where the brightest live. Your scientist and engineers work hard to make components here.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Laboratory</expandingIconTexture>
Expand All @@ -57,7 +68,7 @@
<SitePartDef>
<defName>RTRefinery</defName>
<label>Refinery</label>
<description>Online Site</description>
<description>A fully automated refinery, capable of outputting chemfuel.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/Refinery</expandingIconTexture>
Expand All @@ -67,8 +78,8 @@

<SitePartDef>
<defName>RTHerbalWorkshop</defName>
<label>Herbal workshop</label>
<description>Online Site</description>
<label>Herbal Workshop</label>
<description>A simple medicine workshop, simple as that.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/HerbalWorkshop</expandingIconTexture>
Expand All @@ -78,8 +89,8 @@

<SitePartDef>
<defName>RTTextileFactory</defName>
<label>Textile factory</label>
<description>Online Site</description>
<label>Textile Factory</label>
<description>The textile factory outputs the finest fabric, none of that peasant stuff.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/TextileFactory</expandingIconTexture>
Expand All @@ -90,7 +101,7 @@
<SitePartDef>
<defName>RTFoodProcessor</defName>
<label>Food Processor</label>
<description>Online Site</description>
<description>Tired of cooking? This site does it for you! Food poisoning included.</description>
<workerClass>SitePartWorker_Outpost</workerClass>
<siteTexture>World/WorldObjects/DefaultSettlement</siteTexture>
<expandingIconTexture>Sites/FoodProcessor</expandingIconTexture>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion Source/Client/Core/Configs/ModStuff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public override void DoSettingsWindowContents(Rect inRect)
listingStandard.Begin(inRect);

listingStandard.Label("Running version: " + CommonValues.executableVersion);

listingStandard.GapLine();
listingStandard.Label("Multiplayer Parameters");
listingStandard.CheckboxLabeled("[When Playing] Deny all incoming transfers", ref modConfigs.rejectTransfersBool, "Automatically denies transfers");
Expand Down
3 changes: 2 additions & 1 deletion Source/Client/Core/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ static RimworldTogether()
PreparePaths();
CreateUnityDispatcher();

FactionValues.SetPlayerFactionDefs();
CaravanManagerHelper.SetCaravanDefs();
SiteManager.SetSiteDefs();

PreferenceManager.LoadClientPreferences();
CompatibilityManager.LoadAllPatchedAssemblies();
}
Expand Down
92 changes: 92 additions & 0 deletions Source/Client/Dialogs/RT_Dialog_SiteMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Verse;
using RimWorld;
using Shared;

namespace GameClient
{
public class RT_Dialog_SiteMenu : Window
{
public List<SiteInfoFile> SiteInfoFileList = new List<SiteInfoFile>();

public Vector2 initialSize = new Vector2(700f, 450);

public override Vector2 InitialSize => initialSize;

public string title = "Choose a site";

private Vector2 scrollPosition = Vector2.zero;

private bool isInConfigMode;

public RT_Dialog_SiteMenu(bool configMode)
{
isInConfigMode = configMode;
DialogManager.dialogSiteMenu = this;
}

public override void DoWindowContents(Rect rect)
{
Widgets.DrawLineHorizontal(rect.x, rect.y - 1, rect.width);
Widgets.DrawLineHorizontal(rect.x, rect.yMax + 1, rect.width);

float centeredX = rect.width / 2;
Text.Font = GameFont.Medium;
Widgets.Label(new Rect(centeredX - Text.CalcSize(title).x / 2, rect.y, Text.CalcSize(title).x, Text.CalcSize(title).y), title);
if(Widgets.CloseButtonFor(rect))Close();

Rect mainRect = new Rect(0, 50f, rect.width, rect.height - 50f);
float height = 6f + (float)SiteManager.siteDefs.Count() * 50f;
Rect viewRect = new Rect(0f, 50f, mainRect.width - 16f, height);
Widgets.BeginScrollView(mainRect, ref scrollPosition, viewRect);
float num = 50;
float num2 = scrollPosition.y - 30f;
float num3 = scrollPosition.y + mainRect.height;
int num4 = 0;

for (int i = 0; i < SiteManager.siteDefs.Length; i++)
{
if (num > num2 && num < num3)
{
Rect inRect = new Rect(0f, num, viewRect.width, 50f);
DrawCustomRow(inRect, SiteManager.siteDefs[i], num4);
}

num += 50f;
num4++;
}

Widgets.EndScrollView();
}

private void DrawCustomRow(Rect rect, SitePartDef thing, int index)
{
Text.Font = GameFont.Small;
Rect highLightRect = new Rect(new Vector2(rect.x, rect.y), new Vector2(rect.width - 16f, 50f));
Rect fixedRect = new Rect(new Vector2(highLightRect.x + 75, highLightRect.y), new Vector2(highLightRect.width - 75f, 55f));
Rect textRect = new Rect(new Vector2(rect.x, rect.y), new Vector2(50f, 50f));

if (index % 2 == 0) Widgets.DrawHighlight(highLightRect);
Widgets.DrawTextureFitted(textRect, thing.ExpandingIconTexture, 1f);
Widgets.Label(fixedRect, thing.description);

if (Mouse.IsOver(highLightRect))
{
Widgets.DrawLineHorizontal(highLightRect.x, highLightRect.y, highLightRect.width);
Widgets.DrawLineHorizontal(highLightRect.x, highLightRect.yMax, highLightRect.width);
Widgets.DrawLineVertical(highLightRect.x, highLightRect.y, highLightRect.height);
Widgets.DrawLineVertical(highLightRect.xMax - 1 , highLightRect.y, highLightRect.height);
}

if (Widgets.ButtonInvisible(highLightRect))
{
if (isInConfigMode) Find.WindowStack.Add(new RT_Dialog_SiteMenu_Config(thing));
else Find.WindowStack.Add(new RT_Dialog_SiteMenu_Info(thing));
}
}
}
}

Loading

0 comments on commit f908b7e

Please sign in to comment.