Ludeon Forums

Ludeon Forums

  • December 05, 2021, 08:44:27 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.

Messages - Lockdown

Pages: [1] 2 3 ... 5
1
There is this def in vanilla:
Code: [Select]
  <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:

Code: [Select]
<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:

Code: [Select]
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
Bugs / [1.0] Trap rearm state isn't kept through save/load cycles
« on: May 12, 2019, 06:29:14 PM »
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
« on: 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
« on: September 05, 2016, 07:18:25 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
« on: 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
« on: 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
« on: 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:

Code: [Select]
<?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
Help / Re: rimworld dll modding: getting the pawn that used an item
« on: September 01, 2016, 02:46:29 PM »
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
Help / Re: rimworld dll modding: getting the pawn that used an item
« on: September 01, 2016, 01:10:08 PM »
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
« on: 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
« on: August 30, 2016, 07:09:45 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
« on: August 30, 2016, 04:05:30 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
Help / Re: Overwrite Default Game Classes/Functions in C#?
« on: August 28, 2016, 10:32:19 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.

How 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.

Pages: [1] 2 3 ... 5