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

#31
Outdated / Re: [MOD] (Alpha 3F) Automatons (v1.1)
May 19, 2014, 08:35:54 AM
Can a mod please move this to the outdated section? I don't plan to update this anymore, since Vanilla+ kinda made this redundant. There's a glaring bug in AutoCurfew, and therefore also in Automatons.
I'll keep the files there in case anybody still wants to look at the source.
#32
Just figured I'd bump this since I added a fix, but edited posts don't bump the topic and I do hope this will be fixed in alpha 4. Sorry for bumping.

Anyway, a simple "foreach (Command c in base.GetCommands()) yield return c;" at the start or end (depending on where the command buttons should display) of Pawn.GetCommands() should suffice.
#33
Quote from: JinxWolf on May 18, 2014, 09:18:48 PM
Quote from: pawnstorm on May 17, 2014, 03:08:17 AM
Quote from: JinxWolf on May 17, 2014, 02:47:20 AM
Also:
Does that happen everytime? I'm guessing it can't find the texture for the command buttons, I've had that once or twice which resulted in a texture not found image being displayed instead of the icon. No idea what causes it, but it didn't cause any serious issues for me.

It only happens when raiders come along.
Actually more people have been speaking on your thread.
They have my exact problem.
I just released an update, hopefully it fixes your problem.
#34
In AI.JobGiver.WorkRoot.TryGiveTerminalJob(Pawn pawn), there's this piece of code according to ILSpy:

IntVec3 position = pawn.Position;
float num2 = 99999f;
foreach (IntVec3 current2 in giver.PotentialWorkLocs)
{
if ((current2 - position).LengthHorizontalSquared < num2 && giver.StartingJobOn(pawn, current2) != null)
{
targetPack = current2;
workGiver = giver;
}
}


Shouldn't it instead be something like this, so that it will always return the closest work location?

IntVec3 position = pawn.Position;
float num2 = 99999f;
foreach (IntVec3 current2 in giver.PotentialWorkLocs)
{
float num3 = (current2 - position).LengthHorizontalSquared;
if (num3 < num2 && giver.StartingJobOn(pawn, current2) != null)
{
targetPack = current2;
workGiver = giver;
num2 = num3;
}
}


Edit: Also, not relevant to alpha 3 since there are no workgivers that it applies to, but if one workgiver class can have both PotentialWorkThings aswell as PotentialWorkLocs, maybe if it finds a work thing before it starts checking for work locations, num2 should initially be set to "(thing.Position - pawn.Position).LengthHorizontalSquared" instead of 99999f.
#35
I did in fact find a nasty bug related to the "Stay inside during threats option", fix is up :). I must shamefully say it was a copy paste fail on my part. I'm not 100% sure yet this bug is also responsible for the NullReferenceException, but since it was an obvious bug and related to the same events it most likely is.

I also turned off the "Stay inside during threats" option by default because it doesn't seem very useful on newly started colonies. But once you have a large enough home region, you can just turn it on and it should work as intended.

Also note that there shouldn't be any problem for your savegames updating to this version, except if you were still using a version prior to v0.9.

Edit: The default setting is just the setting Vanilla+ ships with by the way. If you change it, it will save that setting
Edit2: I think I should fix something else in the "Stay inside during threats" code too... I think there'll be a v1.2.5 later today
Edit3: 1.2.5- Fixed this and did another minor tweak in that class related to "Stay inside during threats"
#36
Quote from: Crimsonknight3 on May 18, 2014, 05:42:35 PM
all pawns are moving around normally apart from Bill
The screenshot makes me want to slap Bill in the face and scream "What is wrong with you? Why don't you tell us what's going on?" at him :P. The only thing I can think of is for some reason Bill got spawned as a normal Pawn who thinks he's a BF.PawnX. Lists of enabled mods and perhaps a savegame would help me lots here. I think some old version of the dresser mod used to respawn pawns to refresh them, I don't suppose all of you guys started your savegames with an old version of dresser or had vanillaplus disabled [at the start/for a while] on your savegames?

Edit: Was Bill trying to plant or harvest anything? Someone on IRC mentioned a raid event happening while some colonists are planting or harvesting might have something to do with it.
#37
Quote from: Dr. Z on May 18, 2014, 07:23:37 AM
Why do I need to start a new game, can't I just toggle it on?
Yeah that works too.

Quote from: benramit on May 18, 2014, 11:01:54 AM
I'm having a issue I think with Vanilla I think what happens is when raiders show up all my pawns just stop.  Stop doing jobs and can't be selected.  Like i said I'm not sure it's Vanilla but I think it is.
Quote from: Crimsonknight3 on May 18, 2014, 05:42:35 PM
I'm having a bug though similar to the other guy but it definately isn't user error.
Hmm, I'll look into this. Did you guys both have the "Stay inside during threats" option on? Do you have any savegames of when this happened? Also, which other mods are active?
It's a really strange bug since that function (BF.PawnX.GetCommands()) just gets the command buttons (like draft/undraft, save pos, goto pos, eat, sleep).

Quote from: Crimsonknight3 on May 18, 2014, 04:20:42 PM
have you set home regions? they will still work when enemies show up but only in home regions as far as I can tell
Yeah that's how it should work. It might not work very well with newly started colonies that still have small home regions, it's probably better to not use the "Stay inside during threats" option with a small home region.
#38
Quote from: Dr. Z on May 18, 2014, 06:16:53 AM
Quote from: pawnstorm on May 17, 2014, 09:01:51 PM
Quote from: Austupaio on May 17, 2014, 08:55:34 PM
What exactly is a sandbag waffle? ;D
It's when you create a grid of connected sandbags which the raiders must pass through. It slows them down, which is nice I suppose, there should be something to slow raiders down. But the raiders are also unable to shoot while moving over the sandbag waffle, which makes it a bit of an exploit in my opinion.
If you want to know why it's called a waffle, create a grid of sandbags and tell me what it looks like :P.

Edit: http://www.youtube.com/watch?v=inS84nrcLKA#t=588

But if you restrict sandbag waffles, I thought you can't build one sandbag next to another, so if you just want to build a line of sandbags for your colonists to hide behind, you must turn it off, or am I wrong?
Have you tried it? :P
You can build a line of sandbags, you just can't "waffle" them. Make a new game and try to put sandbags next to eachother, you'll see what I mean.
#39
Fixed a very rare bug that occured sometimes when loading a savegame which caused fire reservations to get messed up and throw some warnings. Thanks to SacoMato for reporting it!
#40
Quote from: Austupaio on May 17, 2014, 08:55:34 PM
What exactly is a sandbag waffle? ;D
It's when you create a grid of connected sandbags which the raiders must pass through. It slows them down, which is nice I suppose, there should be something to slow raiders down. But the raiders are also unable to shoot while moving over the sandbag waffle, which makes it a bit of an exploit in my opinion.
If you want to know why it's called a waffle, create a grid of sandbags and tell me what it looks like :P.

Edit: http://www.youtube.com/watch?v=inS84nrcLKA#t=588
#41
I reworked the sandbag waffle restricter a little. Most of you probably turn it off immediately anyway, but just so you know, it's bad karma to turn it off. Everytime someone turns off the sandbag waffle restricter, god kills a puppy.

No other changes, nothing new planned either.
#42
I tried to use Find.MainTabsRoot.tabArchitect.selectedPanel.dragger.DragSquares in a custom placement restricter (after checking dragger.dragging ofcourse) and it just crashes to desktop whenever I try to do anything with those squares.

My theory is it doesn't like it when startDragSquare equals Gen.MouseWorldSquare(). Unfortunately, startDragSquare is private so there's no way for me to handle that condition.

Edit: Oh wait, actually I think it crashes to desktop because DragSquares calls CanDesignateAt, which in turn calls my placement restricter, which calls DragSquares again, resulting in a never ending recursion... ok, so I guess this isn't a bug, but it would still be nice to be able to use the dragger in placement restricters. Hmm, maybe I can come up with a solution if I watch Inception again :P.

Edit2: I came up with a solution btw, without even having to sit through Inception again :). There's probably some room for optimization, but this works:


    public class PlacementRestricter_NoWaffle : PlacementRestricter
    {
        private IntVec3 firstDragSquare;
        private IntVec3 lastDragSquare;
        private bool dragging = false;

        public override AcceptanceReport CanPlaceWithRestriction(EntityDef checkingDef, IntVec3 loc, IntRot rot)
        {
            DesignationDragger dragger = Find.MainTabsRoot.tabArchitect.selectedPanel.dragger;

            if (!dragger.dragging)
            {
                if (dragging)
                {
                    dragging = false;
                    firstDragSquare = IntVec3.Invalid;
                    lastDragSquare = IntVec3.Invalid;
                }
            }
            else if (!dragging)
            {
                dragging = true;
                firstDragSquare = loc;
            }
            else if (firstDragSquare == Gen.MouseWorldSquare())
            {
                lastDragSquare = IntVec3.Invalid;
            }

            if (SquareHas(new IntVec3(loc.x - 1, loc.y, loc.z), (ThingDef)checkingDef)
                && SquareHas(new IntVec3(loc.x - 1, loc.y, loc.z + 1), (ThingDef)checkingDef)
                && SquareHas(new IntVec3(loc.x, loc.y, loc.z + 1), (ThingDef)checkingDef))
                return false;

            if (SquareHas(new IntVec3(loc.x, loc.y, loc.z + 1), (ThingDef)checkingDef)
                && SquareHas(new IntVec3(loc.x + 1, loc.y, loc.z + 1), (ThingDef)checkingDef)
                && SquareHas(new IntVec3(loc.x + 1, loc.y, loc.z), (ThingDef)checkingDef))
                return false;

            if (SquareHas(new IntVec3(loc.x + 1, loc.y, loc.z), (ThingDef)checkingDef)
                && SquareHas(new IntVec3(loc.x + 1, loc.y, loc.z - 1), (ThingDef)checkingDef)
                && SquareHas(new IntVec3(loc.x, loc.y, loc.z - 1), (ThingDef)checkingDef))
                return false;

            if (SquareHas(new IntVec3(loc.x, loc.y, loc.z - 1), (ThingDef)checkingDef)
                && SquareHas(new IntVec3(loc.x - 1, loc.y, loc.z - 1), (ThingDef)checkingDef)
                && SquareHas(new IntVec3(loc.x - 1, loc.y, loc.z), (ThingDef)checkingDef))
                return false;

            if (dragging)
                lastDragSquare = loc;

            return true;
        }

        private bool SquareHas(IntVec3 sq, ThingDef def)
        {
            if (!sq.InBounds())
                return false;
            if (Find.Grids.ThingAt(sq, def) != null || Find.Grids.ThingAt(sq, def.blueprintDef) != null)
                return true;
            if (dragging && lastDragSquare == sq)
                return true;
            return false;
        }
    }


Edit3: For anybody wondering what it does, it prevents making sandbag waffles.

Edit4: Just for completion, I've updated it with the same code as I used in Vanilla+ v1.2.3, in case anybody finds it useful
Edit5: oh, I overlooked something... fixed
#43
Quote from: Dr. Z on May 17, 2014, 04:28:28 AM
Can I install 1.1 and still use my savegame started with 1.0?
Yeah, there shouldn't be any problems. I just released version 1.2 by the way, there shouldn't be any problems with that either. I think everything from version 0.9 to 1.2 should be save compatible.

Anyway, I found a little gem in Tynan's released source code, a new jobdriver for hunting that isn't even in alpha 3f yet! I had to make some changes, but I managed to get it working, it's in Vanilla+ v1.2 now :).
#44
Quote from: JinxWolf on May 17, 2014, 02:47:20 AM
Also:
Does that happen everytime? I'm guessing it can't find the texture for the command buttons, I've had that once or twice which resulted in a texture not found image being displayed instead of the icon. No idea what causes it, but it didn't cause any serious issues for me.
#45
Quote from: JinxWolf on May 16, 2014, 09:00:44 PM
But i've also untoggled Vanilla+ for a period of time .
On the same savegame? That's also a recipe for disaster :P. Vanilla+ has its own class for human pawns, if you suddenly turn it off on a savegame, there'll still be human pawns that use the custom class but the custom class isn't there anymore.

Edit: Also, if your output_log.txt is that big, odds are most of it is just the same error messages repeating. If you just post the part of it before you see the same error message again that should probably be enough.