Ludeon Forums

Ludeon Forums

  • May 24, 2022, 06:13:21 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

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.

Topics - twoski

Pages: [1] 2 3 4
Help / Stored Ticks Changing After Load
« on: 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:

Code: [Select]
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))
            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?

Help / Cleaning JobGiver
« on: 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:

Code: [Select]
namespace RimWorld
    public class JobGiver_Compulsion: ThinkNode_JobGiver
        protected bool IgnoreForbid(Pawn pawn)
            return pawn.InMentalState;

        protected override Job TryGiveJob(Pawn pawn)
            if ( > 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:

Code: [Select]
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.

Ideas / What's the point of peace talks?
« on: 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.

Ideas / Colonists knocking themselves out
« on: September 13, 2018, 02:56:49 PM »
So sometimes if one of my colonists with weakened movement gets stressed, they will go and smoke a joint.

The problem with this is that the joint reduces their ability to walk, causing them to fall over incapacitated. This is kind of wack. Even if my grandmother with a bad hip smoked a joint she wouldn't suddenly fall over and become a ragdoll.

It would be nice if these drugs wouldn't induce this sort of thing. Or, if they absolutely must, then the pawn should do a check to see if smoking the joint would incapacitate them, and smoke accordingly.

As it stands, it's not an incredibly realistic dynamic.

Ideas / Insect hive is still an awful event
« on: September 12, 2018, 01:10:42 PM »
The insect hive event is important since it creates a new threat for people who make mountain bases. The problem is that it's so incredibly poorly implemented. They made it worse because now as soon as you ignite one of the hives, the entire army of insects raids you. In my situation the hives happened to appear in the caves away from my base but that really only makes it harder to deal with.

This wouldn't be so terrible if the insects weren't the most insanely tanky npcs in the game. i have a colony of 10 dudes outfitted with LMGs, miniguns, heavy SMGs, etc and none of this puts a dent in the army of bugs before they overwhelm the colonists. They are just too numerous, and i don't have the luxury of time when it comes to creating more defenses, since THE HIVES REPRODUCE AT A GEOMETRIC RATE.

If you don't fight them within 3 days of the hives appearing your savefile is effectively ruined since the hives spread with no upper limit. The amount of insects will become nearly impossible to handle, and if you get raided or something else happens to delay you, then they will actually reproduce so much that it causes severe framerate loss due to all the insect NPCs constantly pathing around and digging, etc. It's just a horribly conceived event.

Glad to see ludeon has doubled down on making this the most unenjoyable event in the game! At least in the past the bugs didn't suddenly become skynet when you ignited their hives.

It would be very easy to make this event decent: Hives should not reproduce AT ALL. Instead, they should periodically spawn manhunter spelopedes that hunt down colonists and dig through walls, etc.

Ideas / Poison strawberries?
« on: September 11, 2018, 01:16:39 AM »
Wild berries that grow on bushes are "high risk". Which means they can sometimes be poisonous and cause sickness.

The strawberries you can grow in designated grow zones are also just considered generic wild berries when harvested. They can also poison pawns. I dunno about you guys but i've never had a strawberry that was poisonous before.

Is this a bug? Did they forget to rename strawberries to something more appropriate?

Ideas / Food poisoning from bad cooks
« on: September 10, 2018, 05:17:12 PM »
I think the game currently is very punishing to players with low level cooks. It seems like you have a very high chance to poison people below a certain threshold.

While I think the game needs to punish low skill cooks, there isn't enough variety. It should be something like:

LVL 1-2: high food poisoning chance
LVL 3-4: chance to fail and not produce food like how construction fails.
LVL 5-6: chance to make food that tastes as bad as nutrient paste

At lowest level your cook would have a chance to have any of those 3 failures occur, not just food poisoning.

It would add a bit of variety to the failures I think.

Ideas / Nudist debuffs from jackets
« on: September 09, 2018, 05:18:34 PM »
I think nudist is a trait that needs rethinking. In biomes where you need to give people a parka to wear (or risk them getting hypothermia), it's basically a permanent mood debuff.

Nudist should only apply to pants and shirts, not jackets/hats/body armor. You shouldn't punish people for trying to keep their dumbass pawns from freezing to death because clothes make them grumpy.

Does anyone actually know a nudist in real life that is so staunchly against wearing clothes that they'd rather risk hypothermia in the middle of winter than wear a jacket?

Ideas / Let's discuss the "trade request" event
« on: September 06, 2018, 09:10:50 PM »
Personally, i think this event sucks. Here are some images to help explain.

First problem: The randomly generated thing that these people request from your settlement is often so ludicrous that it makes the rest of their offer irrelevant. Where am i going to get 340 human leather from?

Second problem: it's also stupid from a storytelling standpoint. You're gonna tell me that this band of colonists will trade me a masterwork LMG, a plasteel dresser and some Luciferium for 23 cowboy hats? What kind of idiotic trade deal is that?

I think this event has a place in the game, but it needs a severe overhaul. Restrict the quantity being asked for based on what the player has. If the player has 100 herbal medicine, then the mission will never ask for more than 100 herbal medicine. This makes the trade deals feasible and worth considering. If your trade deal asks the player for 300 herbal medicine but they only have 100, there's no way they can even partake in the trade deal even if they wanted to.

Help / Insect Think Trees
« on: December 11, 2017, 08:43:38 PM »
I am modding the insects (spelopede, etc) and i am running into a think tree error.

Problem is, i can't find their think trees anywhere in the ThinkTreeDefs. Are they stored elsewhere?

Ideas / Downed mechanoids
« on: June 24, 2017, 06:44:22 PM »
I find it really weird that downed mechanoids never die. You can leave them injured and twitching on the ground and they will remain that way indefinitely.

Since everything else in the game "deteriorates" if left outdoors, shouldn't that also happen to downed mechanoids? You can kind of cheat the system currently. If you kill a mechanoid then you have to haul it to a roofed stockpile or else it slowly deteriorates. However an unkilled one stays that way forever so you can effectively just wait until it's convenient to put it out of its misery with 1000000000 punches (which is also annoying but not the point of this post)

Since downed mechanoids don't have blood they don't bleed out, perhaps they could have some other way of "bleeding out" such as a low (like 10%) chance to fizzle out and die when it rains. Maybe they could even randomly just fizzle out and explode into a fireball if left alone too long, could give more incentive to encourage people to kill them

Help / A16 changes to the Find class
« on: December 31, 2016, 06:53:59 PM »
So before A16 came out, there was no concept of several maps. You just had the one map with your colony and that is all.

My mods made use of classes like Find.ListerBuildings, etc. But now it seems that each map has its own class which contains these things.

I guess my question is how do i grab the current active map class? And in some cases, given a random pawn, how would i figure out what map it is on?

Bugs / Art description bug
« on: September 11, 2016, 08:50:30 PM »

Bugs / Pathing bug
« on: September 11, 2016, 04:13:36 PM »
Note that this bug p[robably doesn't occur often, it happened because i had a LOT of spelopedes spawned and many of them were performing the same job.

Still, it exposed a possible bug with some other function so i figured i would share it.

Bugs / Multiple errors in art description
« on: September 08, 2016, 10:37:20 PM »

I think art descriptions need to be revisited, this is just straight up nonsense from start to end.

Pages: [1] 2 3 4