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

Topics - Mari

#1
Help / Changing the layers for rendering apparel
July 08, 2017, 11:39:32 PM
Heya,

I was wondering how I might go about adding/changing layers for clothing. As of now, Rimworld has 5 layers defined in ApparelLayer:

OnSkin,
Middle,
Shell,
Belt,
Overhead

These are a bit random and not very useful, especially when you get a lot of mods adding things to different layers. What I want to do is reclassify the layers to something more reasonable, such as the following:

Naked Body > Onskin/Underwear > Shirts > Pants > Jackets > Head Graphic > Hair > Hats > Accessories (jewelry, scarves, belts, etc)

The purpose would be ultimately for integrating it with prepare carefully so that you could dress up your pawns in a more more reasonable and intuitive way without conflicts that make no sense, plus add a lot more fashionable accessories and variety of clothing items. As of now, for example, there are a lot pants that for some reason can't be worn over certain bottom clothing, or conflict with tops which are on the same layer, while meanwhile you can wear pants under your pants because some pants are classified as pants while some are middle clothing, and on top of that skirts are shell clothing so you can wear a skirt over your two pairs of pants but not with a jacket.

I imagine it isn't as simple as just changing it in ApparelLayer, do I have to override, say, PawnRender.RenderPawnInternal? With my mediocre understanding of the Rimworld codebase and C# in general, I can't work out what's going on in that method at all. Are there any other places where it would need to be updated (opening up some massive can of worms to be untangled)? Patching the clothes themselves to follow the new structure should be trivially easy, and I'm pretty confident I can figure out how to patch prepare carefully, but last time I made one of these dll mods back in a14 I spent like 3 days just trying to trace back the entire structure of how Rimworld runs and what classes do what so I could figure out where I need to actually make a change, so I'd like to avoid that this time around. Thanks for any info that might help me out!
#2
Outdated / [A14]Bodytypes Config (v1.0.1)
August 14, 2016, 05:08:06 AM
Bodytypes Config
Author: Mari
Powered By

Have you ever been annoyed that despite doing hard labor on a daily basis, your colonists are still 300 pounds overweight, found it unrealistic that your female colonists are built like the Incredible Hulk, or tried to make a custom colonist but the backstory you wanted came packaged with a bodytype that completely clashed with the character you had in mind? I know I have. If so, this is the mod for you! Bodytypes Config adds a custom configuration menu to the game that allows you to replace the bodytypes of your colonists globally or on a single backstory basis.


Features:

--Replace the bodytype of all pawns of a specific bodytype-gender combination. For example, you can choose to set all female pawns that would spawn with the Hulk bodytype to spawn instead with the Female bodytype. You can even set all male pawns to spawn with Female bodies or vice versa, if that's what you're into. (Male bodies are a good alternative to Hulk for female pawns with a slightly more muscular build).

--Replace the bodytype of each backstory on an individual basis for male and female pawns. These settings will be applied AFTER the general settings, meaning if you want all Fat pawns to appear as Thin, except for the Midworld Chef, you can do that. Combining the two settings you can get almost full control over the bodytypes of your colonists.

--In-game config menu using CCL's ModConfigurationMenus. This means you can change your settings without a restart and they will save between sessions. You can also manually configure the settings via an xml file in the same folder as your RimWorld saves directory, if for some reason you wanted to do that.


Required:

--The Community Core Library is required for this mod to function. It must be installed and loaded BEFORE this mod.


Known Issues:

--At the moment, certain preset pawns/name in the game colonists (as well as their hardcoded backstories) cannot be altered, and I have no idea how to fix this. You will occasionally see these colonists in your games despite them breaking the bodytype rules you have enabled. If anyone knows where these pawns are defined in the code or how to mod them please let me know and I'll try to patch it.

--Bodytypes cannot be edited on a per pawn basis (for example with Prepare Carefully). Bodytype is hardcoded to backstory, and therefore it may be impossible for this to ever happen.


Compatibility:

--Other backstory mods: Unfortunately at this time they are not compatible for the most part, however they will not break the game, the added backstories will simply not be available. Partially compatible as of 1.0.1, the additional backstories will appear in game and you shouldn't get any errors, however they will NOT have their associated bodytypes replaced at this time. You can edit them manually though in that mod's BackstoryDefs folder. You should load these mods BEFORE this mod and EdB Prepare Carefully.

--Clothing mods: Work fine.

--EdB Prepare Carefully: Works for the most part, and is highly recommended. However, Prepare Carefully lets you access several backstories related to special or name in game pawns. As previously mentioned, these cannot be modified and may break your configured rules. As a rule of thumb, if it isn't in the "Choose a backstory..." menu on the Bodytypes config menu, it cannot be changed.

--Savegames: In most cases should be fully compatible, and will even change your existing colonists. Yay!


Planned updates:

--Fix the issues with special and name in game pawns

--Add compatibility for additional backstory mods which use CCL's BackstoryDefs

--Attempt to hack a way to configure bodytypes for your individual pawns, for integration with EdB (Potentially impossible, but I have a few ideas)

--Possibly add a framework to mod in additional bodytypes beyond the vanilla ones? (Potentially impossible)

--Make the config menu less hideous


Installation and Download:

--Direct download: http://puu.sh/qBuaG/f0f33e98ed.zip
--Steam workshop: http://steamcommunity.com/sharedfiles/filedetails/?id=743764089

--To install, unzip to your mods folder. Make sure CCL is loaded before this mod.


Updates:

Quote--Aug. 14, updated to 1.0.1;
        --Fixed minor bug where some pawns would spawn with Undefined bodytypes.
        --Added partial compatibility with BackstoryDef mods.


License:

--Feel free to do whatever you want with it or use it as a basis for your own mods. I will post the source code whenever I stop being too lazy to make a github page.


For any bugs, questions, comments, or suggestions, please comment below! I am more active on steam than here though so, if you want a quick reply that's the best place.
#3
Help / CCL ModConfigurationMenu dropdown list?
August 11, 2016, 06:36:47 AM
Hello,

I am trying to work out the MCMs in CCL, and I am wondering if there is a way to include dropdown selection menus in it. I've been trying to mess around with it but my c# experience is pretty limited so setting up UI stuff is really confusing to me. What I am thinking of is something like:

http://puu.sh/qxnSA/f88f9c4a3c.png

where there are several settings, each with 6~ possible values in a dropdown menu, and also an additional pair of dropdowns at the bottom, one containing a list of a ton of specific settings and one with the possible values (the same possibilities for all of them). Selecting an item in the dropdown list would set the value of that setting to whatever was selected. I have been looking through a lot of the example code and other mods I could find which use the MCM, but I couldn't find any using dropdown menus. Failing that, a button which opens a FloatMenu, like in the main game config menu for temperature settings for example, would work just as well for the most part, but I also haven't seen one of those. If anyone has any idea and can help, I would appreciate it!

Thanks!
#4
Help / Help with body mod
August 08, 2016, 12:01:26 AM
Hello,

I didn't like my female colonists having the larger body types, so I tried to make a mod addressing this. I read on the forums that the body types are hardcoded based on the backstories, but I thought it might be possible. I (perhaps obviously) have very little experience with C# but my idea was basically to detour with CCL the method that loads in the backstories and then replace the body types before adding them to the dictionary, but for some reason it won't work the way I have it written. I suspect I am doing something obviously wrong, or it may just be impossible.

Here is my code:

using System;
using Verse;
using RimWorld;
using CommunityCoreLibrary;

namespace FemaleBodyTypes
{
[StaticConstructorOnStartup]
public class FemaleBodyTypes {

public FemaleBodyTypes() {
System.Reflection.MethodInfo method = typeof(BackstoryDatabase).GetMethod("ReloadAllBackstories", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
System.Reflection.MethodInfo method2 = typeof(FemaleBodyTypes).GetMethod("ReplaceBodyTypes", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
Detours.TryDetourFromTo(method, method2);
}

public static void ReplaceBodyTypes() {

foreach (Backstory current in XmlLoader.LoadXmlDataInResourcesFolder<Backstory>("Backstories/Shuffled"))
{
current.PostLoad();
current.ResolveReferences();

if (current.bodyTypeFemale == BodyType.Hulk) {
current.bodyTypeFemale = BodyType.Female;
}
if (current.bodyTypeFemale == BodyType.Fat) {
current.bodyTypeFemale = BodyType.Thin;
}
foreach (string current2 in current.ConfigErrors(false))
{
Log.Error(current.title + ": " + current2);
}
BackstoryDatabase.AddBackstory(current);
}
SolidBioDatabase.LoadAllBios();
}
}
}


My idea was to detour the method that builds the backstory dictionary in the constructor of my class to a method that is basically identical except having a couple extra if statements to replace the body types as they are read in. It seems like the constructor is never even being called though, so I am clearly in over my depth. Maybe there is something really obvious I am doing wrong, so I was hoping someone with more C# experience and knowledge of the game code could help me.

Thanks a lot!