Alpha 9 Modder Stuff

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

Previous topic - Next topic

Tynan

My solution :p


private void MakeMatchingStockpile()
{
Designator_ZoneAddStockpile_Resources des = new Designator_ZoneAddStockpile_Resources();
des.DesignateMulti( TradeableCells.Where(c=>des.CanDesignateAt(c).accepted));
}


Yes - I just used the same code the player uses when designating a zone. It handles all the weird cases with unplaceable or overlapping zones etc.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

JuliaEllie

#16
Quote from: Tynan on January 22, 2015, 03:40:15 PM
My solution :p


private void MakeMatchingStockpile()
{
Designator_ZoneAddStockpile_Resources des = new Designator_ZoneAddStockpile_Resources();
des.DesignateMulti( TradeableCells.Where(c=>des.CanDesignateAt(c).accepted));
}


Yes - I just used the same code the player uses when designating a zone. It handles all the weird cases with unplaceable or overlapping zones etc.


You find me at the bar.. drinking.. *walks off weeping*

edit: my code is 182 lines for this

Haplo

Ah, don't you worry about it. He does that all of the time.
As I made the WindTurbine I have thought and thought about how I could make the wind tunnel visible. I didn't find a solution for it.
And what does he do? He modifies the PlaceWorker and writes one line in it..

But 'Das Leben ist hart, aber ungerecht' or.. Life's a bitch ;)

Ramsis

Well hey Ellie or Haplo if you really want to one up Tynan, you could make it so your colonists will actually hold a container of food or two in their inventory so when they are hungry and halfway across the map they don't just beeline for home base and then waste additional time.

And actually seeing as the two of you seem to have a lot more fun with crazy amazing additions, maybe one of you could finally introduce backpacks/knapsacks to RimWorld that increases carry amounts for hauling. Would probably flip RimWorld on it's head and eventually pressure it's addition into RW much faster.
Ugh... I have SO MANY MESSES TO CLEAN UP. Oh also I slap people around who work on mods <3

"Back off man, I'm a scientist."
- Egon Stetmann


Awoo~

Haplo

The food in their inventory shouldn't be that much of a problem, seeing as the visitors already have it there.

I think with a simple building (or a float menu on the pawns) it could be added rather simply.

And as the JobGiver_GetFood already has this nice entry it should automatically be consumed when the pawn is hungry

            Thing thing = FoodUtility.FoodInInventory(pawn);
            if (thing != null)
            {
                return new Job(JobDefOf.EatFood, thing);
            }



As I see it right now, the only thing to do is to add a FloatMenu to the Pawn or to the food to place food into the inventory.
Hmm, the best would be a float menu on the food?
But I don't have time right now to test this, sorry.

Coenmcj

Quote from: JuliaEllie on January 22, 2015, 03:47:06 PM
Quote from: Tynan on January 22, 2015, 03:40:15 PM
My solution :p


private void MakeMatchingStockpile()
{
Designator_ZoneAddStockpile_Resources des = new Designator_ZoneAddStockpile_Resources();
des.DesignateMulti( TradeableCells.Where(c=>des.CanDesignateAt(c).accepted));
}


Yes - I just used the same code the player uses when designating a zone. It handles all the weird cases with unplaceable or overlapping zones etc.


You find me at the bar.. drinking.. *walks off weeping*

edit: my code is 182 lines for this

Simplicity is the Ultimate sophistication.
Don't feel bad that you needed 182 lines, feel good that you've contributed in one form or another. :)
Doubly so that Tynan increased the code efficiency by 4450%
Moderator on discord.gg/rimworld come join us! We don't bite

JuliaEllie

Quick question:

Will Designator_Build.DebugSetStuffDef(ThingDef stuffDef) stay in the Alpha 9 release or will you remove it? 

JuliaEllie

And another one:

Does anybody know why
Designator_Build floordes = new Designator_Build(room.FloorDef);
floordes.DesignateSingle(room.cellsOfFloor.RandomElement());


throws "Tried to spawn Concrete_Blueprint out of bounds at 114,0,-2"??

Tynan

room.cellsOfFloor.RandomElement() is returning a cell out of bounds.

Either check this cell is in bounds, or better, don't add OOB cells to the array in the first place.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

JuliaEllie

Quote from: Tynan on January 23, 2015, 06:59:35 PM
room.cellsOfFloor.RandomElement() is returning a cell out of bounds.

Either check this cell is in bounds, or better, don't add OOB cells to the array in the first place.

But how is this cell out of bounds? Its in the middle of the map at the drop spot.

Tynan

Quote from: JuliaEllie on January 23, 2015, 07:06:09 PM
Quote from: Tynan on January 23, 2015, 06:59:35 PM
room.cellsOfFloor.RandomElement() is returning a cell out of bounds.

Either check this cell is in bounds, or better, don't add OOB cells to the array in the first place.

114,0,-2 is 2 cells below the bottom of the map. Check for OOB when you're making that array; you'll find the bug.
But how is this cell out of bounds? Its in the middle of the map at the drop spot.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

JuliaEllie

#26
thank you very much :) I found the problem.. a stupid typo which switched z for y

funny - I always thought 0,0,0 was the center of the map maybe thats why so much of my stuff using IntVec manipulation crashed and burned :D

Haplo

0,0,0 is the lower left corner. That's the reason there were often some weapons where noone knew where they came from ;)

skullywag

Tynan would it be possible to get all Things with the possibility of having comps (i.e everything) to use the proper inspect string method, the sleep casket just returns a string and doesnt call base so never picks up the comps inspect strings if you add some (which I have). Not major just a small annoyance so feel free to ignore.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Tynan

Quote from: skullywag on January 31, 2015, 02:49:17 PM
Tynan would it be possible to get all Things with the possibility of having comps (i.e everything) to use the proper inspect string method, the sleep casket just returns a string and doesnt call base so never picks up the comps inspect strings if you add some (which I have). Not major just a small annoyance so feel free to ignore.

Yeah I'll fix that.
Tynan Sylvester - @TynanSylvester - Tynan's Blog