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 - kwang4

#1
I looked at the old 1.2 assemblies, and essentially copied the beginScrollView and EndScrollView methods.

  public override void DoSettingsWindowContents(Rect inRect)
        {
            Listing_Standard listingStandard = new Listing_Standard();
            Widgets.BeginScrollView(inRect, ref scrollPos, scrollRect);
            inRect.height = 100000f;
            inRect.width -= 20;
            scrollRect = new Rect(0f, 0f, inRect.width, listingStandard.CurHeight+100);

            //Actual ui stuff here

            Widgets.EndScrollView();
            listingStandard.End();

            base.DoSettingsWindowContents(inRect);

        }
#2
Help / [Solved] 1.3 ListingStandard Scroll issue
July 19, 2021, 07:42:35 PM
So it looks like for 1.3, they removed listingStandard.BeginScrollView and EndScrollView. It's pretty easy to just reimplement BeginScrollView, but EndScrollView does some witchcraft with some protected variables (Listing.listingRect and listing.curY) Is there a new way to do scrolling views as simply as in 1.2? My current settings window has just a  tad too many things to completely fit without scrolling.
#3
I have a job driver that essentially walks a pawn up to a downed pawn, then stabs their heart. However, so far when my colonist does that to a downed friendly, like a trader caravan from another faction, I can't seem to figure out how to cause a negative reaction from said faction, like lowering relations.

Here's the toil that should cause a negative reaction:
           yield return new Toil
            {
                initAction = () =>
                {
                    BodyPartRecord bodyPart = null;
                    foreach (BodyPartRecord part in Victim.health.hediffSet.GetNotMissingParts())
                    {
                        foreach (BodyPartTagDef tag in part.def.tags)
                        {
                            if (tag.vital && tag.defName == "BloodPumpingSource")
                            {
                                bodyPart = part;
                                break;
                            }
                        }
                        if (bodyPart != null)
                            break;
                    }
                    while (!bodyPart.parent.IsCorePart)
                    {
                        bodyPart = bodyPart.parent;
                    }
                    if (bodyPart != null)
                    {

                        DamageDef damageDef = DefDatabase<DamageDef>.GetNamed("Stab");
                        DamageInfo damage = new DamageInfo(damageDef, 1000, 999, -1f, null, bodyPart, null, DamageInfo.SourceCategory.ThingOrUnknown, null);
                     
                        Hediff_Injury hediff = (Hediff_Injury)HediffMaker.MakeHediff(HediffDefOf.Stab, Victim, bodyPart);
                        hediff.Severity = 1000f;
                        Victim.health.AddHediff(hediff);
                    }
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            };



Is there some check I should add here to check for rival faction then change relations? Apologies if this is a basic question, coming back from a rimworld hiatus  ;D
#4
Help / Re: C# Help with Gizmos
July 16, 2020, 12:42:53 PM
I would like to state that I am an idiot. The code for gizmos was correct but the part for minAge in the 18 option was referencing an null object. Leaving this here in case anyone wants working code for making building gizmos.
#5
Help / [Solved]C# Help with Gizmos
July 16, 2020, 12:25:15 PM
Currently modifying QEE to add a small gizmo to clone vat so I can choose what age the clone should be. So far I have

yield return new Command_Action()
            {
                defaultLabel = "Age: " + (old ? "18" : "10"),
                defaultDesc = "Age of Vatgrown",
                icon = ContentFinder<Texture2D>.Get("Things/Item/Health/HealthItem", true),
                order = -100,
                action = () =>
                {
                    Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>()
                    {
                        new FloatMenuOption("18",()=>{minAge = pawnKindToGrow.RaceProps.lifeStageAges.Last().minAge;old = true;}),
                        new FloatMenuOption("10",()=>{minAge = 10f; old = false;})
                    }));
                }
            };

old is a boolean defined outside to change the age text.

In game switching from 18 to 10 works, but when I click the 18 option it gives me this error:

https://imgur.com/a/UmzggOs

Messed around with the code for a bit, seems that the boolean isn't the problem, it's just the first float menu option. Stumped on how to fix it though.

Any help appreciated!
#6
Help / Re: C# methods of removing a hediff?
July 12, 2020, 11:17:54 AM
Ahh I get it now. Thanks for the clarification both of y'all!
The pregnant example was pretty hilarious
#7
Help / [Solved]C# methods of removing a hediff?
July 02, 2020, 10:17:22 PM
Somewhat basic, but I'm trying to remove a hediff from a dead body and returning an item. Method one is finding hediff name using DefDatabase and removing it, which works.

HediffDef h = DefDatabase<HediffDef>.GetNamed("ATPP_HediffVX2Chip");
innerPawn.health.hediffSet.hediffs.Remove(innerPawn.health.hediffSet.GetFirstHediffOfDef(h));


Second is creating a hediff with HediffMaker which has the correct hediffDef inside and targeting the pawn, but it never worked.

                HediffDef h = DefDatabase<HediffDef>.GetNamed("ATPP_HediffVX2Chip");
                Hediff hed = HediffMaker.MakeHediff(h, innerPawn, null);
                innerPawn.health.hediffSet.hediffs.Remove(hed);


Could someone explain why this doesn't work, and a possible fix to do it this way? Targeting and removing or adding hediffs has been a huge weakness of mine in rw modding for a while.
#8
Help / Modded Item Rarity?
March 17, 2019, 03:21:28 PM
So I made a simple drug that's basically like Luciferium, but also heals wounds on the fly. My question is whether there is any XML property that makes it less likely for raiders or traders to have this drug and less likely for raiders to be high on it, as I made it hard to obtain for colonists, and it would be unbalanced to have it be super common in the rest of the world.
#9
Basically, this item in the mod writes its own texture path, and doesn't inherit from a parent.

It defines its own texture here:
<graphicData>
<texPath>Things/Item/BodyPart/BasicProsthesis</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>


So you need PatchOperationReplace just to replace the texPath. What you're doing now creates this:

<ThingDef ParentName="Basic">
<defName>EyePatch</defName>
<label>eye patch</label>
<description>Covers the eye socket. Intimidating.</description>
<graphicData>
<texPath>Things/Item/BodyPart/BasicProsthesis</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
                 <graphicData>
<texPath>Things/Item/BodyPart/BasicProsthesis</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<statBases>
<MarketValue>65</MarketValue>
<Mass>0.3</Mass>
</statBases>
</ThingDef>


with 2 graphicData parts.
#10
Help / Re: Need help updating Xpath in Mod for 1.0
December 24, 2018, 10:40:37 AM
Use this xpath:
<xpath>*/ThingDef[defName = "TableButcher"]/graphicData</xpath>
#11
I went through the files and changed a few things. Most of it was good, you just had a few small errors hiding throughout your files that caused the failures.

1. The character "*" should be used by itself, like */ThingDefs. It doesn't work as "*Defs/ThingDefs".

2. In <texpath> the slashes are going the wrong way. It should be "/" not "\". That was a big error.

3. I'm not sure on this one, but I don't capitalize the d in defName. I just changed it to be safe, as  I know that lowercase works.

4. For the EPOE compatibility patch, I added the line <success>Always</success> to suppress errors from other people not having the mod.

I didn't do anything for the Vegetable mod cause I don't know what to do there.

File: https://www.dropbox.com/s/6jm7er31e4cimqo/JabbamonkeysGraphics.rar?dl=0
#12
Help / Re: Need help updating Xpath in Mod for 1.0
December 23, 2018, 03:48:53 PM
Okay two things. First, start of the xpath doesn't really work, you could either do "*/Defs/ThingDef" or perhaps "Defs/ThingDef" even though I didn't try that one yet. Second, if PatchOperationInsert isn't working, try patchOperationAdd, which is my personal preference. In this case, <shaderType> is in graphicData, so the graphicClass won't be needed, like :
<Operation Class="PatchOperationAdd"> <!-- "Adding CutoutComplex to TableButcher" -->
<xpath>Defs/ThingDef[DefName = "TableButcher"]/graphicData</xpath>
<value>
<shaderType>CutoutComplex</shaderType>
</value>
</Operation>

#13
 SimpleProstheticArm doesn't actually write out its own graphic information. Rather, like you stated, all prosthetic body parts inherit their texture from a parent thing. That means you have to add the whole chunk of graphicdata into the Def, which means you need PatchOperationAdd, like below

<li Class="PatchOperationAdd">

  <xpath>Defs/ThingDef[defName = "SimpleProstheticArm"]</xpath>
   <value>
     <graphicData>
        <texPath>Things\Item\BodyPart\SimpleProstheticArm</texPath>
        <graphicClass>Graphic_Single</graphicClass>
        <drawSize>0.80</drawSize>
     </graphicData>
   </value>

</li>


I basically copied the bit from BodyPartProstheticBase and changed the path. Do this for all the different body parts and you're all set.
#14
Help / Re: Need Help With Removing Config Error
December 21, 2018, 03:29:20 PM
It looks like you have a few extra <li> and </li> that don't need to be there, right after statOffsets. Try:
<?xml version="1.0" encoding="utf-8" ?>
<Defs>

  <HediffDef ParentName="AddedBodyPartBase">
    <defName>DroneBrain</defName>
    <label>drone brain</label>
    <labelNoun>a drone brain</labelNoun>
    <spawnThingOnRemoved>DroneBrain</spawnThingOnRemoved>
    <addedPartProps>
      <solid>true</solid>
      <partEfficiency>0.60</partEfficiency>
  <betterThanNatural>false</betterThanNatural>
    </addedPartProps>
    <stages>
<li>
<statOffsets>
<MentalBreakThreshold>-1</MentalBreakThreshold>
<PsychicSensitivity>-1</PsychicSensitivity>
<SocialImpact>-1</SocialImpact>
</statOffsets>
        <capMods>
    <li>
            <capacity>Manipulation</capacity>
            <offset>-0.10</offset>
          </li>
          <li>
            <capacity>Moving</capacity>
            <offset>-0.30</offset>
          </li>
        </capMods>
      </li>
    </stages>
  </HediffDef>

</Defs>
#15
Option one would be better, less code for the game to read.

Here's a little patch mod I made, attached below. outlines the three kinds of Graphics and issues you might encounter. Look through the different way I called the new texture locations in the patch, because there are really weird differences.
Main Points:

  • Graphic_Single only needs you to specify till the containing folder.
  • Graphic_Multi requires you to path inside of your containing folder. Ex: If folder is "Things/Buildings/Stuff", inside of it you'll have: Stuff_north, Stuff_east, Stuff_south. Your xpath for texturepath: "Things/Buildings/Stuff/Stuff
  • Graphic_StackCount is like Graphic_Single but you need: "ItemName_a" and "ItemName_b" in there.
The important thing is to make sure your path is right, because otherwise you'll keep getting errors.


As for metal textures, I really don't have much experience in stuff that detailed, I just know the basic structure of this stuff.

Also really sorry about the long response time, got caught up in life for a bit.

[attachment deleted due to age]