Alpha 9 Modder Stuff

Started by ItchyFlea, January 16, 2015, 08:45:42 PM

Previous topic - Next topic

ItchyFlea

How does one give something a hangover-like effect?
I saw that there's code behind it, but how do I expand HediffDefOf to include my custom side effect, and how does the game know when to apply it?
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

RemingtonRyder

Hi guys, I was wondering if there's a way to add an extra table to an item's recipeMaker instead of overriding the whole file in a mod.

I mean, I could just do that, but it doesn't make for much mod compatibility with other mods which change the same files.

Tynan

Quote from: ItchyFlea on February 02, 2015, 10:35:25 PM
How does one give something a hangover-like effect?
I saw that there's code behind it, but how do I expand HediffDefOf to include my custom side effect, and how does the game know when to apply it?

It's entirely custom coded for now, I'm afraid.

This may get generalized as I add more drugs for A10.

Marvin - You don't have to override a whole file, you can just override a def. The files are irrelevant, it's the defs that are matched and overridden.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

RemingtonRyder

Sure, I get that.  Quite often it's just one def that I'm changing. But for the mod I have in mind, I'm adding (for example) the melee and ranged neolithic weapons to a smithing table with a different defName.

But to do that I need to add the defname of that table in the recipeUsers list, either by adding it to each item's ThingDef, or by having them inherit it.  So can I do that without overriding everything in that ThingDef so that another mod can change different things?

Not with an XML mod only, I guess!

ItchyFlea

Quote from: Tynan on February 14, 2015, 04:02:16 PM
Marvin - You don't have to override a whole file, you can just override a def. The files are irrelevant, it's the defs that are matched and overridden.
This is something I've seen a lot of people do. Change one def in a file (IE; BiomeDefs/Biomes.xml) but leave the remaining def's in there, unchanged, breaking compatibility with other mods.
Perhaps we need to mention somewhere that filenames are irrelevant when it comes to modding. Folder structure and <defName> is all that matters.

Quote from: Tynan on February 14, 2015, 04:02:16 PM
Quote from: ItchyFlea on February 02, 2015, 10:35:25 PM
-snip-
It's entirely custom coded for now, I'm afraid.
This may get generalized as I add more drugs for A10.
Discovered that when making SpaceMeth. :)

Quote from: MarvinKosh on February 14, 2015, 04:21:55 PM
Sure, I get that.  Quite often it's just one def that I'm changing. But for the mod I have in mind, I'm adding (for example) the melee and ranged neolithic weapons to a smithing table with a different defName.

But to do that I need to add the defname of that table in the recipeUsers list, either by adding it to each item's ThingDef, or by having them inherit it.  So can I do that without overriding everything in that ThingDef so that another mod can change different things?

Not with an XML mod only, I guess!
If there's a recipe involved, there are two ways of having a table use that recipe. <recipeUsers> works from the recipe def itself, so the table remains unchanged, and <recipes> works with the table def so the recipe remains unchanged.
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

RemingtonRyder

#35
Oh. Derp, never thought to try that. *facepalm*

Thanks, Itchy! :)

Although, having said that, I would need to add recipes for the weapons and apparel so I can craft them from the table.  The recipes for them are at the moment generated by having the recipeMaker tag in the parent definition at the top of the file.

Tynan

Quote from: ItchyFlea on February 14, 2015, 04:34:13 PM
If there's a recipe involved, there are two ways of having a table use that recipe. <recipeUsers> works from the recipe def itself, so the table remains unchanged, and <recipes> works with the table def so the recipe remains unchanged.

You beat me to it! I was actually trying to remember exactly how that worked so I could explain it :p
Tynan Sylvester - @TynanSylvester - Tynan's Blog

ItchyFlea

Quote from: MarvinKosh on February 14, 2015, 05:37:24 PM
Although, having said that, I would need to add recipes for the weapons and apparel so I can craft them from the table.  The recipes for them are at the moment generated by having the recipeMaker tag in the parent definition at the top of the file.
If you can figure out the names the game generates for the generated definition, you can avoid doing the work of creating the recipes by adding them to the table def with <recipes>.
The best way I found of determining a generated name is to create that item in a save, save the game, exit then open the save file and find the name.

To save you the trouble, here's the defnames of the apparel and weapon recipes the game generates:

<recipe>Make_Apparel_Tuque</recipe>
<recipe>Make_Apparel_Pants</recipe>
<recipe>Make_Apparel_BasicShirt</recipe>
<recipe>Make_Apparel_CollarShirt</recipe>
<recipe>Make_Apparel_Duster</recipe>
<recipe>Make_Apparel_Jacket</recipe>
<recipe>Make_Apparel_Parka</recipe>
<recipe>Make_Apparel_TribalA</recipe>

<recipe>Make_MeleeWeapon_LongSword</recipe>
<recipe>Make_MeleeWeapon_Knife</recipe>
<recipe>Make_MeleeWeapon_Shiv</recipe>
<recipe>Make_MeleeWeapon_Spear</recipe>
<recipe>Make_MeleeWeapon_Mace</recipe>
<recipe>Make_MeleeWeapon_Club</recipe>
<recipe>Make_Bow_Short</recipe>
<recipe>Make_Pila</recipe>
<recipe>Make_Bow_Great</recipe>
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

RemingtonRyder


skullywag

#39
Anyone know what the replacement code for:

this.armedgfc = new Graphic_Single(MaterialPool.MatFrom("Things/Weapons/APM_disarmed"), false);

Graphic_single doesnt take args anymore and I cant find a graphic class that does what I want...

Also BulletIncendiary is gone with no replacement that I can find, i modded one back in for my purposes.

Does fire no longer trigger rain? I set fire to the whole map....no rain.

-----------------------------------------------------------------------------------------------

MoteMaker is now MoteThrower and most of the "tryThrows" are now simple "throws", ThrowFlash is now ThrowStatic which takes similar args (the mote name etc)

FogUtility.Fogged(sq) is now Find.FogGrid.IsFogged(sq)

Seems that FilthLeavings is now no longer able to take multiple filth types or multiples of the same filth, so instead of:
    <filthLeavings>
      <RockRubble>2</RockRubble>
    </filthLeavings>


its:

<filthLeaving>RockRubble</filthLeaving>

Kind of restrictive but minor so ehhhh.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Gaesatae

Quote from: skullywag on February 17, 2015, 05:28:12 PM
Anyone know what the replacement code for:

this.armedgfc = new Graphic_Single(MaterialPool.MatFrom("Things/Weapons/APM_disarmed"), false);

Graphic_single doesnt take args anymore and I cant find a graphic class that does what I want...

Also BulletIncendiary is gone with no replacement that I can find, i modded one back in for my purposes.

Does fire no longer trigger rain? I set fire to the whole map....no rain.

Did you looked at Graphic_Single.Init() ?
    public override void Init(GraphicRequest req)
    {
      this.path = req.path;
      this.color = req.color;
      this.colorTwo = req.colorTwo;
      this.shader = req.shader;
      this.drawSize = req.drawSize;
      MaterialRequest req1 = new MaterialRequest();
      req1.mainTex = ContentFinder<Texture2D>.Get(req.path, true);
      req1.shader = this.shader;
      req1.color = this.color;
      req1.colorTwo = this.colorTwo;
      if (ShaderUtility.SupportsMaskTex(req.shader))
        req1.maskTex = ContentFinder<Texture2D>.Get(req.path + "_m", false);
      this.mat = MaterialPool.MatFrom(req1);
    }


I'm not sure how it's used, and I'm worried that if open VS right now I won't sleep tonight.

Rain works fine for me.

skullywag

Ah i dont know why that didnt click before, need to initilialize it and add to the object, I should be fine with this now.

My meteorite mod just bombarded the map, more fire than ground.....no rain...strange.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

skullywag

#42
So trying to find a random cell on the map that isnt fogged, roofed and is standable the code from A8 results in errors in A9. Im just using "randomcellwith" any reason it would always moan about not being able to find a cell...even though it always does and sometimes the cell it finds is roofed, fogged and not standable...

Edit - i seem to have fixed it but im not sure how the code is the same....meh
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Tynan

Itchy maybe you want to make this thread public now?
Tynan Sylvester - @TynanSylvester - Tynan's Blog

skullywag

#44
Ok so im gonna throw this out there, GetCommands is now GetGizmos I think.....anyone wanna help get this one sorted, I need the commands for turrets. (force fire etc). I was using Haplos code to do it in A8, but it seems lots of stuff is not in Gizmo that was in Command. Or im talking nonsense....

Edit - never mind, it was actually simple, i spoke too soon.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?