Ludeon Forums

Ludeon Forums

  • December 05, 2021, 04:08:53 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 - Lockdown

Pages: [1]
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
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.

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

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

5
Help / Designator woes
« on: August 27, 2016, 11:38:36 PM »
I'm creating a couple of designators to mass forbid/unforbid blueprints, because drag-select is atrocious for it, as it'll prioritize selecting any resource or animal that happens to be over your blueprints.

I've used Designator_Claim as a base, and successfully edited it to the intended functionality. But, the forbid blueprint designator, in addition to being available from the Orders tab, also shows up when I select an individual blueprint, which is redundant, as the F button is already there for that. Is there a way to remove my designator from there, so it only appears in the Orders tab?

Designator class, if needed for reference:
Code: [Select]
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Verse;

namespace ForbidBlueprints
{
public class Designator_ForbidBlueprint : Designator
    {
        public override int DraggableDimensions
        {
            get
            {
                return 2;
            }
        }

        public Designator_ForbidBlueprint()
        {
            this.defaultLabel = "Forbid blueprints";
            this.defaultDesc = "Sets blueprints within area to forbidden";
            this.icon = ContentFinder<Texture2D>.Get("UI/Designators/Claim", true);
            this.soundDragSustain = SoundDefOf.DesignateDragStandard;
            this.soundDragChanged = SoundDefOf.DesignateDragStandardChanged;
            this.useMouseIcon = true;
            this.soundSucceeded = SoundDefOf.DesignateClaim;
            //this.hotKey = KeyBindingDefOf.Misc4;
        }

        public override AcceptanceReport CanDesignateCell(IntVec3 c)
        {
            if (!c.InBounds())
            {
                return false;
            }
            if (c.Fogged())
            {
                return false;
            }
            if (!(from t in c.GetThingList() where this.CanDesignateThing(t).Accepted select t).Any<Thing>())
            {
                return "Must designate blueprints.";
            }
            return true;
        }

        public override void DesignateSingleCell(IntVec3 c)
        {
            List<Thing> thingList = c.GetThingList();
            for (int i = 0; i < thingList.Count; i++)
            {
                if (this.CanDesignateThing(thingList[i]).Accepted)
                {
                    this.DesignateThing(thingList[i]);
                }
            }
        }

        public override AcceptanceReport CanDesignateThing(Thing t)
        {
            Blueprint blueprint = t as Blueprint;

            if (blueprint != null && blueprint.Faction == Faction.OfPlayer && blueprint.def.IsBlueprint)
            {
                return true;
            }
            return false;
        }

        public override void DesignateThing(Thing t)
        {
            if (ForbidUtility.IsForbidden(t, Faction.OfPlayer) == false)
            {
                ForbidUtility.SetForbidden(t, true, true);
            }
           
        }
    }
}

6
Help / Adding a field to an existing core class
« on: August 23, 2016, 12:45:12 PM »
I'm making a mod that adds a food selector, similar to the medicine selector. Looking at how medicine is implemented, I would need to add an additional field to Pawn_PlayerSettings so that each pawn instance remembers their current food restriction. Given that it's not possible to detour the entire Pawn_PlayerSettings class in order to add an extra field, what would be the best option to add this functionality, while keeping compatibility with other mods in mind?

7
Help / Detour tutorial?
« on: August 21, 2016, 11:11:49 AM »
Trying to learn how to use detours using CCL. I've looked at a couple mods that rely on them, but they do a lot more than I'm looking for, and it's hard to figure out what exactly do I need to detour just one given class. Are there any tutorials or very simple mods, that I could follow to learn the basics?

8
Help / Overwriting core classes
« on: June 18, 2016, 06:40:37 PM »
I'm trying to make a simple mod that adds a Max Skill Level slider to the bill configuration window, in addition to the existing Min Skill Level. I've identified the classes that need to be edited (RimWorld.Bill and RimWorld.Dialog_BillConfig), and having read through the wiki's tutorials, I understand that I need to make an XML definition so that the game loads my modified classes instead of the Core ones.

However, for the life of me I can't figure out where the XML defs reference either of these classes. Dialog_BillConfig doesn't even seem to be present anywhere in \Mods\Core\Defs, and Bill shows up in a few places but none of them pointing towards the Bill class. I know they're supposed to be referenced somewhere, because I've seen some definitions that work this way (for example, HaulToCell lists JobDriver_HaulToCell as its class) but that doesn't seem to be the case for the bill classes. Are these just not possible to mod, or am I missing something here?

Pages: [1]