Skip to content

Commit

Permalink
0.8.6
Browse files Browse the repository at this point in the history
- fixed bug that Sowing job do not comply to Labor Area
- removed JoyGiver debris
  • Loading branch information
Aviuz committed Oct 4, 2017
1 parent e64c3fc commit 82dbf02
Show file tree
Hide file tree
Showing 35 changed files with 317 additions and 128 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>Prison Labor</name>
<author>Avius</author>
<targetVersion>0.17.0</targetVersion>
<description>Version 0.8.4
<description>Version 0.8.6

This mod force prisoners to work. To enable this feature prisoners must have "Force to work" option checked ("Prisoner" tab). Prison labor needs management that consist:
- Motivation - prisoners need to be motivated by presence of colonists. Wardens have new job - supervising prisoners. Low motivation can lead to revolts.
Expand Down
Binary file modified Assemblies/PrisonLabor.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Defs/Hediffs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<capMods>
<li>
<capacity>Manipulation</capacity>
<offset>-0.2</offset>
<offset>-0.3</offset>
</li>
</capMods>
</li>
Expand Down
1 change: 0 additions & 1 deletion Defs/ThinkTreeDef.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<subNodes>
<li Class="PrisonLabor.JobGiver_BedTime" />
<li Class="PrisonLabor.JobGiver_Diet" />
<li Class="PrisonLabor.JobGiver_Joy" />
<li Class="PrisonLabor.JobGiver_Labor" />
</subNodes>
</li>
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
20 changes: 20 additions & 0 deletions Languages/ChineseSimplified/DefInjected/ConceptDef/ConceptDef.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>

<PrisonLabor_Indroduction.label>监狱劳力</PrisonLabor_Indroduction.label>
<PrisonLabor_Indroduction.helpText>你可以强迫你的囚犯为你干活。\n\n为了达到这一目的,你必须先在囚犯的面板上选择“强迫工作”选项。\n\n囚犯将在允许的区域内工作。请确保囚犯能够到达工作区域。\n\n他们只能做烹调,挖矿,切割植物,收获,打扫或种植等不需要特殊技能的工作。\n\n囚犯有时会拒绝工作,理由可能是受伤,饥饿疲劳或单纯的不想干而已。\n\n提示:你可以在“工作”面板指定工作的种类。\n\n提示:如果你在监狱里放了一个炉子,请确保囚犯能够拿到生食来做饭。\n\n提示:你可以通过永久开启门来让囚犯通过。</PrisonLabor_Indroduction.helpText>

<PrisonLabor_Motivation.label>激励囚犯Motivating prisoners</PrisonLabor_Motivation.label>
<PrisonLabor_Motivation.helpText>你的一个囚犯停止工作了。\n他在变得更有动力之前将不会工作。\n\n你可以在“需求”面板里查看他的积极性。\n\n请确保你有足够的监视者(可在工作面板中查看),或是命令你的殖民者站在囚犯旁边。\n\n若囚犯保持低积极性,可能会发生反叛。</PrisonLabor_Motivation.helpText>

<PrisonLabor_Growing.label>囚犯种植</PrisonLabor_Growing.label>
<PrisonLabor_Growing.helpText>囚犯只可以种植土豆或棉花等不需要特殊技能的作物。然而他们仍然能够收获任意作物。</PrisonLabor_Growing.helpText>

<PrisonLabor_Management.label>监狱劳力管理</PrisonLabor_Management.label>
<PrisonLabor_Management.helpText>你可以在数日内管理你的监狱劳力。\n\n你可以在“工作”面板中管理工作类型。\n\n你可以在“限制”栏里设置囚犯何时工作,休息和睡觉。\n\n你可以限制某项工作为“只允许囚犯”。你可以用建筑栏内的“工作区域”来设置囚犯行动范围。\n工作现在有“只允许囚犯”的选项。</PrisonLabor_Management.helpText>

<PrisonLabor_Timetable.label>囚犯时间管制</PrisonLabor_Timetable.label>
<PrisonLabor_Timetable.helpText>你可以给囚犯们设置时间限制。\n\n“工作”时间将会强迫囚犯去工作,即使他们还处于饥饿或疲劳状态。\n\n“娱乐”时间会让囚犯从工作中解脱,并且给他们一些积极性加成。\n\n“睡眠”时间将会强迫囚犯待在监狱里。\n\n“任何事”是默认设置。</PrisonLabor_Timetable.helpText>


</LanguageData>
9 changes: 9 additions & 0 deletions Languages/ChineseSimplified/DefInjected/HediffDef/Hediffs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>

<PrisonLabor_PrisonerChains.label>囚犯锁链</PrisonLabor_PrisonerChains.label>
<PrisonLabor_PrisonerChains.stages.0.label>未激活</PrisonLabor_PrisonerChains.stages.0.label>
<PrisonLabor_PrisonerChains.stages.1.label>激活</PrisonLabor_PrisonerChains.stages.1.label>


</LanguageData>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>

<PrisonLabor_Revolt.label>反叛</PrisonLabor_Revolt.label>
<PrisonLabor_Revolt.letterText>{0}开始了一场反叛行动。囚犯在 {1} 派系周围团结起来,拿起了自制武器开始反抗。</PrisonLabor_Revolt.letterText>
<PrisonLabor_Revolt.letterLabel>反叛</PrisonLabor_Revolt.letterLabel>


</LanguageData>
11 changes: 11 additions & 0 deletions Languages/ChineseSimplified/DefInjected/JobDef/JobDef.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>

<PrisonLabor_PrisonerSupervise.reportString>监视囚犯 TargetA.</PrisonLabor_PrisonerSupervise.reportString>
<PrisonLabor_DeliverFood_Tweak.reportString>喂 TargetA 给 TargetB.</PrisonLabor_DeliverFood_Tweak.reportString>
<PrisonLabor_Mine_Tweak.reportString>挖掘 TargetA.</PrisonLabor_Mine_Tweak.reportString>
<PrisonLabor_Harvest_Tweak.reportString>收获 TargetA.</PrisonLabor_Harvest_Tweak.reportString>
<PrisonLabor_CutPlant_Tweak.reportString>割除 TargetA.</PrisonLabor_CutPlant_Tweak.reportString>


</LanguageData>
8 changes: 8 additions & 0 deletions Languages/ChineseSimplified/DefInjected/NeedDef/Needs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>

<PrisonLabor_Motivation.label>积极性</PrisonLabor_Motivation.label>
<PrisonLabor_Motivation.description>积极性表示囚犯工作的动力。动力可以靠殖民者站在旁边来增加。</PrisonLabor_Motivation.description>


</LanguageData>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>

<PrisonLabor_SupervisePrisonLabor.label>监视囚犯</PrisonLabor_SupervisePrisonLabor.label>
<PrisonLabor_SupervisePrisonLabor.verb>监视囚犯</PrisonLabor_SupervisePrisonLabor.verb>
<PrisonLabor_SupervisePrisonLabor.gerund>监视囚犯中</PrisonLabor_SupervisePrisonLabor.gerund>

<PrisonLabor_DeliverFoodToPrisoner_Tweak.label>为囚犯送餐</PrisonLabor_DeliverFoodToPrisoner_Tweak.label>
<PrisonLabor_DeliverFoodToPrisoner_Tweak.verb>为囚犯送餐</PrisonLabor_DeliverFoodToPrisoner_Tweak.verb>
<PrisonLabor_DeliverFoodToPrisoner_Tweak.gerund>送餐给</PrisonLabor_DeliverFoodToPrisoner_Tweak.gerund>

<PrisonLabor_Mine_Tweak.label>挖掘</PrisonLabor_Mine_Tweak.label>
<PrisonLabor_Mine_Tweak.verb>挖掘</PrisonLabor_Mine_Tweak.verb>
<PrisonLabor_Mine_Tweak.gerund>挖掘中</PrisonLabor_Mine_Tweak.gerund>

<PrisonLabor_PlantsCut_Tweak.label>切割植物</PrisonLabor_PlantsCut_Tweak.label>
<PrisonLabor_PlantsCut_Tweak.verb>切割</PrisonLabor_PlantsCut_Tweak.verb>
<PrisonLabor_PlantsCut_Tweak.gerund>切割植物中</PrisonLabor_PlantsCut_Tweak.gerund>

<PrisonLabor_GrowerHarvest_Tweak.label>收获作物</PrisonLabor_GrowerHarvest_Tweak.label>
<PrisonLabor_GrowerHarvest_Tweak.verb>收获</PrisonLabor_GrowerHarvest_Tweak.verb>
<PrisonLabor_GrowerHarvest_Tweak.gerund>收获作物中</PrisonLabor_GrowerHarvest_Tweak.gerund>

<PrisonLabor_GrowerSow_Tweak.label>播种作物</PrisonLabor_GrowerSow_Tweak.label>
<PrisonLabor_GrowerSow_Tweak.verb>播种</PrisonLabor_GrowerSow_Tweak.verb>
<PrisonLabor_GrowerSow_Tweak.gerund>播种作物中</PrisonLabor_GrowerSow_Tweak.gerund>

<PrisonLabor_CleanFilth_Tweak.label>打扫卫生</PrisonLabor_CleanFilth_Tweak.label>
<PrisonLabor_CleanFilth_Tweak.verb>打扫</PrisonLabor_CleanFilth_Tweak.verb>
<PrisonLabor_CleanFilth_Tweak.gerund>打扫中</PrisonLabor_CleanFilth_Tweak.gerund>


</LanguageData>
47 changes: 47 additions & 0 deletions Languages/ChineseSimplified/Keyed/Keys.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<PrisonLabor_PrisonerWork>强迫工作</PrisonLabor_PrisonerWork>
<PrisonLabor_WorkAndRecruit>工作和招募</PrisonLabor_WorkAndRecruit>
<PrisonLabor_LazyPrisonerMessage>你的囚犯停止工作了!</PrisonLabor_LazyPrisonerMessage>
<PrisonLabor_WardenResponseThreshold>监视者报告阙值</PrisonLabor_WardenResponseThreshold>
<PrisonLabor_StoppingWorkThreshold>停止工作阙值</PrisonLabor_StoppingWorkThreshold>
<PrisonLabor_WorkTypeDisabled>囚犯无法做的工作</PrisonLabor_WorkTypeDisabled>
<PrisonLabor_ShowNews>显示新消息</PrisonLabor_ShowNews>
<PrisonLabor_ShowNewsDesc>当检测到囚犯时显示模组更新消息</PrisonLabor_ShowNewsDesc>
<PrisonLabor_DefaultInterMode>默认囚犯互动模式</PrisonLabor_DefaultInterMode>
<PrisonLabor_AllowedWorkTypes>允许的工作类型:</PrisonLabor_AllowedWorkTypes>
<PrisonLabor_AllowAll>允许全部</PrisonLabor_AllowAll>
<PrisonLabor_AllowAllWorkTypes>允许全部工作类型</PrisonLabor_AllowAllWorkTypes>
<PrisonLabor_AllowedWorkTypesL>允许的工作类型:</PrisonLabor_AllowedWorkTypesL>
<PrisonLabor_Browse>浏览</PrisonLabor_Browse>
<PrisonLabor_MotivationMechanics>激励技巧(!)</PrisonLabor_MotivationMechanics>
<PrisonLabor_MotivationWarning>当选择时,囚犯将需要被激励\n\n警告:需要重新载入存档。</PrisonLabor_MotivationWarning>
<PrisonLabor_CanGrowAdvanced>囚犯可以种植高级作物</PrisonLabor_CanGrowAdvanced>
<PrisonLabor_CanGrowAdvancedDesc>当禁用时囚犯只能种不需要技能的植物。</PrisonLabor_CanGrowAdvancedDesc>
<PrisonLabor_RestartInfo>重启并重新存储你的游戏</PrisonLabor_RestartInfo>
<PrisonLabor_RestartInfo2>此操作后你就能安全的禁用此模组。</PrisonLabor_RestartInfo2>
<PrisonLabor_DisableMod>禁用模组</PrisonLabor_DisableMod>
<PrisonLabor_DisableModDesc>当开启时,存档将会转化成“安全模式”,并且可以在模组被移除后继续游戏。</PrisonLabor_DisableModDesc>
<PrisonLabor_Version>版本: </PrisonLabor_Version>
<PrisonLabor_Difficulty>难度: </PrisonLabor_Difficulty>
<PrisonLabor_Defaults>默认</PrisonLabor_Defaults>
<PrisonLabor_DifficultyNormal>普通</PrisonLabor_DifficultyNormal>
<PrisonLabor_DifficultyCasual>轻松</PrisonLabor_DifficultyCasual>
<PrisonLabor_DifficultyEasy>简单</PrisonLabor_DifficultyEasy>
<PrisonLabor_DifficultyPeaceful>和平</PrisonLabor_DifficultyPeaceful>
<PrisonLabor_DifficultyJoke>搞笑</PrisonLabor_DifficultyJoke>
<PrisonLabor_LazyPrisonerAlert>囚犯不在工作。</PrisonLabor_LazyPrisonerAlert>
<PrisonLabor_LazyPrisonerExplanationDef>囚犯在偷懒。尝试增加他们的积极性。</PrisonLabor_LazyPrisonerExplanationDef>
<PrisonLabor_LazyPrisonerExplanation>这些囚犯在摸鱼:\n\n{0}\n尝试增加他们的积极性。</PrisonLabor_LazyPrisonerExplanation>
<PrisonLabor_StarvingPrisonerAlert>囚犯正在饥饿状态</PrisonLabor_StarvingPrisonerAlert>
<PrisonLabor_StarvingPrisonerExplanationDef>囚犯由于饥饿停止了工作。</PrisonLabor_StarvingPrisonerExplanationDef>
<PrisonLabor_StarvingPrisonerExplanation>这些囚犯由于饥饿停止了工作:\n\n{0}</PrisonLabor_StarvingPrisonerExplanation>
<PrisonLabor_LaborArea>囚犯工作区域</PrisonLabor_LaborArea>
<PrisonLabor_LaborAreaDesc>囚犯工作区域是只有囚犯才能工作的区域。殖民者只能在此区域内执行监视工作。</PrisonLabor_LaborAreaDesc>
<PrisonLabor_ClearLaborArea>清除工作区域</PrisonLabor_ClearLaborArea>
<PrisonLabor_ExpandLaborArea>扩张工作区域</PrisonLabor_ExpandLaborArea>
<PrisonLabor_ColonistsOnly>只允许殖民者</PrisonLabor_ColonistsOnly>
<PrisonLabor_PrisonersOnly>只允许囚犯</PrisonLabor_PrisonersOnly>
<PrisonLabor_ColonyOnly>只允许殖民地</PrisonLabor_ColonyOnly>

</LanguageData>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>
<p align="center">
<a href="https://github.com/Aviuz/PrisonLabor/releases">
<img src="https://img.shields.io/badge/version-0.8.4-orange.svg?style=flat" alt="v0.7" />
<img src="https://img.shields.io/badge/version-0.8.6-orange.svg?style=flat" alt="v0.7" />
</a>
</p>

Expand Down
47 changes: 31 additions & 16 deletions Source/Behaviour_MotivationIcon.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using RimWorld.Planet;
using System;
using UnityEngine;
using Verse;

namespace PrisonLabor
{
internal class Behaviour_MotivationIcon : MonoBehaviour
{
// TODO delete later
private static bool displayedError = false;

private static readonly Texture2D inspiredTexture = ContentFinder<Texture2D>.Get("InspireIcon", false);
private static readonly Texture2D motivatedTexture = ContentFinder<Texture2D>.Get("MotivateIcon", false);
private static readonly Vector3 iconPos = new Vector3(0f, 0f, 1.3f);
Expand Down Expand Up @@ -33,26 +37,37 @@ private void DrawIcon(Texture2D texture, Vector3 pawnPos)

public virtual void OnGUI()
{
//TODO add icons enabled
var iconsEnabled = true;
var inGame = Find.GameInfo != null && Find.World != null && Find.World.renderer != null && !WorldRendererUtility.WorldRenderedNow;

if (iconsEnabled && inGame)
foreach (var pawn in Find.VisibleMap.mapPawns.AllPawns)
{
if (pawn == null) continue;
if (pawn.RaceProps == null) continue;
try
{
//TODO add icons enabled
var iconsEnabled = true;
var inGame = Find.GameInfo != null && Find.World != null && Find.World.renderer != null && !WorldRendererUtility.WorldRenderedNow;

if (pawn.IsPrisonerOfColony)
if (iconsEnabled && inGame)
foreach (var pawn in Find.VisibleMap.mapPawns.AllPawns)
{
var need = pawn.needs.TryGetNeed<Need_Motivation>();
if (need != null && need.Motivated)
if (need.Insipred)
DrawIcon(inspiredTexture, pawn.DrawPos);
else
DrawIcon(motivatedTexture, pawn.DrawPos);
if (pawn == null) continue;
if (pawn.RaceProps == null) continue;

if (pawn.IsPrisonerOfColony)
{
var need = pawn.needs.TryGetNeed<Need_Motivation>();
if (need != null && need.Motivated)
if (need.Insipred)
DrawIcon(inspiredTexture, pawn.DrawPos);
else
DrawIcon(motivatedTexture, pawn.DrawPos);
}
}
}
catch (NullReferenceException e)
{
if (!displayedError)
{
Log.Message("[Debug] (Ignore that) Prison labor null reference in OnGui() : " + e.Message);
displayedError = true;
}
}
}


Expand Down
2 changes: 2 additions & 0 deletions Source/BillUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public static GroupMode IsFor(Bill key)

public static void SetFor(Bill key, GroupMode value)
{
if (!Map.ContainsKey(key))
Map[key] = new BillGroupData();
Map[key].Mode = value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace PrisonLabor.HarmonyPatches
{
internal static class HarmonyPatches
internal static class HPatcher
{
public static void Init()
{
Expand Down
10 changes: 5 additions & 5 deletions Source/HarmonyPatches/Patch_BillCheckbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private static IEnumerable<CodeInstruction> Transpiler(ILGenerator gen, MethodBa
{
"RimWorld.Bill_Production bill",
};
var billField = HarmonyPatches.FindOperandAfter(opCodes0, operands0, instr);
var billField = HPatcher.FindOperandAfter(opCodes0, operands0, instr);
OpCode[] opCodes1 =
{
OpCodes.Ldloc_S,
Expand All @@ -46,7 +46,7 @@ private static IEnumerable<CodeInstruction> Transpiler(ILGenerator gen, MethodBa
"Boolean ButtonText(System.String, System.String)",
"System.Reflection.Emit.Label",
};
var label = HarmonyPatches.FindOperandAfter(opCodes1, operands1, instr);
var label = HPatcher.FindOperandAfter(opCodes1, operands1, instr);

// Begin rect - start of scrollable view
int step2 = 0;
Expand Down Expand Up @@ -95,19 +95,19 @@ private static IEnumerable<CodeInstruction> Transpiler(ILGenerator gen, MethodBa
typeof(Patch_BillCheckbox).GetMethod("GroupExclusionButton"));
ci.labels.Remove((Label)label);
}
if(HarmonyPatches.IsFragment(opCodes3, operands3, ci, ref step3))
if(HPatcher.IsFragment(opCodes3, operands3, ci, ref step3))
{
var instruction = new CodeInstruction(OpCodes.Call, typeof(Patch_BillCheckbox).GetMethod("StopScrolling"));
instruction.labels.AddRange(ci.labels);
ci.labels.Clear();
yield return instruction;
}
if (HarmonyPatches.IsFragment(opCodes2, operands2, ci, ref step4))
if (HPatcher.IsFragment(opCodes2, operands2, ci, ref step4))
{
yield return new CodeInstruction(OpCodes.Call, typeof(Patch_BillCheckbox).GetMethod("SetRect"));
}
yield return ci;
if(HarmonyPatches.IsFragment(opCodes2, operands2, ci, ref step2))
if(HPatcher.IsFragment(opCodes2, operands2, ci, ref step2))
{
yield return new CodeInstruction(OpCodes.Ldloc_2);
yield return new CodeInstruction(OpCodes.Call, typeof(Patch_BillCheckbox).GetMethod("StartScrolling"));
Expand Down
4 changes: 2 additions & 2 deletions Source/HarmonyPatches/Patch_BillPrevention.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private static IEnumerable<CodeInstruction> Transpiler(ILGenerator gen, MethodBa
"System.Reflection.Emit.Label",
"System.Reflection.Emit.Label",
};
var label = (Label)HarmonyPatches.FindOperandAfter(opCodes, operands, instr);
var label = (Label)HPatcher.FindOperandAfter(opCodes, operands, instr);

OpCode[] opCodes2 =
{
Expand Down Expand Up @@ -59,7 +59,7 @@ private static IEnumerable<CodeInstruction> Transpiler(ILGenerator gen, MethodBa
foreach (var ci in instr)
{
yield return ci;
if (HarmonyPatches.IsFragment(opCodes2, operands2, ci, ref step))
if (HPatcher.IsFragment(opCodes2, operands2, ci, ref step))
{
yield return new CodeInstruction(OpCodes.Ldarg_1);
yield return new CodeInstruction(OpCodes.Ldloc_1);
Expand Down
Loading

0 comments on commit 82dbf02

Please sign in to comment.