removed maintab

added brothel menu to rjwtab
added toggle for whoring bed widgets
This commit is contained in:
Ed86 2022-10-12 11:34:04 +03:00
parent e0939be2b6
commit 782d9582e6
10 changed files with 86 additions and 12 deletions

View file

@ -6,6 +6,11 @@
<workerClass>rjwwhoring.MainTab.PawnTable_Whores</workerClass>
<columns>
<li>Label</li>
<li>GapTiny</li>
<li>RJW_Gender</li>
<li>GapTiny</li>
<li>LifeStage</li>
<li>GapTiny</li>
<li>RJW_IsWhore</li>
<li>RJW_IsPrisoner</li>
<li>RJW_IsSlave</li>
@ -19,6 +24,11 @@
<li>RJW_PriceRangeOfWhore</li>
<li>RemainingSpace</li>
</columns>
<modExtensions>
<li Class="rjw.MainTab.DefModExtensions.RJW_PawnTable">
<label>Brothel</label>
</li>
</modExtensions>
</PawnTableDef>
</Defs>

View file

@ -4,6 +4,8 @@
<whoringtab_enabled_desc>Shows/hide whoring tab</whoringtab_enabled_desc>
<show_whore_price_factor_on_bed>Show whore price factor on beds</show_whore_price_factor_on_bed>
<show_whore_price_factor_on_bed_desc>Show whore price factor as a label on beds that are enabled for whoring.</show_whore_price_factor_on_bed_desc>
<show_whore_widgets_on_bed>Show bed widgets</show_whore_widgets_on_bed>
<show_whore_widgets_on_bed_desc>Show bed widgets to mark beds for public/private for whoring.</show_whore_widgets_on_bed_desc>
<MoneyPrinting>Money Printing</MoneyPrinting>
<MoneyPrinting_desc>Clients will spawn silver instead of using their own/caravan</MoneyPrinting_desc>

View file

@ -81,6 +81,7 @@
<Compile Include="DefOf\RecordDefDefOf.cs" />
<Compile Include="harmony_Building_BedPatches.cs" />
<Compile Include="harmony_AftersexPatch.cs" />
<Compile Include="harmony_RJWTab_patch.cs" />
<Compile Include="JobDrivers\JobDriver_WhoreInvitingVisitors.cs" />
<Compile Include="JobDrivers\JobDriver_WhoreIsServingVisitors.cs" />
<Compile Include="JobGivers\JobGiver_WhoreInvitingVisitors.cs" />

View file

@ -20,35 +20,40 @@ namespace rjwwhoring
public override void SettingsChanged()
{
ToggleTabIfNeeded();
//ToggleTabIfNeeded();
}
public override void WorldLoaded()
{
DataStore = Find.World.GetComponent<DataStore>();
ToggleTabIfNeeded();
//ToggleTabIfNeeded();
}
private void ToggleTabIfNeeded()
{
DefDatabase<MainButtonDef>.GetNamed("RJW_Brothel").buttonVisible = whoringtab_enabled;
//DefDatabase<MainButtonDef>.GetNamed("RJW_Brothel").buttonVisible = whoringtab_enabled;
}
public static SettingHandle<bool> whoringtab_enabled;
//public static SettingHandle<bool> whoringtab_enabled;
public static SettingHandle<bool> show_whore_price_factor_on_bed;
public static SettingHandle<bool> show_whore_widgets_on_bed;
public static SettingHandle<bool> DebugWhoring;
public static SettingHandle<bool> MoneyPrinting;
public static SettingHandle<bool> ClientAlwaysAccept;
public override void DefsLoaded()
{
whoringtab_enabled = Settings.GetHandle("whoringtab_enabled",
"whoringtab_enabled".Translate(),
"whoringtab_enabled_desc".Translate(),
true);
//whoringtab_enabled = Settings.GetHandle("whoringtab_enabled",
// "whoringtab_enabled".Translate(),
// "whoringtab_enabled_desc".Translate(),
// true);
show_whore_price_factor_on_bed = Settings.GetHandle("show_whore_price_factor_on_bed",
"show_whore_price_factor_on_bed".Translate(),
"show_whore_price_factor_on_bed_desc".Translate(),
false);
show_whore_widgets_on_bed = Settings.GetHandle("show_whore_widgets_on_bed",
"show_whore_widgets_on_bed".Translate(),
"show_whore_widgets_on_bed_desc".Translate(),
false);
MoneyPrinting = Settings.GetHandle("MoneyPrinting",
"MoneyPrinting".Translate(),
"MoneyPrinting_desc".Translate(),

View file

@ -42,12 +42,15 @@ namespace rjwwhoring
[HarmonyPostfix]
public static void Postfix(Building_Bed __instance, ref IEnumerable<Gizmo> __result)
{
if (!WhoringBase.show_whore_widgets_on_bed)
{
return;
}
__result = Process(__instance, __result);
}
private static IEnumerable<Gizmo> Process(Building_Bed __instance, IEnumerable<Gizmo> __result)
{
var isPrisonCell = __instance.GetRoom()?.IsPrisonCell == true;
if (!__instance.ForPrisoners && !__instance.Medical && __instance.def.building.bed_humanlike && __instance.Faction == Faction.OfPlayerSilentFail && !__instance.def.defName.Contains("Guest") && !isPrisonCell)
{

View file

@ -0,0 +1,53 @@
using Verse;
using HarmonyLib;
using rjw;
using System;
using RimWorld;
using System.Collections.Generic;
using UnityEngine;
using rjw.MainTab.DefModExtensions;
using System.Linq;
using System.Reflection;
namespace rjwwhoring
{
[HarmonyPatch(typeof(rjw.MainTab.MainTabWindow))]
[HarmonyPatch(nameof(rjw.MainTab.MainTabWindow.MakeOptions))]
static class RJWTab_Brothel
{
[HarmonyPostfix]
private static void MakeOptionsPatch(rjw.MainTab.MainTabWindow __instance, ref List<FloatMenuOption> __result)
{
try
{
RJWTab_Brothel_Patch.MakeOptionsPatch(__instance, ref __result);
}
catch (Exception e)
{
Log.Error(e.ToString());
}
}
}
static class RJWTab_Brothel_Patch
{
public static List<FloatMenuOption> MakeOptionsPatch(rjw.MainTab.MainTabWindow __instance, ref List<FloatMenuOption> __result)
{
PawnTableDef RJW_Brothel = DefDatabase<PawnTableDef>.GetNamed("RJW_Brothel");
ModLog.Message("0");
__result.Add(new FloatMenuOption(RJW_Brothel.GetModExtension<RJW_PawnTable>().label, () =>
{
ModLog.Message("1");
__instance.pawnTableDef = RJW_Brothel;
ModLog.Message("2");
__instance.pawns = Find.CurrentMap.mapPawns.AllPawns.Where(p => xxx.is_human(p) && (p.IsColonist || p.IsPrisonerOfColony));
ModLog.Message("3");
__instance.Notify_ResolutionChanged();
ModLog.Message("4");
rjw.MainTab.MainTabWindow.Reloadtab();
ModLog.Message("5");
}, MenuOptionPriority.Default));
return __result;
}
}
}

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>RimJobWorld Whoring</identifier>
<version>1.0.1</version>
<version>1.0.2</version>
<dependencies>
<li>RimJobWorld</li>
</dependencies>

View file

@ -5,8 +5,8 @@ Rimjobworld 5.0+(https://gitgud.io/Ed86/rjw)
Features:
Adds whoring, widgets to mark beds for whoring, beds price overlay.
Soliciting only works non colonists, guests, caravans.
Prisoners get passively solicited inside cells since they cant leave those.
Solicition only works on guests, non colonists, caravans.
Prisoners get passively solicited inside their cells, since they cant leave those.
Support Ed: