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

#1
steam version is updated, i'll update the nonsteam one in january
#2
Help / Stored Ticks Changing After Load
November 14, 2018, 01:44:55 PM
I have a mod which changes the insect hive behaviour.

It uses a stored integer to determine the next tick when it will spawn a bug.

Relevant code:


private int nextHiveSpawnTick = -1;

//... etc

public void CalculateNextHiveSpawnTick()
        {
            Room room = this.parent.GetRoom();
            int num = 0;
            int num1 = GenRadial.NumCellsInRadius(9f);
            for (int i = 0; i < num1; i++)
            {
                IntVec3 position = this.parent.Position + GenRadial.RadialPattern[i];
                if (position.InBounds(this.parent.Map))
                {
                    if (position.GetRoom(this.parent.Map) == room)
                    {
                        if (position.GetThingList(this.parent.Map).Any<Thing>((Thing t) => t is Hive))
                        {
                            num++;
                        }
                    }
                }
            }
            float single = GenMath.LerpDouble(0f, 7f, 1f, 0.35f, (float)Mathf.Clamp(num, 0, 7));
            this.nextHiveSpawnTick = Find.TickManager.TicksGame + (int)(this.Props.HiveSpawnIntervalDays.RandomInRange * 60000f / (single * Find.Storyteller.difficulty.enemyReproductionRateFactor));
        }


This function gets called once then once the game counts to the next hive spawn tick, it changes again.

When i test, i create a hive which initializes this value to about 200,000. When i save and reload, that value gets changed to an astronomically high number. I don't understand why. Is there some trick i need to do when the game is saved and loaded so that the tick counter stays the same? How can i guarantee that this integer will be saved and loaded properly?
#3
Help / Re: Cleaning JobGiver
October 30, 2018, 08:27:20 PM
This is meant to be a mental state.... This code worked fine in 0.9, the 1.0 update caused it to stop working. I assume maybe the cleaning jobs were altered in the 1.0 update?
#4
Help / Re: Cleaning JobGiver
October 24, 2018, 07:49:29 PM
Anyone? :(
#5
Help / Cleaning JobGiver
October 18, 2018, 01:23:57 PM
I have a simple JobGiver which makes a pawn either haul something to a stockpile, or find the nearest filth and clean it:


namespace RimWorld
{
    public class JobGiver_Compulsion: ThinkNode_JobGiver
    {
        protected bool IgnoreForbid(Pawn pawn)
        {
            return pawn.InMentalState;
        }

        protected override Job TryGiveJob(Pawn pawn)
        {
            if (pawn.jobs.jobQueue.Count > 3 || pawn.CurJobDef == JobDefOf.Clean || pawn.CurJobDef == JobDefOf.HaulToCell || pawn.CurJobDef == JobDefOf.HaulToContainer)
            {
                return null;
            }

            if (Rand.Range(0f, 1f) < 0.5f)
            {
                List<Thing> filth = pawn.Map.listerFilthInHomeArea.FilthInHomeArea;
                Filth t = GetClosestFilth(pawn, filth);

                if (CanClean(pawn, t))
                {
                    LocalTargetInfo lt = new LocalTargetInfo(t);
                    return new Job(JobDefOf.Clean, lt);
                }
            }

            if (Rand.Range(0f, 1f) < 0.5f)
            {
                Predicate<Thing> validator = (Thing t) => !t.IsForbidden(pawn) && HaulAIUtility.PawnCanAutomaticallyHaulFast(pawn, t, true);
                Thing thing = GenClosest.ClosestThing_Global_Reachable(pawn.Position, pawn.Map, pawn.Map.listerHaulables.ThingsPotentiallyNeedingHauling(), PathEndMode.OnCell, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, validator, null);

                if (thing != null)
                {
                    return HaulAIUtility.HaulToStorageJob(pawn, thing);
                }
            }

            return null;
        }

        Filth GetClosestFilth(Pawn pawn, List<Thing> filth)
        {
            Thing result = null;
            int minDist = int.MaxValue;

            foreach (Thing t in filth)
            {
                int dist = IntVec3Utility.ManhattanDistanceFlat(pawn.PositionHeld, t.PositionHeld);

                if (dist < minDist)
                {
                    minDist = dist;
                    result = t;
                }
            }

            return result as Filth;
        }

        bool CanClean(Pawn pawn, Thing t)
        {
            Filth filth = t as Filth;

            return filth != null && pawn.Map.areaManager.Home[filth.Position] && pawn.CanReserveAndReach(t, PathEndMode.ClosestTouch, Danger.Deadly, 1);
        }
    }
}


However, it seems that the cleaning job which worked fine in 0.9 does not work fine in 1.0. Maybe something got changed? The hauling job works fine.

Here's what i see when i'm debugging:


25594 Burton: StartJob [Clean (Job_12335) A=Thing_Filth_RubbleRock28550] lastJobEndCondition=None, jobGiver=RimWorld.JobGiver_Compulsion, cancelBusyStances=False

25594 Burton: JobDriver_CleanFilth ends current job Clean (Job_12335) A=Thing_Filth_RubbleRock28550 because of toils[1].endConditions[0]


My decompiler won't show me the toils associated to JobDriver_CleanFilth. Can anyone tell me why the toil is failing?

The pawn clearly has a path to all of the filth in the home area in my test map (and my job giver also verifies that a path is available). So it's not an issue of impossible-to-reach filth. Some other end condition is being met before the pawn can clean the filth.
#6
Oh i see the issue now - you were using the bitbucket download, and i forgot to upload the DLL there. redownload it and it should be fine
#7
seems like you're missing the DLL that comes with the mod... i'd recommend unsubbing, restart the game, then resub and make sure it loads at the bottom of the mod list. hope that will fix it.

maybe an antivirus removed the DLL or something?
#8
Did you use that mod in a new game or add it to an existing game? I haven't received that error before.
#9
Ideas / Re: Insect hive is still an awful event
September 21, 2018, 12:59:11 PM
Quote from: Limdood on September 20, 2018, 11:54:02 AM
manhunter insect spawns....which seems to be the overall OP suggestion in the thread is INSANELY easy to cheese. 

Got a hive spawn outside your base?  yay! free meat FOREVER!  Just let turrets or traps (probably turrets, they're far cheaper in the long run) kill the lone bug every time...problem solved...forever

You wouldn't be able to keep the manhunters away safely without dedicating at least a handful of turrets to guarding their hive. Eventually your turrets will miss enough shots that the bugs will get up close and destroy them. Traps wouldn't be feasible since you'd be perpetually stuck rebuilding them, which means you have to micromanage your pawns to make sure they aren't building them while a manhunter runs after them.

It spawns one manhunter per hive, so you're dealing with more than a single manhunter insect. The more hives there are, the more insects it spawns perpetually.

It creates a permanent threat that the player has to deal with or risk having a stream of insects invade their base forever, without the nonsensical exponential hive growth. The insects will also hunt other animals too, so if the player relies on hunters to gather meat then this threatens their food supply too.
#10
Ideas / Re: Nerf prey.
September 19, 2018, 06:19:38 PM
if squirrels, turtles, etc. get nerfed then they'd need some sort of intermediate animal to spawn in the maps for those "maddened animal" events early on.

an enraged squirrel shouldn't be able to down a colonist in any case, maybe an enraged wild dog or something....
#11
Ideas / Re: Insect hive is still an awful event
September 19, 2018, 04:04:26 PM
Stripmining doesn't just happen in flat areas, if you happen to stripmine an entire mountain area out then having the insect hives appear there is a death sentence too.

The insects have a million avenues of escape (even if you build walls, because they can dig), so unless you pre-built wooden floors through the entire mountain (which nobody will do), good luck stopping them with fire or any other trickery like that.

To be clear: earlygame insect hives are not a problem because they don't spread that quickly and there aren't many insects to handle. It's the lategame ones that are a major issue because it starts the map off with 5 of them. Each hive spawns about 5 insects total, give or take. If you let them survive one reproduction cycle, then you have 10 hives to deal with, and each hive will have about 5 insects. That's 50 insects you now have to worry about when you aggro the hive.

If you get waylaid by a raid or some other problem, then these 10 hives will reproduce and create 20 hives. Now you have about 100 insects.

At this point you are either forced to fight the insects or abandon the colony because it's impossible to stop that many insects. If the hives reproduce again, you'll have 40 hives and 200 insects to deal with. Now you'll have severe FPS loss and the game becomes unplayable and you either have to enter dev mode and delete a bunch of the hives and insects or give up on your save.

This geometric growth is incredibly stupid and it is incredibly difficult to stop 50 aggroed insects coming at you from 10 different angles, let alone 100 or 200. If you're lucky the hives MIGHT spawn in a spot where you can set up some kind of dumb heat trap and metagame/burn them to death but realistically the hives can spawn anywhere under a mountain roof, which includes all the spots where you stripmine etc.


Events should follow the difficulty curve (roughly), and the problem with this event is that it becomes exponentially more difficult the higher the player's richness is. At a certain point its difficulty far surpasses what an event's difficulty should be in relation to the difficulty curve
#12
Ideas / Re: What's the point of peace talks?
September 18, 2018, 05:34:18 PM
Quote from: 5thHorseman on September 17, 2018, 05:58:00 PM
They don't slip into hating you. Without gifts and trade weighted in their favor, they become desperate and raid you out of necessity.

That's kind of corny, it's entirely possible to make a self sustaining colony in this game.

IMO factions should remain neutral at 0 unless the player does something to ruin their reputation. There should be some way to regain favor (or at least return to neutrality) with a faction without it constantly deteriorating. Sending pawns out on peace talk quests nonstop is just wasteful.
#13
Ideas / Re: Insect hive is still an awful event
September 18, 2018, 05:31:14 PM
Quote from: vzoxz0 on September 18, 2018, 03:24:54 PM
Without insects, mountains would be too easy and incredibly unbalanced. Take the good with the bad -- no droppods land on top of your colonists. No shelling during a siege.

No shit.

I'm not saying the game should not have insect hives, i'm saying they are terribly implemented and don't scale well into the late game.

I've talked to several other people who've all admitted to me that they've had to enter dev mode to delete hives because if you happen to let them multiply once or twice in the late game, their growth becomes impossible to stop.

My solution to this was to just remove the hive reproduction and instead replace it with something that's still dangerous to deal with, but scales better into the late game.
#14
Ideas / What's the point of peace talks?
September 16, 2018, 05:36:03 PM
If i get a peace talk quest for a tribe that has a natural tendency to become hostile, then what's the point?

I'll get their opinion of me closer to 0, then it will slowly return to the value it was before. It's a total waste of time.

Peace talk quests should only appear for tribes which do not have a natural tendency for their attitude to sour over time.
#15
you have some serious errors there, probably caused by one of your other mods. i can't even see any messages pertaining to hives here.