Menu

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.

Show posts Menu

Messages - Lockdown

#1
There is this def in vanilla:
  <DesignationCategoryDef>
    <defName>Structure</defName>
    <label>structure</label>
    <order>700</order>
    <specialDesignatorClasses>
      <li>Designator_Cancel</li>
      <li>Designator_Deconstruct</li>
      <li>Designator_RemoveBridge</li>
    </specialDesignatorClasses>
  </DesignationCategoryDef>


I want to remove just <li>Designator_RemoveBridge</li> from the specialDesignatorClasses. I've tried implementing the operation as such:

<Operation Class="PatchOperationRemove">
<xpath>*/DesignationCategoryDef[defName="Structure"]/specialDesignatorClasses[li="Designator_RemoveBridge"]</xpath>
</Operation>


But that removes the entire specialDesignatorClasses element, not just the specified <li>. How can I target just that li and leave its parent alone?
#2
For clarity, this bug occurs even when the "Toggle automatic rebuild of destroyed structures in the home area" is disabled. And even traps outside the home area get their rearm state overriden on game load, they just override to false instead of true.

As far as I understand, the bug happens because of these two methods in Building_Trap:

public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look<bool>(ref this.autoRearm, "autoRearm", false, false);
Scribe_Collections.Look<Pawn>(ref this.touchingPawns, "testees", LookMode.Reference, new object[0]);
}

public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
base.SpawnSetup(map, respawningAfterLoad);
this.autoRearm = (this.CanSetAutoRearm && map.areaManager.Home[base.Position]);
}


On game load, ExposeData is called first, setting the autoRearm state based on whatever the player had set them to, but then SpawnSetup overrides autoRearm to true if inside home area, false otherwise. The solution is to have SpawnSetup only initialize autoRearm if respawningAfterLoad == false, not every single time. That way, rearm states should be perserved through save/load cycles.
#3
1. Build a trap, and disable auto-rearm.
2. Save game, quit to main menu, then reload game.
3. Trap has auto-rearm enabled again.
#4
Outdated / Re: [A14] Community Core Library v0.14.3.1
September 08, 2016, 04:09:33 AM
You realize that a considerable amount of work has already been put into Rimworld to give it mod support, right? True, some players are not taking advantage of that, but it doesn't change the fact that mod support is a selling point in itself, and it's worth the time improving it.
#5
Outdated / Re: [A14] Community Core Library v0.14.3.1
September 05, 2016, 07:18:25 PM
Quote from: CannibarRechter on September 05, 2016, 03:55:52 PM
Hey, guys, I am staring at Detours.TryDetourFromTo right now, and am noticing this method is largely self-contained. I was mulling over taking it out and using it separately (I am currently wanting to play a mod who's sole dependency is this CCL class), but of course this is unsafe code using pointer arithmetic and some pointer arithmetic I don't quite follow.

Is the pointer math likely to still be good?

I would simply try it, but as this is unmanaged code, errors here have the potential to hard crash the .NET CLR...

It does work if you copy it over, you just have to set your project to allow unsafe code.
#6
Help / Re: Overwrite translations
September 05, 2016, 10:35:25 AM
There's no code, I was trying to modify the display text of a core Alert class. I guess it doesn't work because it's out of scope.

In the end, I disabled the core alert and created a new one with its own translations.
#7
Help / Overwrite translations
September 03, 2016, 12:04:35 PM
Is it not possible to overwrite translations with a mod? When I try, I get a "duplicate code-linked translation key" warning, and the game still uses the string from Core, not from my mod.
#8
Help / Re: Adding Main Tabs
September 01, 2016, 02:55:22 PM
Have you forgotten to activate your new mod, perhaps?  :P

I just tried defining a new tab in one of my mods like this, and it showed up:

<?xml version="1.0" encoding="utf-8" ?>
<MainTabDefs>

  <MainTabDef>
    <defName>ResearchDUPLICATE</defName>
    <label>test research tab</label>
    <description>Examine and decide on research projects.</description>
    <windowClass>MainTabWindow_Research</windowClass>
    <order>100</order>
  </MainTabDef>

</MainTabDefs>
#9
How would it not know which pawn? The pawn instance is given to you by PostIngested, you just have it clear their addictions in that method.

Post your code if you're still having trouble getting it to work.
#10
It depends on exactly what type of item you're referring to. You mentioned drugs as an example, which is a consumable, so you'd want to override the PostIngested(Pawn ingester) method in your item's Thing class. The ingester parameter will be whatever pawn just ate it.
#11
Help / Overriding Alert_HunterLacksRangedWeapon
September 01, 2016, 01:00:00 PM
I want to change the behaviour of the Alert_HunterLacksRangedWeapon class, but it doesn't look like alerts are defined in XML, and strangely, this class isn't even referenced anywhere in the core code, either. What is even instancing it, and is there any way to replace it with my modified class without resorting to detouring its methods?

This is needed for a melee hunting mod. So far I've managed to make pawns hunt with melee weapons by redefining the hunter WorkGiverDef with a custom class, but the "Hunter Lacks Ranged Weapon" alert is displayed because it's using the core WorkGiver_HunterHunt class to check the pawn's equipped weapon, instead of the new class I made.
#12
Outdated / Re: [A14] Community Core Library v0.14.3.1
August 30, 2016, 07:09:45 PM
Quote from: 1000101 on August 30, 2016, 05:29:03 PM
Quote from: Lockdown on August 30, 2016, 04:05:30 PM
Quote from: mordan on August 29, 2016, 02:44:05 PM
I noticed Fluffys Work Tab was doing that for me too and filed an issue on his github, but then noticed that a lot of the mods I use, do revert back to their default state even the minimap... So yeah, maybe this is a CCL issue after all.

I have the issue with the minimap as well, but Fluffy's Work Tab works correctly except for its MCM settings. Could never quite figure out if the bug is within CCL's implementation of MCM, or from something it borrows from the base game.

There is no question there nor is there any real bug report.

Alright? Not sure what you're trying to say, I was just letting mordan know that the MCM settings not persisting may not be necessarily related to Work Tab's priority resets.
#13
Outdated / Re: [A14] Community Core Library v0.14.3.1
August 30, 2016, 04:05:30 PM
Quote from: mordan on August 29, 2016, 02:44:05 PM
I noticed Fluffys Work Tab was doing that for me too and filed an issue on his github, but then noticed that a lot of the mods I use, do revert back to their default state even the minimap... So yeah, maybe this is a CCL issue after all.

I have the issue with the minimap as well, but Fluffy's Work Tab works correctly except for its MCM settings. Could never quite figure out if the bug is within CCL's implementation of MCM, or from something it borrows from the base game.
#14
You can disable updates on a game-by-game basis in Steam, so it doesn't happen in the future without your consent. But using the Steam Workshop for mods is a really bad idea if you want to finish your current A14 colony. As soon as one of the mods you're using updates to A15, Steam will forcibly update it and ruin everything.
#15
Quote from: MikeLemmer on August 28, 2016, 08:26:13 AM
I'm writing a mod that puts more info in the tooltips of the work priority window. However, it looks like to do that, I need to modify one of the functions in the C# coding itself. Is that feasible? How much would it conflict with other mods?

Class methods from the core game can be detoured into your own methods to give them different functionality. This is most easily done with the help of CCL, here's a quick tutorial by JaxelT to get you started.

Quote from: MikeLemmer on August 28, 2016, 08:26:13 AMHow much would it conflict with other mods?

You won't be able to have multiple mods installed that detour the same core method without some functionality being lost, from what I understand.