[A17] Miniaturisation Overloaded

Started by notfood, August 03, 2016, 09:36:22 PM

Previous topic - Next topic

Master Bucketsmith

All right. So I've made my first mod for RimWorld ever.
I'm really proud of having done that, though no code is mine, I simply altered vanilla code and used a bit of code someone else supplied.

It's the firefoam mortar in my signature. When I first had it Frankenstein'd it, it used artillery shells as ammo.
I simply disabled that, resulting in it requiring no ammo whatsoever.
Now, I'm at the point I made some simple unique textures for the mortar and shells, I've got the recipes for shell making all set, but the bill won't show up in the machining table.
Figured out that I would have to make a copy of the Building_Production def file and change the machining table def to add my recipe.
That's where I thought of MFO!
I'm a total scrub at modding, so any chance you could help me through how I'd use MFO for adding that recipe to the machining table?
In fact, would it be possible to go over the rest of the code to see if I could slim it all down with the use of MFO?

notfood

#31
In case of two same comps being inserted, the last one inserted by Override is the only valid. Rimworld removes the duplicates with a warning.

Help me here. What's more desirable? This:        <ingredients.replace>
            <li>
                <filter>
                    <thingDefs>
                        <li>Plasteel</li>
                    </thingDefs>
                </filter>
                <count>5</count>
            </li>
            <li>
                <filter>
                    <thingDefs>
                        <li>Component</li>
                    </thingDefs>
                </filter>
                <count>1</count>
            </li>
        </ingredients.replace>


or this?:        <ingredients replace="true">
            <li>
                <filter>
                    <thingDefs>
                        <li>Plasteel</li>
                    </thingDefs>
                </filter>
                <count>5</count>
            </li>
            <li>
                <filter>
                    <thingDefs>
                        <li>Component</li>
                    </thingDefs>
                </filter>
                <count>1</count>
            </li>
        </ingredients>


Take into account the . is illegal field name for a C# field so I can make use of it to bring some meaning.

Elysium

#32
Quote from: notfood on August 11, 2016, 04:20:34 PM
In case of two same comps being inserted, the last one inserted by Override is the only valid. Rimworld removes the duplicates with a warning.

Help me here. What's more desirable?

Take into account the . is illegal field name for a C# field so I can make use of it to bring some meaning.

I know pretty much nothing about C# so I may not be the most helpful here, but both seem self explanatory and reasonable.  If ingredients.replace will cause some issues with C# then I would suggest using ingredients replace="true", but you are the C# coder here so I really suggest just going with whatever makes the most sense to you as a programmer.

Quote from: Bucketsmith on August 11, 2016, 04:09:21 PM
All right. So I've made my first mod for RimWorld ever.
I'm really proud of having done that, though no code is mine, I simply altered vanilla code and used a bit of code someone else supplied.

It's the firefoam mortar in my signature. When I first had it Frankenstein'd it, it used artillery shells as ammo.
I simply disabled that, resulting in it requiring no ammo whatsoever.
Now, I'm at the point I made some simple unique textures for the mortar and shells, I've got the recipes for shell making all set, but the bill won't show up in the machining table.
Figured out that I would have to make a copy of the Building_Production def file and change the machining table def to add my recipe.
That's where I thought of MFO!
I'm a total scrub at modding, so any chance you could help me through how I'd use MFO for adding that recipe to the machining table?
In fact, would it be possible to go over the rest of the code to see if I could slim it all down with the use of MFO?

Just to be clear I think notsure intends Miniaturisation Overloaded and this new override method to be a seperate mod/utility.  Overrides seems to be an evolution of the efforts put into Miniaturisation which is why it is being discussed here and not in a separate thread.  Also probably because it is still in very early stages.  As for your question I'm not really sure myself to be honest,  I'm fairly new at this as well and I'm only just starting to understand how everything fits together.

notfood

#33


Mod Friendly Overrides
you dug too deep

Download Beta 3

Example OverrideDef.xml

I moved the example out of the base. On its own it does nothing now.

I added the replace="true" attribute, sets the original to null if possible before trying anything.

Master Bucketsmith

Quote from: notfood on August 11, 2016, 04:20:34 PM
Help me here. What's more desirable?
Take into account the . is illegal field name for a C# field so I can make use of it to bring some meaning.
I've got no experience with C#, either looks fine to me. Not even sure what it means that the former is an illegal field name and how you can use that. :P

Quote from: Elysium on August 11, 2016, 04:28:40 PM
Just to be clear I think notsure intends Miniaturisation Overloaded and this new override method to be a seperate mod/utility.  Overrides seems to be an evolution of the efforts put into Miniaturisation which is why it is being discussed here and not in a separate thread.  Also probably because it is still in very early stages.  As for your question I'm not really sure myself to be honest,  I'm fairly new at this as well and I'm only just starting to understand how everything fits together.
I.. know...? That's why I asked?
I realised that if I am going to have to copy the whole machining table to be able to add the bill for an item in my little mod, it might conflict with any other mod that adds something to the machining table.
I instantly thought of notfood's efforts with MFO and wondered if that could be a solution. It would also help 'spreading the news' if I could mention I used MFO in my mod. :)

Elysium

Quote from: Bucketsmith on August 12, 2016, 03:30:24 AM
I.. know...? That's why I asked?
I realised that if I am going to have to copy the whole machining table to be able to add the bill for an item in my little mod, it might conflict with any other mod that adds something to the machining table.
I instantly thought of notfood's efforts with MFO and wondered if that could be a solution. It would also help 'spreading the news' if I could mention I used MFO in my mod. :)
I'm not sure you even have to touch the machining table.  I know some mods add bills by altering the machining table but I don't think that is the only way.  You can use a recipe maker and target the machining table as a recipe user which seems like a better way of doing things.

kaptain_kavern

#36
Just have to add <RecipeUsers><li>TableMachining</li></RecipeUsers>  in the recipe files.

Master Bucketsmith

Quote from: kaptain_kavern on August 12, 2016, 04:25:10 AM
Just have to add <RecipeUsers><li>TableMachining</li></RecipeUsers>  in the recipe files.
Yep, figured that out by looking at where the guns are. :) Thanks though.
I don't want to clutter this thread with something for my own mod, sorry.

H8ff0000

@notfood Just a suggestion: instead of the current naming convention of:
Miniaturisation_0.14.2.0
I would consider changing it to:
Miniaturisation_Overloaded_0.14.2.0
The reason being, if someone is looking at mods after they are already downloaded, you can't tell it's your version instead of the original.

notfood

I don't think they'd want to use both at the same time.

Master Bucketsmith

Quote from: notfood on August 12, 2016, 12:49:20 PM
I don't think they'd want to use both at the same time.
That's exactly the reason. We'd like to easily tell them apart when switching over, for instance.

H8ff0000

Quote from: Bucketsmith on August 12, 2016, 12:53:57 PM
Quote from: notfood on August 12, 2016, 12:49:20 PM
I don't think they'd want to use both at the same time.
That's exactly the reason. We'd like to easily tell them apart when switching over, for instance.
Yes. See, as it is currently, it's hard to know which one a given mod is just from looking at the name after it is downloaded. Add Overloaded to the file name and that is easily taken care of. No downside.

notfood

#42


Mod Friendly Overrides
you dug too deep

Download Beta 4

Example OverrideDef.xml

Added very powerful filters for searching the def you want to find.
Matcher: <Override.Def Filter="Match" Match="DefClass@field=value @field=value @field or not DefClass">
Category: <Override.Def Filter="Category" Category="ThingCategory">
Name: <Override.Def Filter="Name" Target="defName,defName">

Name is the default if it's omited, you can also make your own filter if you implement override.Filter interface. and call it like:
Custom <Override.Def Filter="mymod.CustomFilter" myparameter="oohhh">
You can have any parameter you wish in a custom.

Can't mix them up yet, not sure if you want that. Matcher does what the other do with @category=Building @defName=DefName
It's just a bit expensive computation wise.

Added several modes of operation, mostly for lists.
mode="Mode" in the field
Soported operations are: Default, Clear, Insert, Append, Replace

kaptain_kavern

OMG if I (at last) have really understand this will be so damn handy.

The filter and matcher bit are super simple to understand/use

BaconBits

This is awesome bud, nice job!   :)