Making an animal stick to a specific type of terrain.

Started by ItchyFlea, July 01, 2014, 02:25:47 AM

Previous topic - Next topic

ItchyFlea

I've been thinking about adding fish to the coastal terrain generator, but don't know how to restrict them to the water tiles. Anybody know of a way, or willing to create a .dll that does this?
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

StorymasterQ

Did the Sand Lizard do this? I forget. Maybe it only spawns on desert but can move anywhere...
I like how this game can result in quotes that would be quite unnerving when said in public, out of context. - Myself

The dubious quotes list is now public. See it here

mrofa

You could look on vanillia ++ mod it have a zone that can contain colonist doing jobs only in it.
All i do is clutter all around.

pawnstorm

Quote from: ItchyFlea on July 01, 2014, 02:25:47 AM
I've been thinking about adding fish to the coastal terrain generator, but don't know how to restrict them to the water tiles. Anybody know of a way, or willing to create a .dll that does this?
I've looked into this a while back, I think the only way to do it properly is to write a custom A* pathfinder.
If I recall correctly, in alpha 3 it keeps a bool grid of all the passable tiles. Maybe you can work around creating a whole new pathfinding class if you store a custom passability bool grid somewhere and swap them when needed. Though I have a feeling the new region system in alpha 4 might make this alot harder.

On a sidenote, I did find a neat trick to make animal textures semi transparent. I haven't looked at alpha 4 much yet, but here's some code that works fine in alpha 3:

namespace Shai
{
    public class Hulud : Pawn
    {
        static Graphic naked = new Graphic(PawnKindDef.Named("Shai-Hulud").standardBodyGraphicPath, Color.white, MatBases.Transparent);

        public override void DrawAt(Vector3 drawLoc)
        {
            PawnGraphics graphics = drawer.renderer.graphics;

            if (!graphics.Resolved)
                graphics.nakedGraphic = naked;

            this.drawer.renderer.RenderPawnAt(drawLoc);
            this.stances.StanceTrackerDraw();
            this.pather.PatherDraw();
        }
    }
}


Quote from: StorymasterQ on July 01, 2014, 05:20:36 AM
Did the Sand Lizard do this? I forget. Maybe it only spawns on desert but can move anywhere...
Sand Lizards can move anywhere.

Quote from: mrofa on July 01, 2014, 05:50:44 AM
You could look on vanillia ++ mod it have a zone that can contain colonist doing jobs only in it.
The Vanilla+ "Stay inside during threats" option only changes the behaviour of AI.JobGiver.WorkRoot.TryGiveTerminalJob(Pawn pawn) so it skips destinations outside of the home region when there are enemies on the map.

mrofa

There is <baseMaterialType>Transparent</baseMaterialType> thingy in xml, but it dont really change anything much just make stuff abit darker, and transparency on textures still have only 3 levels.
Then again the code thing might be better :)
All i do is clutter all around.

pawnstorm

Quote from: mrofa on July 01, 2014, 10:57:11 AM
There is <baseMaterialType>Transparent</baseMaterialType> thingy in xml, but it dont really change anything much just make stuff abit darker, and transparency on textures still have only 3 levels.
Then again the code thing might be better :)
Oh, interesting... what do you mean with "only 3 levels" though? With "the code thing", you can just use the full range of the alpha channel in the image.

mrofa

Well opacity that is above 53% of the layer without visible background( also above 53%) will be a solid color in game.
Opacity of 50-51% is a slight opacity you can see thrugh but only when there is high contrast betwhen texture color and background, soo you could see black dots on the ground thrugh white texture.
And lvl 3 is 49% and below opacity, only the outlines of texture are shown.
Dont know anything about alpha channel except is a good way to save selections :D

Edit:Well ok im stupid just learned alpha channel stuff and opacity works fine :D
Thanks btw :)
All i do is clutter all around.

StorymasterQ

Maybe...you could define the sea as its own region somehow? Then keep that fish in that region.
I like how this game can result in quotes that would be quite unnerving when said in public, out of context. - Myself

The dubious quotes list is now public. See it here

Tynan

The easiest way I can think of would be to create a ThinkTree for them that uses a special version of the Wander node that only chooses wander destinations in water. Of course, every other behavior would also need to be overridden to choose water-only destinations.
Tynan Sylvester - @TynanSylvester - Tynan's Blog