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

#1
Mods / Re: [MOD REQUEST] Meat Fermentation.
April 03, 2020, 08:52:02 AM
Quote from: daemonfool on May 14, 2019, 04:36:30 PM
It sounds gross right?  Also awesome.

You've distilled the essence of modding into 37 character. I salute you.
#2
One way you might be able to accomplish this is by creating a new Trait that all of your aliens share, e.g. "Alien Psychology".

For instance, see the DrugDesire TraitDef below:
<TraitDef>
    <defName>DrugDesire</defName>
    <commonality>3</commonality>
    <degreeDatas>
      <li>
        <label>chemical fascination</label>
        <description>[PAWN_nameDef] is utterly fascinated with chemical sources of enjoyment. Consuming recreational drugs will create a good mood, while abstaining will lead to increasing frustration over time and possibly drug binges. [PAWN_pronoun] will ignore directives to not use recreational drugs, and will consume more than a normal person.</description>
        <degree>2</degree>
        <marketValueFactorOffset>-0.15</marketValueFactorOffset>
      </li>
      <li>
        <label>chemical interest</label>
        <description>[PAWN_nameDef] has an unusual interest in chemical sources of enjoyment. Consuming recreational drugs will create a good mood, while abstaining will lead to increasing frustration over time and possible drug binges. [PAWN_pronoun] will ignore directives to not use recreational drugs, and will consume more than a normal person.</description>
        <degree>1</degree>
        <marketValueFactorOffset>-0.10</marketValueFactorOffset>
      </li>
      <li>
        <label>teetotaler</label>
        <description>[PAWN_nameDef] abhors the idea of gaining pleasure from chemicals. [PAWN_pronoun] strictly avoids alcohol and recreational drugs.</description>
        <degree>-1</degree>
        <disallowedMentalStates>
          <li>Binging_DrugExtreme</li>
          <li>Binging_DrugMajor</li>
        </disallowedMentalStates>
      </li>
    </degreeDatas>
  </TraitDef>


You'll notice one of the degreeDatas is teetotaler
<li>
        <label>teetotaler</label>
        <description>[PAWN_nameDef] abhors the idea of gaining pleasure from chemicals. [PAWN_pronoun] strictly avoids alcohol and recreational drugs.</description>
        <degree>-1</degree>
        <disallowedMentalStates>
          <li>Binging_DrugExtreme</li>
          <li>Binging_DrugMajor</li>
        </disallowedMentalStates>
      </li>

where teetotaler prevents anyone with that trait from suffering the Binging_DrugExtreme or Binging_DrugMajor breaks.

I've never done this before, but if you created your own Trait called Alien Psychology and assigned it to your aliens, then inside the <disallowedMentalStates>...</disallowedMentalStates> block listed out all the mental breaks that don't apply to your aliens... maybe that would do it? Then all you'd have to do is figure out how to assign your new trait to every member of your alien race, and no member of any other race.
#3
UniRx works beautifully, though it's a pain to acquire since it's only available on the Unity Assets Store (it is free, though).

Now I can do fun stuff like this:

private IObservable<bool> RowsBecameValidFactory()
        {
            bool lastValidityState = false; // can start false because after a new row is added, it will always be invalid

            // observable that emits when the list's rows go from "not all being valid" to "all being valid"
            return rows.ToObservable()
                .SelectMany(u => u.RowBecameValid)
                .Select(u => rows.All(v => v.IsValid()))
                .Where(curValidityState =>
                {
                    bool validityStateChanged = curValidityState != lastValidityState;
                    lastValidityState = curValidityState;
                    return validityStateChanged && curValidityState;
                }
            );
        }


I'm working on a GUI dialog box that contains a list component which in turn contains row components. Each row has a "RowBecameValid" Observable that fires whenever the row goes from invalid to valid. The above snippet is taking all those "RowBecameValid" Observables and combining them into an "AllRowsBecameValid" Observable that my list component can use. So now instead of having to poll to see if my rows became valid, or rolling out my own callback/event management code (ughh...), I can just use UniRx! Yay.
#4
No problem.  :)

Yeah, the message implies he wants to keep non-explosives from having an FMR; looks like forcing explosives to have one is just a side effect that only reveals itself when modding (which, for a game that officially supports modding, I think would be a bug).

That said, I think the clause would need to be changed from
forcedMissRadius > 0f != CausesExplosion
to
!CausesExplosion && forcedMissRadius > 0f

If it's changed to
forcedMissRadius >= 0f != CausesExplosion
then the error will throw for any non-explosive gun, as they all have FMR of 0. So 'forcedMissRadius >= 0f' would be true, 'CausesExplosion' would be false, and the resulting 'true != false' would be true, resulting in the error. I think. Could be wrong.
#5
I know decompiling the source code is common practice in the RW mod community, and it's specifically allowed in the RW EULA. https://rimworldgame.com/eula/

QuoteYou're allowed to 'decompile' our game assets and look through our code, art, sound, and other resources for learning purposes, or to use our resources as a basis or reference for a Mod. However, you're not allowed to rip these resources out and pass them around independently.

My question is this: are we allowed to post decompiled source code on these forums?
#6
Verse.VerbProperties.ConfigErrors is the source of that error. As the name suggests, the method is responsible in part for validating Verb properties, e.g. forcedMissRadius.

The code responsible is:
if (LaunchesProjectile && defaultProjectile != null && forcedMissRadius > 0f != CausesExplosion)
{
yield return "has incorrect forcedMiss settings; explosive projectiles and only explosive projectiles should have forced miss enabled";
}


and specifically this clause:
forcedMissRadius > 0f != CausesExplosion

So, unfortunately, if CausesExplosion is true, forcedMissRadius must be greater than zero or this method will yield an error message. That said, it's not clear to me exactly what the practical repercussions of this yielded error are. There may be none. It may simply be informational. That would line up with your observation that FMR appears to have been removed successfully.

I haven't used Harmony yet, but you may be able to patch Verse.VerbProperties.ConfigErrors to filter out that error, or something. Can't help with the details there.
#7
Mods / Re: Mod suggestion - pay for your electricity
March 27, 2020, 09:57:14 PM
Every morning little Jimmy skips over from Rimville to top off all your batteries.
#8
Great job! Sounds like a very thorough mod. Without diabetes RimWorld was basically a Utopia. Fixed that right up.  :P
#9
Mods / Re: Mod suggestion - alternative currencies
March 25, 2020, 05:04:48 AM
Will our RW colonies be minting their own cash and developing their own crypto-currencies, or will they be tying into existing, inter-planetary systems? LWM's point is a valid one if the RW colony is minting its own cash and developing its own crypto-currency, but it's not as valid if the colony would be tying into an existing system.

If my colony becomes a major economic power and reaches the point of developing crypto-currency, you'd expect allies and such to accept and trade in this currency, but to LWM's point, a passing starship almost certainly would not accept our currency. It took that ship 25 years to get to the RW, will take it 25 years to get back to Earth, then another 25 years to get back to the RW. Considering that the currency is backed by my colony's gold/political power/military power/whatever, it will become worthless when the colony vanishes. To the merchant in the starship, the only payment that makes sense is silver, gold, or physical merchandise, the value of which does not depend on the continued existence of the colony.

For a great case-study in the development of a questionable crypto-currency by a volatile political/economic entity, check out the Venezuelan Petro:
https://en.wikipedia.org/wiki/Petro_(cryptocurrency)
#10
Neither have I done it, but it looks fairly straightforward. Does require some C# though.

Create a new mod in the RimWorld Mods folder and a new solution; follow this tutorial if you don't know what that's about:

https://rimworldwiki.com/wiki/Modding_Tutorials/Setting_up_a_solution

You'll need the following folders in your Mods root directory: About, Assemblies, Source, and Defs. Inside Defs create a folder called Rooms, and inside Rooms create a file called RoomRoles.xml.

The inside of your RoomRoles.xml will need to look something like this:

<?xml version="1.0" encoding="utf-8" ?>
<Defs>
    <RoomRoleDef>
        <defName>Chapel</defName>
        <label>chapel</label>
        <workerClass>RockinRooms.RoomRoleWorker_Chapel</workerClass>
        <relatedStats>
            <li>Beauty</li>
            <li>Cleanliness</li>
            <li>Wealth</li>
            <li>Space</li>
            <li>Impressiveness</li>
        </relatedStats>
    </RoomRoleDef>
</Defs>


Notice the "<workerClass>RockinRooms.RoomRoleWorker_Chapel</workerClass>" line in the XML snippet above. That should be the namespace and class name of whatever class you make. If you have a decompiler, you can use "RimWorld.RoomRoleWorker_DiningRoom," "RimWorld.RoomRoleWorker_Hospital," or any other RoomRoleWorker as an example.

The GetScore method is basically a method that looks at all the stuff in a room and tallies up a score based on whatever it finds. When RimWorld is trying to decide what type of room something is, it pulls in all these Defs and RoomRoleWorker classes and executes their GetScore method. The RoomRoleWorker with the highest score is the winner, and the room will then be that type. For details, check out the Verse.Room.UpdateRoomStatsAndRole() method in the decompiled code.

What that means to you is that your Def and C# class will be automagically pulled in, and your GetScore method will compete against all the other RoomRoleWorker GetScore methods. The trick is to balance your GetScore method so that when the room genuinely looks like a Chapel, Chapel wins, and when it doesn't look like a Chapel, Chapel loses to something else.

Never done this before myself, so if my instructions are derped up or unclear, feel free to reply with questions.

The idea is interesting. RimWorld has many things, but it has a marked lack of religion. Pretty noticeable omission for a life simulator in my opinion.
#11
Check out these two methods in the decompiled code:
Building_Vent.TickRare which calls GenTemperature.EqualizeTemperaturesThroughBuilding

When you look at GenTemperature.EqualizeTemperaturesThroughBuilding you'll notice this line
IntVec3 intVec = (i == 0) ? (b.Position + b.Rotation.FacingCell) : (b.Position - b.Rotation.FacingCell);
which is responsible for the forward/backward locations of the vent. I'm a beginner modder myself, but I'm willing to bet the easiest way forward for you would be to create a new vent building that equalizes temperature at a 90 degree angle instead of what the vent currently does. Give that a shot?
#12
Tried to include System.Reactive but discovered it isn't compatible with Mono. Does anyone here use any good Reactive implementations? I've heard of UniRx and will be giving it a shot, but if you have thoughts, suggestions, warnings, threats, or experience I'd love to hear them.
#13
Quote from: LWM on March 15, 2020, 12:42:07 AM
...feel free to update anything in the wiki, by the way.

Done. Thanks for the info!
#14
Makes sense. I made a tiny mod to make the Restrict panel wider. If you want to give it a try, download the attachment, unzip it, and drop it in your mods folder. If it's annoyingly wide, feel free to go in to the mod and change the minWidth value to your liking.
#15
General Discussion / Re: Why unroofed?
March 14, 2020, 11:46:02 PM
Mountains and caves have a natural roof over them. There's a button on the main UI, in the bottom right corner, you can toggle on to see roofs. There's also a little message in the bottom left corner if you don't have any menus open that displays the roof type. See attached images for pictures of everything described.