[Coder request] Rimsenal needs a coder!

Started by rooki1, September 20, 2015, 12:36:14 AM

Previous topic - Next topic

rooki1

Hello everyone! Rimsenal mod needs a coder for deepening experience.
The codes that I needed are here.

1. Apparel stat that changes wearer's body size.
- I need this code for making some sort of camouflage system.

2. Apparel stat that changes wearer's carrying capacity.
- To making items like backpacks and to recover the side effect of first code.

3. Apparel stat that gives fixed moving speed stat to its wearer.
- I'm thinking about making an Exo-suit. And this code is necessary to make it.

4. Code for making a stone eating creature.
-Someone gave this interesting idea to me.

Fluffy (l2032)

Just some general comments - I don't really have the time to actually do any of this.

1. I think that's better used as a separate stat, changing bodySize just for a specific side effect will mess with a lot of other things down the line. If implemented as a separate stat, requires changes in combat/shooting code, might be a good idea for a plug in mod to Combat Realism.

2. Wouldn't use it to offset 1, but in general it's a good idea. Probably requires changing pawn code, which will be difficult to do while maintaining compatibility with other mods.

3. Good idea. Probably requires changing pawn code, which will be difficult to do while maintaining compatibility with other mods.

4. Good idea, might want to have a look at the Feenix code in my Cats! mod, it feeds on fire. Requires overriding pawn code, but since it's for one (group of) animals only, shouldn't give a compatibility problem.

BBream

1. I cannot find how to change wearer's body size. It is fixed in Pawn.BodySize and RaceProps.baseBodySize. So if you want to make camouflage system then you may make new apparel class and implement it in the class. And if you don't mind, I want to listen about camouflage system.

2,3. Easy way: You can find equippedStatOffsets in Apparel thingDef. So you can give offset of carrying capacity and moving speed. But if 1 is not implementable, then I think you don't need to modify carrying capacity.
So if you want to modify carrying capacity or moving speed then you make new xml file. This is example. You can find apparel xml file in Core/Defs/ThingDefs/Apparel_Various. This example is not tested so you should check it is worked.


<ThingDef ParentName="ApparelMakeableBase">
    <defName>Apparel_Duster</defName>
...
    <equippedStatOffsets>
      <MoveSpeed>-0.04</MoveSpeed>
      <CarryingCapacity>30</CarryingCapacity>
    </equippedStatOffsets>
...
  </ThingDef>


I cannot find way to make moving speed value fixed but I have idea for this.
you can adjust moving value in PawnCapacityDef by appling hediff you define for it.
This is code in Core/Defs/HediffDefs/Hediffs_Drugs. This hediff modify 'Manipulation' so you can use it for fixing moving value.


  <HediffDef>
    <defName>Alcohol</defName>
    <hediffClass>Hediff_Alcohol</hediffClass>
    <label>alcohol</label>
    <defaultLabelColor>(1,0,0.5)</defaultLabelColor>
    <initialSeverity>0.15</initialSeverity>
    <severityPerDay>-0.5</severityPerDay>
    <comps>
      <li>
        <compClass>HediffComp_Effecter</compClass>
        <stateEffecter>Drunk</stateEffecter>
        <severityIndices>
          <min>3</min>
          <max>5</max>
        </severityIndices>
      </li>
    </comps>
      <stages>
        <li>
          <label>buzzed-hidden</label>
          <everVisible>false</everVisible>
        </li>
        <li>
          <minSeverity>0.1</minSeverity>
          <label>warm</label>
          <painFactor>0.9</painFactor>
            <capMods>
              <li>
                <capacity>Manipulation</capacity>
                <offset>-0.02</offset>
              </li>
            </capMods>
        </li>
        <li>
          <minSeverity>0.25</minSeverity>
          <label>tipsy</label>
          <painFactor>0.8</painFactor>
            <capMods>
              <li>
                <capacity>Consciousness</capacity>
                <offset>-0.10</offset>
              </li>
            </capMods>
        </li>
        <li>
          <minSeverity>0.4</minSeverity>
          <label>drunk</label>
          <painFactor>0.5</painFactor>
          <vomitMtbDays>1.5</vomitMtbDays>
          <tale>Drunk</tale>
            <capMods>
              <li>
                <capacity>Consciousness</capacity>
                <offset>-0.35</offset>
              </li>
            </capMods>
        </li>
        <li>
          <minSeverity>0.7</minSeverity>
          <label>hammered</label>
          <painFactor>0.3</painFactor>
          <vomitMtbDays>0.4</vomitMtbDays>
          <painOffset>0.05</painOffset>
            <capMods>
              <li>
                <capacity>Consciousness</capacity>
                <offset>-0.60</offset>
              </li>
            </capMods>
        </li>
        <li>
          <minSeverity>0.9</minSeverity>
          <label>blackout</label>
          <painFactor>0.1</painFactor>
            <capMods>
              <li>
                <capacity>Consciousness</capacity>
                <setMax>0.1</setMax>
              </li>
            </capMods>
        </li>
      </stages>
  </HediffDef>


This is logic for implementation.

0. Check apparel has wearer. If apparel is put off or wear off then remove hediff.
1. Check moving speed in Tick method of your own apparel class.
2. If moving speed is changed fixed value then modify moving PawnCapacity by appling new hediff.
3. Update hediff's severity so make hediff's value not changed.

This implementation make moving value roughly fixed because of hediff's mechanism.

4. It can be implemented by adding Comp class. But creature will manually eat stone because it don't modify JobGiver_GetFood. I don't know what you want to make so please tell me why creature eat stone.

Shinzy

Quote from: BBream on September 22, 2015, 06:23:57 AM

2,3. Easy way: You can find equippedStatOffsets in Apparel thingDef. So you can give offset of carrying capacity and moving speed. But if 1 is not implementable, then I think you don't need to modify carrying capacity.
So if you want to modify carrying capacity or moving speed then you make new xml file. This is example. You can find apparel xml file in Core/Defs/ThingDefs/Apparel_Various. This example is not tested so you should check it is worked.

Modifying this stat won't help the pawn to carry any extra beyond 1 stack of items
so you'd need a proper code for this

«Temple»

I can do one of those(moving speed is the one I can do because its really simple).