Ludeon Forums

Ludeon Forums

  • July 16, 2020, 12:51:26 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Lupin III

Pages: [1]
1
I have a colony that worked fine for some time, but suddenly pawns started to move stacks around within a stockpile. At first I thought it is a mod issue (and I'm still not 100% it isn't, so I don't file this as a rimworld bug yet). I had two mods I thought could be the culprit, "JT Better Hauling", which prioritizes perishables in hauling, and "Stack merger", which consolidates serveral small stacks. But I disabled those two mods and it is still happening. Since none of the other mods I use should influence hauling/stacking (except for priority maybe, but not the what and where to), I'm now at a loss to find out, what is causing this. I searched the forum, if someone described a similar problem, but found nothing.
Is there any way to debug what part of the game (mod/core) caused a certain action?

To describe this problem again:
The four pawns to the right in the walk-in freezer are constantly picking up small stacks (sometimes full stacks, sometimes less) and dropping it on the square besides them. It is in the same stockpile, but it also happened at other stockpiles (e. g. the small rim-freezer to the left), where they pick up stacks and drop it on the floor, where there isn't even a stockpile. Then they pick it up again and put it back in the stockpile. This continues with a constant stream of "x started 10 jobs in 10 ticks" until they have something else with higher priority to do. Btw. the bug is not caused by the storage items (the shelves/barrels/freezers), because the weird behaviour occured before I built them as well.

[attachment deleted by admin: too old]

2
So I'm trying to make a mod that allows me to repair any apparel or weapon on its respective table with a single recipe (two actually, one for all apparel and one for all weapons). Apparently there's no way to make this as an XML only mod, which I would have preferred (https://ludeon.com/forums/index.php?topic=16264).

I now set up visual studio and made a DLL mod. It seems to me that stone cutting does something very similar. There's a single recipe to cut stone and it takes any stone chunk it can find, while the output is dependent on what kind of chunk was used. I adapted what I could find by decompiling (not much more than replacing the categories of "StoneChunks" by "Apparel"). I never programmed anything in C# before, but I managed to compile a DLL and the game even starts with it without crashing now (it took me a while to find out that the culprit was the .pdb file also created in the Assemblies directory that causes the game to crash as soon as the mod is loaded. WHY?!). The recipe is also available as it should be at the tailor's table (but that's something that also worked without any DLL anyway). But the apparels that get used in the recipe currently vanish into thin air. So how does the stone cutting recipe do that? How can I define the product of the recipe? (it should be the same apparel as the ingredient just with 100% HP).

This is what I did until now (pretty much a copy of the stone cutting stuff):
Mending.cs
Code: [Select]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using UnityEngine;
using RimWorld;
using Verse;

namespace Lupin_Mend
{
public class RecipeWorkerCounter_MendApparel : RecipeWorkerCounter
{
private List<ThingDef> apparelDefs;

public override bool CanCountProducts(Bill_Production bill)
{
return true;
}

public override int CountProducts(Bill_Production bill)
{
if (this.apparelDefs == null)
{
ThingCategoryDef item = ThingCategoryDef.Named("Apparel");
this.apparelDefs = new List<ThingDef>(16);
foreach (ThingDef current in DefDatabase<ThingDef>.AllDefsListForReading)
{
if (current.thingCategories != null && current.thingCategories.Contains(item))
{
this.apparelDefs.Add(current);
}
}
}
int num = 0;
for (int i = 0; i < this.apparelDefs.Count; i++)
{
num += Find.ResourceCounter.GetCount(this.apparelDefs[i]);
}
return num;
}

public override string ProductsDescription(Bill_Production bill)
{
return ThingCategoryDef.Named("Apparel").label;
}
}
}

mend_apparel.xml (recipe):
Code: [Select]
<?xml version="1.0" encoding="utf-8" ?>
<RecipeDefs>

<RecipeDef>
<workerCounterClass>Lupin_Mend.RecipeWorkerCounter_MendApparel</workerCounterClass>
<defName>Lupin_MendApparel</defName>
<label>mend apparel</label>
<description>Mend clothing</description>
<jobString>Mending.</jobString>
<workAmount>1400</workAmount>
<workSpeedStat>TailoringSpeed</workSpeedStat>
<workSkill>Crafting</workSkill>
<workSkillLearnFactor>0.1</workSkillLearnFactor>
<effectWorking>Tailor</effectWorking>
<soundWorking>Recipe_Tailor</soundWorking>
<ingredients>
<li>
<filter>
<categories>
<li>Apparel</li>
</categories>
</filter>
<count>1</count>
</li>
</ingredients>
<fixedIngredientFilter>
<categories>
<li>Apparel</li>
</categories>
</fixedIngredientFilter>
<recipeUsers>
<li>TableTailor</li>
</recipeUsers>
</RecipeDef>

</RecipeDefs>

3
I would like to make a mod that allows me to repair apparel and weapons. Both should work on the core tailoring/smithing table. It would like it to be a single recipe for each table. So take any apparel in and output the same apparel just with 100% hitpoints. I don't care if the color changes or if the quality changes. Quite the opposite, it would be a nice touch if a bad tailor might get the hitpoints to 100% but randomly drops the quality from "legendary" to "shoddy" ;) . But the material has to stay the same. (in essence very similar to what stonecutting and butchering does)
I've managed to make a recipe that takes any apparel(weapon) to the bench and gets worked on. But when finisched it vanishes into thin air, because I don't know what should be specified as a product. Is this even possible with just an XML recipe or does this have to be a DLL mod?

Code: [Select]
<?xml version="1.0" encoding="utf-8" ?>
<RecipeDefs>

<RecipeDef>
<defName>Lupin_MendApparel</defName>
<label>mend apparel</label>
<description>Mend clothing</description>
<jobString>Mending.</jobString>
<workAmount>1400</workAmount>
<workSpeedStat>TailoringSpeed</workSpeedStat>
<workSkill>Crafting</workSkill>
<workSkillLearnFactor>0.1</workSkillLearnFactor>
<effectWorking>Tailor</effectWorking>
<soundWorking>Recipe_Tailor</soundWorking>
<ingredients>
<li>
<filter>
<categories>
<li>Apparel</li>
</categories>
</filter>
<count>1</count>
</li>
</ingredients>
<fixedIngredientFilter>
<categories>
<li>Apparel</li>
</categories>
</fixedIngredientFilter>
<recipeUsers>
<li>TableTailor</li>
</recipeUsers>
</RecipeDef>

</RecipeDefs>

Pages: [1]