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

#136
Help / Re: Different fabric temperature multiplier?
January 19, 2015, 07:01:59 AM
I took a long look into it, and I may have found an answer. This is where I started.
From StatUtility:
    public static float StatOffsetFromGear(Thing gear, StatDef stat)
    {
      float statOffsetFromList = StatUtility.GetStatOffsetFromList(gear.def.equippedStatOffsets, stat);
      if (gear.Stuff != null)
        statOffsetFromList *= StatUtility.GetStatFactorFromList(gear.Stuff.stuffProps.equippedStatFactors, stat);
      return statOffsetFromList;
    }


So, I think the only thing you need is to modify the StuffProperties of your Def and set the StatsDefs directly. In theory, It should work. If you look at the ThingDefGenereator_Leather long enough you'll see it.
Do not mistake the StatDefOf.ArmorRating_Heat for the StatDefOf.ComfyTemperatureMin/Max. The first is used for protection against fire.

I'm not really sure, but I'm confident that I understand how the statfactors works. Lets see if I'm able to translate it to words after looking at the code for two hours.

stuffprops.equippedStatFactors is a List<StatModifier>
a StatModifier is a class with two fields: StatDef stat;  float value;
Take a simplified example for leather:

Looking only at temperature, each kind of Leather Def.stuffprops.equippedStatFactors is composed from:
a "StatModifier1" = StatDefOf.ComfyTemperatureMin, 1.2f (Shared for all the leathers)
a "StatModifier2" = StatDefOf.ComfyTemperatureMin, (defoftheanimal.race.leatherEquippedStatFactors[index of ComfyTemperatureMin].value)
and a "StatModifier3" = StatDefOf.ComfyTemperatureMax, (defoftheanimal.race.leatherEquippedStatFactors[index of ComfyTemperatureMax].value


Maybe I'm wrong about the way the StatModifier works, but I believe that, in theory, you should be able to do what you asked. Easier said than done.
#137
Help / Re: Swap out pawn with new def?
January 18, 2015, 10:56:33 AM
Check the ticks controlled events thread pinned at the top of this subforum. I believe the code has something very similar to your idea.
#138
Mods / Re: Idea: Avoid Zone
January 18, 2015, 10:42:29 AM
Last night I couldn't sleep so I was messing around with this idea and here it is what I found, for anyone is interested in trying.

You can't modify the pathfinder, so the only workaround was to make the pathfinder think that a pawn can't reach a cell marked as avoid. Which thing ingame behaves like that? Doors! So the general idea is to:

-Create a building with the Etype and code of a door. It won't be edifice nor selectable and give it an empty texture.
-In the new building code, reduce the timetoopen so the pawn won't even know there is a door there, change the check conditions for blockspawn to faction.ofcolony and for willopenfor to !blockspawn.
-Create a new designator, grid and layer to spawn, despawn and save the avoid zone cells.
-Make sure the spawned buildings wont tick.

I gave it a rushed try and, in theory, it works. But I'm sure I missed something along the way because I was getting some weird exceptions on building spawn related to the room/region creation.

Right now I won't continue working on this idea because I have other priorities. If you look into it and find a way to make it work, please let me know  :)
#139
Hi, I think I solved your problem. It did work in my game.

First, right now, you only need the three files I corrected in the attachment. Take a look at the comments in the code.

Give it a try and tell me if it works for you.


[attachment deleted due to age]
#140
Translations / Re: [Translation] Spanish - In progress
January 17, 2015, 02:05:02 PM
Hi, everyone. I joined the Spanish translation a couple of days ago. Is anyone else still working on this translation.

Yesterday I updated, most of the existing files in the repo, and I will continue until the translation is finished.

I would like to discuss some potential changes to some parts of the translation if anyone is still around...

Nuke: You are totally right. The actual Spanish translation work is in "Castellano".
#141
Exactly, that was the idea for this mod.

I was tired of my colononist taking the scenic route to the other edge of the map just to eat a single survival meal, and come back home empty handed. Damn, in some maps they were hungry again at the time they got back home!

Also, after a big fight I hated unforbidding every weapon one by one and looking how the colonist took ages to haul the most expensive things  when there was a trading ship around.
#142
Hauling Priority Designator

Description:
Adds a new designator in the Orders Tab. You can use this designator to make the colonist try to haul the designated things first, ignoring items not designated. Adds a designator to unforbid groups of items too.



Very useful when dealing with the cleanup after a raid, just unforbid everything and designate the items you want to be hauled first!

More Info:
The mod is savegame compatible and its compatible with EdB Interface. Should be compatible with other mods if they don't have their own designators.

When the colonist start a priority hauling job, it will only check for the designation of the first item. If he finds an item which stacks with the first item he will try to haul it regardless of the designation. Nothing I can do about it right now.

If you right click on a designated item there will be 2 hauling options. It appears to be a bug in the vanilla code.

02/03/15 - On rare occasions it has been reported that the weapons dropped from pirates will not be hauled and get a message saying there's no empty space configured to store it. I have not been able to find the origin of the issue, but closing the game and loading the save again will probably fix it. It may be a compatibility issue with EdB Interface related to mod load order. If you have this problem continuously or very frequently, please post it here and I'll do my best to correct it.

To Modders
Help yourself with the code as you wish. If you have any question, just ask. If you happen to take a look at the code, please tell me if you find any way to improve it. But be nice, this is my first mod ever, the first time I write code in 15 years, and last week I didn't know anything about C/C#.

Author:
Gaesatae

Download
( v.1.0.2) - Alpha 9 - DropBox Link
( v.0.9) - Alpha 8 - DropBox Link

How to install:
- Unzip the contents and place them in your RimWorld/Mods folder.
- Activate the mod in the mod menu in the game.
#143
Help / Re: How do I use my own designator class?
January 11, 2015, 11:31:12 AM
I've been messing with the designators the last couple of days and I want to kill myself.

I've taken a quick look at the code and I've tried it. It 'works' as a new designator for me. Look at the def XML for any typos and check if you included your full path as mipen said.

You'll get a null on every c.GetPlant() if you try to designate something without the EntityCategory of a plant.

Take a look:
public static Plant GetPlant(this IntVec3 c)
    {
      List<Thing> list = Find.ThingGrid.ThingsListAt(c);
      for (int index = 0; index < list.Count; ++index)
      {
        if (list[index].def.category == EntityCategory.Plant)
          return (Plant) list[index];
      }
      return (Plant) null;
    }


I don't think it's easy to replace a designator. Take a look at EdB Interface new designator class and what it takes to make it work. Makes you appreciate things...
#144
Help / Re: How to get an instance of a comps properties
January 09, 2015, 01:51:09 PM
Hi. I've been working for some time with the battery code and the comps and I've just given up.

I'm sure the comps are useful for other things, but right now I think is hard to work with the CompPower Comps.

In my case I was trying to make a new battery building, one that just transmit power and spawns fully charged. I had to create a new building using a similar code to the vanilla battery building and create a new Comp to be used in the building getcomps.

After several attempts I managed to make it work but there was one problem: the stored energy didn't get read by the Power Grid. After a very long look at the code I found that the way the game registers and interacts with the batteries connected to the grid is looking for the "CompPowerBattery" type of a connected building.

I won't try the workarounds right now. They're not hard, they're ugly...