Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 29th Jul 2014 at 8:00 PM
Default Houseboat Patrols / Water interaction
Hey friends, I've been lurking for quite a while and I think I finally have an excuse to come say hello.

So here's the idea, you click one spot in the Sea, there's a "Set point 1" interaction, it saves the Vector3 to a variable...point 2, same thing, and then... a Sim/Helm interaction that gets your Houseboat (by calling Queries.GetObjects()), and then loops Houseboat.RouteToRadialRange() between Vector3 point 1 and point 2 until the user cancels, also probably calling Motives.MaxEverything so the Sim can loop indefinetely. This would presumably create constantly moving boats in the player's world.

But.. how to go about interacting with the Sea and capturing the Vector3?

I've seen Consorts code in Nona's interaction tutorial at Simlogical, injecting interactions into the Terrain, and I have a feeling this is going to have something to do with GetTerrainType() returning TerrainType.WorldSea.. just haven't been able to put it all together. Thanks for any suggestions. Here's what's NOT working (shows up on all terrain, not just water in some worlds, does not show up at all in others, and it returns 0/0/0 for Vector3, at least in the ToString() output)

Code:
internal sealed class seaClick1 : Interaction<Sim, Terrain>
    {
        public static readonly InteractionDefinition Singleton = new Definition();
        protected override bool Run()
        {
            StyledNotification.Show(new StyledNotification.Format("Point: " + base.Target.Position.x.ToString() + "," + base.Target.Position.y.ToString() + "," + base.Target.Position.z.ToString() + 
                System.Environment.NewLine + "Type: " + World.GetTerrainType(base.Target.Position).ToString(), StyledNotification.NotificationStyle.kGameMessagePositive));
            return true;
        }
        [DoesntRequireTuning]
        private sealed class Definition : InteractionDefinition<Sim, Terrain, seaClick1>
        {
            protected override string GetInteractionName(Sim actor, Terrain target, InteractionObjectPair interaction)
            {
                return "Set point 1";
            }
            public override string[] GetPath(bool bPath)
            {
                return new string[] { "Patrol" };
            }
            protected override bool Test(Sim actor, Terrain target, bool IsAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (World.GetTerrainType(target.Position) == TerrainType.WorldPond || World.GetTerrainType(target.Position) == TerrainType.WorldSea) { return true; }
                return false;
            }
        }
    }
Back to top