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

#16
Releases / Re: [A17] SimpleSidearms (1.2.1)
November 25, 2017, 11:30:40 AM
Quote from: Roolo on October 30, 2017, 08:39:37 AMNow my question is: Is it ok if I use some of your code to implement my mod's options?

By all means, go right ahead.

Quote from: FrodoOf9Fingers on November 20, 2017, 09:57:01 PM
Created a temporary patch for B18, and sent a pull request to the author. If you want an unofficial version, download the zip here:
https://github.com/FrodoOf9Fingers/SimpleSidearms
Now less unofficial than ever. Thanks!
#17
Releases / Re: [A17] SimpleSidearms (1.2.1)
August 22, 2017, 05:43:10 AM
Well, like I said, the formula is based on Rimworld's own DPS formula, which I think is this (its been a while, I didnt remember where it was and I found this by searching the code for " dps", so...)

int num = burstShotsGetter(d);
float num2 = warmupGetter(d) + cooldownGetter(d);
num2 += (float)(num - 1) * ((float)d.Verbs[0].ticksBetweenBurstShots / 60f);
return (float)(damageGetter(d) * num) / num2;

Yeah. Given the helpful variable names (Im sorry decompiler, I know you tried your best), I didn't want to make too many changes to the formula if I could help it, especially while I was writing it (I think I rewrote this function like three times before it started working?). That's why the speed bias is in its own little addition (warmup + 0.25 * warmup comes out at 1.25 warmup just like it should). Everything after the division sign is time between firing cycles (The warmup time, cooldown, bursting time). There's one less burst shot at the end because that part of the formula is counting the time between burst shots (with a five round burst you have four gaps) and the time between shots is divided by sixty because I dont know ask Tynan.

Like I said, it took me a few tries to get this right (and like fifteen minutes to figure out again just now). Its not the most intuitive formula.
#18
Releases / Re: [A17] SimpleSidearms (1.2.1)
August 21, 2017, 06:27:13 PM
Quote from: sirgzu on August 21, 2017, 02:38:13 PM
I can confirm there is a bug with the ranged weapon selection logic.

pawns will only switch ranged weapons when they detect a threat in their currently equipped weapon range area instead of considering their side weapons range.
This also explains why when you have a melee weapon equipped you'll never switch to ranged.

Thats not a bug, its a lack of a feature. At one point I spent like two weeks trying to get it to work - it was just too much of a buggy mess and never worked quite right.

Quote from: sirgzu on August 21, 2017, 02:38:13 PM
Also idk what's the formula for computing weapon preference but I'm not sure it's taking burst shot count into consideration.
I attached two weapons for comparison, with default settings the game favours the mosin-nagant over the ppsh up to 8 tiles close.
according to my calculations, the ppsh is the winner at any range, here it goes:
ppsh: 8(dmg)*10(burst)/(1.9(warmup)+2.2(cooldown))*0.3(accuracy,long) = 5.85(dmg/s) worst case scenario
mosin: 17(dmg)/(1(warmup)+1.7(cooldown))*0.86(accuracy,medium) = 5.41(dmg/s) best case scenario
the pawn should keep using ppsh until max(19)range and switch to mosin beyond that. am I missing something?

One thing to know is the DPS calculation takes into account the current distance to the target. Burst shot should be accounted for (though I might be wrong, its been a while since I wrote that function). Lets see...

VerbProperties atkProps = atkVerb.verbProps;
           
            if (atkProps.range * atkProps.range < range || atkProps.minRange * atkProps.minRange > range)
                return -1;

            float damage = (atkProps.projectileDef == null) ? 0 : atkProps.projectileDef.projectile.damageAmountBase;
            float warmup = atkProps.warmupTime;
            float cooldown = weapon.def.GetStatValueAbstract(StatDefOf.RangedWeapon_Cooldown, null);
            int burstShot = atkProps.burstShotCount;
            int ticksBetweenShots = atkProps.ticksBetweenBurstShots;
            float rawDps = (damage * burstShot) / (((warmup + cooldown)) + warmup * (speedBias - 1f) + (burstShot - 1) * (ticksBetweenShots / 60f));
            float Dps = rawDps * GetHitChanceFactor(atkProps, weapon, range);

            return Dps;

Right. There's the speed bias (to favor faster weapons so you actually get shots off at close range before getting interrupted by melee attacks) and after a point in the warmup is reached the shot wont be interrupted anymore (there's config options for both). The rest of it? I think I nicked it from the vanilla's game DPS stat calculator...
#19
Unfinished / Re: [A17][WIP] Macrocosm
August 21, 2017, 08:01:23 AM
Quote from: faltonico on August 21, 2017, 07:43:55 AM
Object with load ID Thing_Human2797 is referenced (xml node name: li) but is not deep-saved. This will cause errors during loading.

Object with load ID Thing_Human2797 is referenced (xml node name: Pawn) but is not deep-saved. This will cause errors during loading.

Warnings are not saved completely in the log, and i didn't care to save them separately, so these are truncated, I had so many of those errors before that i thought they were unimportant really.
Next time i'll clear world pawns with RuntimeGC and see if the "could not get new name" error keeps happening. I had it installed but i thought it was not necessary to use it yet.

Regarding the buildings, what difference do they make? i only have 1 hex highlighted around my base that i presume is the perimeter i can get warnings from, does that perimeter gets bigger when someone is using a scouting building?

There's a new work assignment in the work tab (scouting). Your colonists should all be assigned to it by default. Pawns with that assignment will seek out scouting building and ...scout at them. When the progress bar is finished, the game updates that colony's ticks for that particular radius to that building's hidden value(I think I set it to last about a day) and while theres more than zero ticks in a radius (they keep ticking down), that colony's scouting range is going to be at least that big. Each building also has a tick threshold at which pawns will use it to scout which is greater than the time it takes to scout, so assuming there is someone free to do it you will always have full coverage.

For example, here is the relevant data for the scouting tower:

     
      <ScoutingTileRange>2</ScoutingTileRange>

...

<li Class="Macrocosm.macrocosm.buildings.CompProperties_ScoutLocationManned">
        <ticksCapacity>20000</ticksCapacity>
        <ticksForJob>5000</ticksForJob>
<scoutingTimeTicks>3000</scoutingTimeTicks>
<allowsRoof>false</allowsRoof>
      </li>


Effectively, colonists scout at a building for a while, then for a while after that you have that building's scouting range. The hill and the tower have a range of 2, the camera console is range 3 and the drone system is range 4.
#20
Releases / Re: [A17] SimpleSidearms (1.2.1)
August 21, 2017, 07:25:04 AM
Quote from: BeoTea on August 17, 2017, 08:53:47 PM
Thanks, now I've gotta find a reason why SS wont work for me. When I turn it on, the debug menu pops up and there's lots of red. Time to learn what red means.
It means you're getting exceptions and should press that little copy button in the corner and let me see it, ideally along with a modlist and a savegame  :D
Quote from: DukeAl on August 20, 2017, 03:33:36 PM
Hi,
I get an error in the debug log when using your mod. I have uploaded the output_log.txt here: https://gist.github.com/4defbd44a3af9276382747b69f86aa67
I'm using your latest version (1.2.1) together with CE (0.17.1.4c) and a bunch of other mods.
And of course thank you for this great mod :)
See, this guy gets it. Fix'd.

Quote from: [email protected] on August 19, 2017, 11:56:09 PM
Don't use this mod with zombieland. My pawns keep going back to collect their weapons = dead pawn. :(
Unfortunately given how the AI works I can only make recovering sidearms more or less important than ALL the work assignments (including bed rest).
Unless invisible work tabs are a thing, which they may very well be. I'll check at some point (but not soon; I've got other things to attend to, not the mention I really should get around to being a Responsible Adult soon).
#21
Unfinished / Re: [A17][WIP] Macrocosm
August 21, 2017, 07:14:27 AM
Oh hey, my eyes no longer look like I've recently attempted to summon Dormammu, the master of the dark dimension. Neat.

Anyway, in the interest of fostering discussion (and because future me is probably reading this post to see what needs to go in the tutorial) I'll go into my thought processes when they come up:

Raids that drop in from orbit indeed don't get an early warning. In vanilla Rimworld you get the occasional raid that uses drop pods but spawns on the edge of the map anyway (so it's functionally identical to regular raids), I figured it'd make things interesting if there was some gameplay difference for those raids.
As you research techs you unlock better versions of the scouting buildings (I think the first one, the camera console, is unlocked with microelectronic basics) and scouting outpost buildings, though at some point it switches to new Macrocosm techs. Scouting buildings have a stat in their stat block that tells you the scouting range of that building, and pawns will automatically only use the best building available.
Even a colony with no scouting buildings has a vision range of 1. Unless everyone is dead.
Raids, visitors, traders etc. all spawn at settlements and head out from there. This means that with a nearby outpost you can get raid warnings days in advance.

Some things you can't do or don't happen, but I might get around to doing eventually:
Intercepting caravans
Storing items at outposts
Making the "refugee chased" incident make sense (right now a refugee shows up and then a raid spawns somewhere days of walking away)
Scouting outposts actually being in any danger whatsoever ever
NPC caravans actually needing food? But probably not
Toxic fallout origin being a visitable location that you can go to to stop the damn thing early
...probably not for the volcanic winter's volcano, though
"Others will take it if you don't" for item stashes not being a dirty lie

Again, this is *not* a list of planned features. It's things I'd *like* to do, assuming I had infinite time to work with. So, you know, if you have particularly strong feelings about something on that list, voice it: I am bad at saying no to people  ;)

Anyway, onto the bug reports that I will not be trying to fix right now because I am a Responsible Adult and really, really should Study for my Finals. Hopefully typing that out will guilt-trip me to actually do it
Tried to remove world object Caravan_Macrocosm Caravan 4 (tile=461935) from the world, but it's not here.
I've occasionally had that happen during testing but I haven't tracked it down yet. It happens when all pawns in a caravan die - for some reason sometimes the game tries to remove the caravan twice?

Could not get new name.
Huh. That's in vanilla code. I guess the game ran out of pawn names? There does tend to be a lot of caravans wandering about in the fog later in the game, which means that all those pawns continue existing (and presumably hogging their name, inconsiderabe bastards), so maybe that has something to do with it...

System.NullReferenceException: Object reference not set to an instance of an object
  at Macrocosm.extensions.Caravan_Macrocosm.Tick () [0x00000] in <filename unknown>:0

One day, I will write a method and I'll actually null-check everything. Infact... *quick check*
three different things that could be null here. I guess I'll push a super-quick update for that.

QuoteI got several notifications that some of the caravans ran out of food as well
Presumably since you never left the colony that means NPC caravans. Makes sense - I've put in a little hack that makes NPC caravans never actually go hungry, but if the food pawns spawn with rots away or something the game will still notice the caravan doesnt have food anymore. I'll have to track down where that notification comes from and intercept it for non-player caravans.

Quotehuge amount of warning saying that a lot of pawns were not deep saved.
Yeah I don't *really* understand the Rimworld saving system quite yet. Paste me the warning just in case, but I'm pretty sure I've been getting them too. I'll figure it out eventually.
#22
Unfinished / [A17][WIP] Macrocosm
August 19, 2017, 05:18:48 AM
So I'm sick, the kind of sick that makes staring at monitors for extended periods of time inadvisable. This is rather inconvenient since I'm sitting on a mostly-ready for first release mod. I'll get better in a few days, but unfortunately, I'm already past my self-imposed deadline that I really can't afford to ignore for boring and sensible reasons. Oh well, I might as well put up what I've got now and call it a beta test or something...

I'm actually not gonna go into detail about what the mod does either, since an issue I had with SimpleSidearms was a lot of people were simply not aware of certain features (I've lost track of how many people have complained about pawns dropping their weapons), so this time around I'd like to collect some data on what is obvious and what needs to be made obvious. Same with what kind of mod settings and options people will want. Also, you know, sick.

Mods you should not expect to play well with this: basically anything that either relies on or alters vanilla raid/visit/caravan arrival incidents. Probably a whole bunch of others. Should work fine when dropped into an existing save. All sorts of things will explode when removed from one.


Scouting is a thing now. Raids, visitors and traders travel on the world map.

So does toxic fallout and volcano ash.

For some reason I ended up making a Rimworld minigame inside Rimworld? I don't know why or how that happened, but there it is. At least it gives you early warnings on approaching raids, I guess.

Here it is. Use at your own risk.

No seriously. If you're one of those (sensible) people who don't like their save ruined, you might want to give this a pass for now.

#23
I've got a question / possible bug report.

There's an empty virtual method in MapParent:

public virtual void PostMapGenerate()
{
}


Its overrided by a grand total of one class, Site:

public override void PostMapGenerate()
{
base.PostMapGenerate();
Map map = base.Map;
this.core.Worker.PostMapGenerate(map);
for (int i = 0; i < this.parts.Count; i++)
{
this.parts[i].Worker.PostMapGenerate(map);
}
this.anyEnemiesInitially = GenHostility.AnyHostileActiveThreat(base.Map);
}


Given the following patches:

    [HarmonyPatch(typeof(MapParent), "PostMapGenerate")]
    public static class MapParent_PostMapGenerate_Postfix
    {

        [HarmonyPostfix]
        private static void PostMapGenerate(MapParent __instance)
        {
            Log.Message("post map generate");
            //custom code...
        }
    }

    [HarmonyPatch(typeof(Site), "PostMapGenerate")]
    public static class Site_PostMapGenerate_Postfix
    {

        [HarmonyPostfix]
        private static void PostMapGenerate(Site __instance)
        {
            Log.Message("post map generate SITE");
            //custom code...
        }
    }


Only the first patch gets called (as expected) when MapParent.PostMapGenerate gets called on non-Site classes inheriting from MapParent (specifically, I've been testing by attacking faction bases). The weird part is that only the second patch (or nothing, if I comment it out) gets called when PostMapGenerate is called on an instance of Site (tested by entering ItemStashes and PreciousLumps spawned through the debug commands), even though the override calls the base function (base.PostMapGenerate(); )...

Is it supposed to work like that? Is it a consequence of the compiler being too smart and optimizing away the empty function call? Is it a bug? Am I being stupid?
#24
Over in my mod thread...
Quote from: PeteTimesSix on July 03, 2017, 11:10:52 PM
Added basic CE compatibility. When CE is loaded, SimpleSidearms disables its own inventory management and postfixes CE's alternative weapon verbs. It's pretty simplistic so I expect some issues to crop up, but there you go.
If anyone uses the two mods together, I'd love some reports on how (or if) it works fine now. Hopefully I can get SimpleSidearms removed from the list of conflicting mods.
#25
Releases / Re: [A17] SimpleSidearms (1.2.1)
July 03, 2017, 11:10:52 PM
Added basic CE compatibility. When CE is loaded, SimpleSidearms disables its own inventory management and postfixes CE's alternative weapon verbs. It's pretty simplistic so I expect some issues to crop up, but there you go.

#26
Releases / Re: [A17] SimpleSidearms (1.2.0)
June 26, 2017, 02:03:14 PM
Quote from: lorebot on June 26, 2017, 10:50:06 AMOn the subject of in-combat weapon retrieval

I've implemented that about three different ways by now, and nothing quite worked right (a fun one was a pawn infinitely cycling between two miniguns). I might eventually figure out a way of doing it that doesn't break, but ultimately the combat AI is just not designed to allow for automatic jobs (such as picking up items).

As for the whole "dropping ranged weapons in favor of melee" thing, well, I'll admit this is personal bias but I much preferred the older versions of Rimworld where melee attacks reset ranged warmup. I'll probably add a toggle for it in the next release.

Quote from: metal_fish on June 25, 2017, 10:36:01 PM
Created an account here just to say i've been looking for a mod like this for ages! This needs more exposure!
Posts like these keep me going :D
#27
Releases / Re: [A17] SimpleSidearms (1.2.0)
June 21, 2017, 04:13:22 PM
New version is out.

Added learning helper popups!

-fixed mechonoids again
-investigated in-combat sidearm recovery (not this way)
-added in-combat switching back to primary weapon


EDIT: Oh yeah, and one I forgot: enemies will now also retrieve weapons (in a small radius, to prevent visitors nicking your masterwork pistols or whatever).
#28
Okay! I've successfully failed my final exam (it'll be fine) and thus once more know what the words "free time" mean.

Quote from: Spdskatr on June 18, 2017, 06:26:46 AM
I've analysed the bug and it appears in line 39 of TradingStockpile.cs:
                                if (tradeable.CanAdjustBy(-tradeableThing.stackCount).Accepted)
                                    tradeable.AdjustBy(-tradeableThing.stackCount);


I'm proposing to change it to:
                                if (tradeable.CanAdjustBy(-tradeableThing.stackCount).Accepted && tradeable.TraderWillTrade)
                                    tradeable.AdjustBy(-tradeableThing.stackCount);


Done and thank you.

Quote from: damngrl on June 18, 2017, 06:50:55 AM
I wish you can release each patch separate.
I consider the hassle of downloading separate minimods to outweight the hassle of disabling parts of one mod you dont want. Its a personal preference, but well, thats what this mod is in the first place.

Quote from: Draconicrose on June 18, 2017, 12:38:51 PM
This also happens to animals too! Almost sold my warg twice because it was roaming around on top of a trade stockpile!
Fixed!

Quote from: skyarkhangel on June 18, 2017, 05:54:23 PM
just add a check in DoConfigInterface, to avoid this bug:

            if (__instance.recipe.products.Count() <= 0)
                return;


Done and thank you.

Next up, SimpleSidearms!
#29
Releases / Re: [A17] SimpleSidearms (1.1.1)
June 04, 2017, 08:39:52 PM
Quote from: Pichu0102 on June 03, 2017, 06:58:31 AM
I've noticed pawns won't swap to longer range weapons in their inventory if their target goes out of range of their current weapon.

Yeah, that'd require digging a bit deeper into combat AI than I wanted to when I started. I might still do it, but Ill do so carefully to avoid breaking (more) things...

Quote from: Walking Problem on June 04, 2017, 12:21:27 PM
Hiyo~

I think this mod causes pawns (including centipedes) to drop their weapon upon getting hit....

Or is this done on purpose in the mod? =x

Dropping weapons is on purpose, and can be disabled in the mod settings menu.

Centipedes though, are not supposed to be affected. Ive actually fixed that issue before, but apparently reintroduced it when I made pawns consider unarmed attacks as an option. Ill fix it with next release.

Quote from: kchou94 on June 04, 2017, 07:17:47 PM
Hello,

Still loving this mod.  Here's a bug I've noticed that ignores the sidearm limits:

1. Set melee and ranged sidearm limits to specific weapons.
2. Fully equip a pawn with a main weapon (larger than sidearm limit, e.g. rifle), ranged sidearm, and melee sidearm.
3. Switch to a sidearm.  The pawn now has their main weapon put in pockets.
4. Order pawn to pick up another weapon as main.
5. Pawn picks up new main weapon and retains prior main weapon (rifle) as a "sidearm.'

Question, how does the mod decide which weapons to auto-switch to?  For example, choosing between two different ranged weapons.

True. I was aware of this, but decided not to try to prevent it since itd be a headache to deal with, and in any case its an exploit that you only have yourself to blame for if you use it (and if that's what you want to do you can do it with the customization options instead anyway).

Pawns decide on weapons depending on their DPS (accounting for range), modified by the weapon attack speed bias set in the settings.

Quote from: klun on June 02, 2017, 01:10:09 AM
Good Mod Thanks!!

Any plan to add some support for melee weapons that require activation: like Lightsabers or something similar ??
Not at the moment, since there is no such functionality in vanilla Rimworld, so every mod will do it using its own implementation (I'd probably have to write special case handlers for every mod like that out there).

Quote from: Pupun2542 on June 03, 2017, 12:59:20 AM
I sent some colonist to settle new colony but when they arrive sidearm all weapon disappeared
I'm afraid I can't do much about it without something to work with. Ideally, a save file right before it happens.
#30
Outdated / Re: [A17] PeteTimesSix's QOL tweaks pack
June 01, 2017, 11:08:54 PM
Quote from: Oken on June 01, 2017, 10:13:50 PM
I'm having a big problem with the "consider storage when butchering" option and stonecutting. I can't cut any stone unless I uncheck that option. When I try to force it it says "need materials"

here is the log.
*snip*

Welp. I know what the problem is, actually, I just apparently forgot to fix it. I'll fix it first thing in the morning (or later today, anyway), once Im awake enough to read code again.

EDIT: And done.