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

#1
Help / Re: Finding Closest Mineable Rock
January 04, 2016, 06:17:03 PM
Okay so I went back to the first approach and tweaked it to check for defs and not for request groups.


private Thing FindRockTarget(Pawn pawn)
{
            Predicate<Thing> validator = delegate(Thing t)
            {
                Building building = t as Building;
                if (!t.def.mineable)
                {
                    return false;
                }

                return (building.Position.CanReach(pawn.Position, PathEndMode.Touch, TraverseMode.NoPassClosedDoors, Danger.Deadly) && HiveUtility.IsInHive(t));
              };

            Thing thingToReturn;
            thingToReturn = GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(ThingDef.Named("Sandstone")), PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator, null, -1);
            if (thingToReturn != null)
            {
                return GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(ThingDef.Named("Sandstone")), PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator, null, -1);
            }
            thingToReturn = GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(ThingDef.Named("Marble")), PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator, null, -1);
            if (thingToReturn != null)
            {
                return GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(ThingDef.Named("Marble")), PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator, null, -1);
            }
            thingToReturn = GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(ThingDef.Named("Granite")), PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator, null, -1);
            if (thingToReturn != null)
            {
                return GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(ThingDef.Named("Granite")), PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator, null, -1);
            }
            thingToReturn = GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(ThingDef.Named("Limestone")), PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator, null, -1);
            if (thingToReturn != null)
            {
                return GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(ThingDef.Named("Limestone")), PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator, null, -1);
            }
            thingToReturn = GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(ThingDef.Named("Slate")), PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator, null, -1);
            if (thingToReturn != null)
            {
                return GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(ThingDef.Named("Slate")), PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator, null, -1);
            }
            thingToReturn = GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(ThingDef.Named("Wall")), PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator, null, -1);
            return null;
        }


Not elegant, probably slower than the previous solution. But at least it works!

;D
#2
Help / [SOLVED] Finding Closest Mineable Rock
January 04, 2016, 04:10:00 PM
Hello all, I am working on getting my mod Horrors back up and running, however there is one hurdle in the way presently:

Previously I could locate the closest rock to my digger using this code:

public static Thing ClosestRock(Pawn digger, float rockSearchRadius)
        {
            Predicate<Thing> validator = delegate(Thing t)
            {
                Building building = t as Building;
                if (t.def.eType != EntityType.Rock)
                {
                    return false;
                }

                return (building.Position.CanReach(digger.Position, PathMode.Touch, TraverseMode.NoPassDoors, Danger.Some) && RockAttackUtility.IsGoodTrashTargetFor(t, digger));
                // return (caccoonBuilding.Position.CanReach(kidnapper.Position, PathMode.OnCell, TraverseMode.NoPassDoors, Danger.Some) && caccoonBuilding.container.Empty && ReservationUtility.CanReserve(kidnapper, caccoonBuilding, ReservationType.Use));
            };
            return (Building)GenClosest.ClosestThingReachable(digger.Position, ThingRequest.ForGroup(ThingRequestGroup.Building), PathMode.Touch, TraverseParms.For(digger, Danger.Deadly, true), rockSearchRadius, validator, null, -1);
        }
    }


However, since the update, I no longer have a 'ThingRequestGroup.Building', it only describes items that are Artificial in nature and such. And the ThingRequestGroup is an enumerated integer that I cannot (Or don't know how to) alter.

So I tried everything I could think of on that approach, failed, and retook arms from another front, namely I looked at the 'JobGiver_Manhunter' code to determine how it targets turrets, the code is as follows (abridged):

private Thing FindTurretTarget(Pawn pawn)
{
return AttackTargetFinder.BestAttackTarget(pawn, (Thing t) => t is Building, 70f, 0f, TargetScanFlags.NeedLOSToPawns | TargetScanFlags.NeedLOSToNonPawns | TargetScanFlags.NeedReachable | TargetScanFlags.OnlyTargetCombatBuildings, default(IntVec3), 3.40282347E+38f);
}


But if I use that code to find a target I am running into another problem... It has to be hostile. So I dropped the 'TargetScanFlags.OnlyTargetCombatBuildings' flag in the hopes that it will work, but the class still has a check for hostility...

So I copied the class and created my own version where I merely removed the 'isHostile' check... But no joy.

Anyone have any suggestions regarding a possible way to approach this?

Thank you to anyone willing to read my issue and those whom reply, beforehand.
#3
Outdated / Re: [A11] Darkness
June 23, 2015, 01:30:52 PM
Huzzah!

UPDATED TO ALPHA 11!

Please give 'em a whirl and let me know if it is working proper-like. I'll be spending some more time on the forum again so yay for that, hopefully I can get some cool shit posted.

You guys rule! No better reason to mod than cool people enjoying it.
#4
Outdated / Re: [A9] Darkness
June 23, 2015, 01:17:33 PM
Righto guys, sorry for the absence. Been a mad time.

Got a job, place went under, got retrenched, place got saved, got rehired after exactly one day of unemployment, etc. etc.

Needless to say I have been slightly busy.

But no more! Friends! Countrymen! Join me for some renewed activity! Huzzah!
#5
Ideas / Re: Battering Ram Attack!
April 13, 2015, 01:41:25 PM
The Shinzy Ram NEEEDS to be a Norbal weapon of war
#6
Help / Re: Guns and Gizmos
March 27, 2015, 02:56:41 PM
Sorry mate, not a clue...

Shinzy did something with drawing pants that are equipped though so maybe you could look into that as a starting point?

Alternatively you could overwrite the pawn class and inject some extra code in the drawing function. Not Ideal though because of limiting compatibility with other mods.
#7
Outdated / Re: [MOD] (Alpha 9) Stroyent .99b
March 27, 2015, 01:24:38 PM
Cool, pm me your skype username and we can get going. But yeah TSD's seem to be some weird kind of energy/biomass storage. If you think about it they are pretty much only used in areas that are largely incredibly vital, and that house stuff like teleporters and some prety high-consumption gear.

It seems off thay they'd only be for energy, chances are that they are also 'food' for the massive amounts of organic machinery they have, stuff like their central processing brains that can't go without either stroyent or power.

But yes beyond having them store energy it is a mystery. Which is what makes the Strogg so cool, there is so much room for speculation. I have always loved the Strogg, and would love to help you, time permitting.

:)
#8
Can we get a traffic cone for a hat? I just feel... Traffic coney... At times y'know?
#9
Outdated / Re: [MOD] (Alpha 9) Stroyent .99b
March 26, 2015, 12:14:14 PM
Seriously though dude if you are a nerd you'll love dll modding, it is way more straight forward than even I initially thought. And there is really almost nothing you can't do with it.

Like say if you wanted to create this...



To help convert raw biomass into stroyent... requiring a living human... Slowly mutilating and killing them...

I have some code that could easily fit the bill from my horrors mod if you are interested?
#10
Outdated / Re: [MOD] (Alpha 9) Stroyent .99b
March 25, 2015, 02:44:34 PM


;D
#11
Outdated / Re: [MOD] (Alpha 9) Stroyent .99b
March 25, 2015, 01:27:32 PM
#12
Outdated / Re: [MOD](Alpha 9) Horrors - Update 2
March 13, 2015, 03:07:43 PM
Cool dude thanks for the feedback on balancing the leathers. Yeah I have next to no experience using the different fibres in-game and their properties. So I had no real idea what parameters to consider.

I can adjust the properties of the leathers to some extent so I'll see what I can glean from devilstrand's properties to get a comparison going.

Also are bulwarks attacking you? Because they aren't quite supposed to be in yet lol.
#13
Outdated / Re: [MOD](Alpha 9) Darkness
March 12, 2015, 03:53:32 PM
Yeah the solars don't really use 'light' as much as they use an estimated value of light based on the time of the day/night cycle. I'd have to program like a custom solar generator class and have the mod overwrite the vanilla solars that way in order to tweak it in any way.

I might do it if I get the time. Just can't believe how busy I am lately. See you around dude/ette/s. And thanks Famous Shoes for pointing that out. I didn't really notice that; but it'll probably drive me nuts going forward :p
#14
Outdated / Re: [MOD](Alpha 9) Horrors - Update 2
March 12, 2015, 03:48:12 PM
Thanks so much dude and/or dudette for the feedback and saying you love my work. I am really thinking about perhaps going into the full arty direction with spitters. Making them worse at close quarters but potentially somewhat more damaging to buildings.

I gotta work out some performance bogs in some of the AI they use, not too much work left but I might take some time doing it...

Sorry that I haven't been around so much lately. I got a new job yesterday (11th) and I am working my ass off to make a good impression. I hardly have any time for my hobbies lately. At least my weekend is totally open so I am planning on getting some serious coding in.

As always, keep it frigidly cool cadets.
#15
Outdated / Re: [MOD](Alpha 9) Horrors - Update 2
March 07, 2015, 07:26:51 PM
Quote from: tresflores on March 07, 2015, 06:47:02 PM
id be okay with like over walls but one of my people was inside a stone room with door locked and the still shot him

also i dont think it matters if they take out a few allies that would help my fps a bit considering it is going 3 frames a second due to over 200 worm attacking plus 3 spitters and 7 vicerals oh by the way its my second in game week

That means you incurred a 1150 point raid on week two. Did you dig up a bunch of gold by any chance?

Regarding spitters, you'll be happy to know that I will switch them back to not shooting over obstacles (since worms aren't going to stay attackers). I'll balance it out a lot more but I am incredibly busy just getting the Horrors to have all the behaviours I want in them.

Thanks for the input. And performance is indeed a big (if not MASSIVE consideration at the moment when it comes to the Horrors. Likely in the future the worm populations will be somewhat less troublesome.

The reasoning behind having Spitters spit over things (as mortars do) was to keep them from setting hundreds upon hundreds of worms on fire in one go. But since worms won't be clumping together like that in the future it'll change.

Also in the first iteration the worms were envisioned as the 'mind worms' from alpha centauri. But it became apparent that they are not formidable enemies and did not spread out like I'd want.

Also the spitter initially came in as a siege unit in order to give the horrors a chance when attacking heavily fortified positions. This too will change somewhat and they will have more of a secondary roll as defender of the Horrors rather than outright attacking. They will also be upped to more appropriate point costs as per the feedback I have received on them.

Viscerals I am happy with, I'll probably nerf them somewhat, not health-wise as much as armour-wise.

The worms will be made stronger and have more health so that I can drop their numbers. Having say 1-2 worms for every 10 you'd regularly incur. The AI they use will also be less intensive than standard combat AI they currently use. (smaller target search ranges, lowered target update frequency. etc. etc.)

Another point I'd like to address is the composition of troops when the Horrors attack. This has never been ideal and chances are in the future I'll migrate it over to an *incident* rather than an automatic *raid*. Or at least migrating some of the attacks to events and still keeping visceral attacks and stuff like that as regular raid.

So to close up my post. I am working feverishly on the mod, but it is insanely complex at this time and not yet in a (fully) playable form. The scope of the mod is quite grand behind the scenes and to be totally honest the Horrors as they are now is very far from where I want them to be. There are still bugs and hitches and lapses in behaviour at present I need to fix before uploading again.

Kindest regards and thank you all for the kind criticisms and words of concern. I have noted it and these things will change and be addressed. As always keep it cool guys and gals.