Ludeon Forums

Ludeon Forums

  • December 03, 2020, 05:27:17 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: some thoughts on thoughts.  (Read 875 times)

JuliaEllie

  • Colonist
  • ***
  • Posts: 774
  • I am the one who mods.
    • View Profile
some thoughts on thoughts.
« on: September 21, 2014, 01:25:49 AM »

Hey everybody

Im trying to make a furniture which gives thoughts to pawns around and Im horribly failing. I tried a few approaches but none worked.

1st I tried to hijack the ThoughtGiver with public Thought GiveObservedThought() - I copied it from the Gibbet_Cage AND from the Corpse class but none of them seem to work for me.

2nd I tried to add thoughts via pawn.psychology.thoughts.TryGainThought() - works fine for other classes but doesnt do anything at all in my building also I cant find any override like: Observed() or something.

3rd I tried to implement it in my global observer class and defined IntVec3s via GenRadial.RadialCellsAround() but I couldnt find a (memory saving) way to get Pawns in those IntVec3s or the cells within the IntVec3s.

4th I tried <InspectedDirectThought> out of desperation. Guess what happened.. Nothing.

Share your thoughts. Maybe Im just stupid and dont see the solution.

Igabod

  • Planetologist
  • ****
  • Posts: 1099
  • Survival Expert
    • View Profile
Re: some thoughts on thoughts.
« Reply #1 on: December 05, 2014, 02:40:20 PM »

I was wondering if any headway was made on this issue. I'm was thinking of doing something like this myself. Obviously it is doable in alpha 8 so my project might wait until then, but if it is possible now (on A7) without any .dll work then I might get started on it.

JuliaEllie

  • Colonist
  • ***
  • Posts: 774
  • I am the one who mods.
    • View Profile
Re: some thoughts on thoughts.
« Reply #2 on: December 05, 2014, 03:29:37 PM »

Igabod

  • Planetologist
  • ****
  • Posts: 1099
  • Survival Expert
    • View Profile
Re: some thoughts on thoughts.
« Reply #3 on: December 05, 2014, 03:35:35 PM »

should I take that as a no?

Rikiki

  • Colonist
  • ***
  • Posts: 966
    • View Profile
Re: some thoughts on thoughts.
« Reply #4 on: December 05, 2014, 04:08:04 PM »

You definitely need .dll... ;)

Here is a simplified example from M&Co. Security enforcement:
Code: [Select]
            IEnumerable<Pawn> colonistList = Find.ListerPawns.FreeColonists;
            foreach (Pawn colonist in colonistList)
            {
                if (colonist.Position.WithinHorizontalDistanceOf(this.Position, maxRange)
                    && (this.GetRoom() == colonist.GetRoom()))
                {
colonist.psychology.thoughts.TryGainThought(new Thought(ThoughtDef.Named("ThoughtDefName")));
                }
            }