コード例 #1
0
 public static void ToggleMoodThoughtBubble(Pawn pawn, Thought thought, ref MoteBubble __result)
 {
     if (!bubblesEnabled)
     {
         __result = null;
     }
 }
コード例 #2
0
        protected virtual void DreamFeedback()
        {
            if (pawn.Awake())
            {
                return;
            }
            if (Find.TickManager.TicksGame < nextDreamMote)
            {
                return;
            }
            nextDreamMote = Find.TickManager.TicksGame + Rand.Range(minTimeDreamMote, maxTimeDreamMote);
            List <Texture2D> uiPath = new List <Texture2D>();
            List <Texture2D> wishIcons;

            for (int i = 0; i < wishes.Count; i++)
            {
                wishIcons = wishes[i].DreamIcon();
                if (!wishIcons.NullOrEmpty())
                {
                    uiPath.Add(wishIcons[Rand.Range(0, wishIcons.Count - 1)]);
                }
            }
            MoteBubble obj = MoteMaker.MakeThoughtBubble(pawn, "Things/Mote/SleepZ");

            if (uiPath.Count > 0)
            {
                obj.SetupMoteBubble(uiPath[Rand.Range(0, uiPath.Count - 1)], null);
                obj.def = HDThingDefOf.Mote_Dream;
            }
        }
コード例 #3
0
        public static bool SetupMoteBubble(MoteBubble __instance, Texture2D icon, Pawn target, Color?iconColor = null)
        {
            __instance.iconMat = MaterialPool.MatFrom(icon, ShaderDatabase.TransparentPostLight, Color.white);
            //__instance.iconMatPropertyBlock = new MaterialPropertyBlock();
            if (!allWorkerThreads.TryGetValue(Thread.CurrentThread, out ThreadInfo threadInfo))
            {
                __instance.iconMatPropertyBlock = new MaterialPropertyBlock();
            }
            else
            {
                Func <object[], object> FuncMaterialPropertyBlock = parameters => new MaterialPropertyBlock();
                threadInfo.safeFunctionRequest = new object[] { FuncMaterialPropertyBlock, new object[] { } };
                mainThreadWaitHandle.Set();
                threadInfo.eventWaitStart.WaitOne();
                __instance.iconMatPropertyBlock = (MaterialPropertyBlock)threadInfo.safeFunctionResult;
            }

            __instance.arrowTarget = target;
            if (!iconColor.HasValue)
            {
                return(false);
            }
            __instance.iconMatPropertyBlock.SetColor("_Color", iconColor.Value);
            return(false);
        }
コード例 #4
0
 public static bool Draw_Prefix(MoteBubble __instance)
 {
     if (__instance.link1.Linked && __instance.link1.Target != null && __instance.link1.Target.Thing != null)
     {
         return(__instance.link1.Target.Thing.fowIsVisible());
     }
     return(true);
 }
コード例 #5
0
        protected void ThrowMote(Pawn pawn)
        {
            //   Log.Message("M1");
            MoteBubble moteBubble2 = (MoteBubble)ThingMaker.MakeThing(ThingDefOf.Mote_Speech, null);

            moteBubble2.SetupMoteBubble(ChaosGodsUtilities.TryGetPreacherIcon(pawn), pawn);
            moteBubble2.Attach(pawn);
            GenSpawn.Spawn(moteBubble2, pawn.Position, pawn.Map);
        }
コード例 #6
0
 public static void ApplyHediffAdrenalineMedium(Pawn colonist)
 {
     if (HasHediffAdrenalineMedium(colonist) == false)
     {
         MoteBubble mote = (MoteBubble)ThingMaker.MakeThing(ThingDefOf.Mote_ThoughtBad, null);
         mote.SetupMoteBubble(ContentFinder <Texture2D> .Get("Things/Mote/IncapIcon"), null);
         mote.Attach(colonist);
         GenSpawn.Spawn(mote, colonist.Position, colonist.Map);
     }
     colonist.health.AddHediff(Util_AlertSpeaker.HediffAdrenalineMediumDef);
 }
コード例 #7
0
        public static MoteBubble MakeMoodThoughtBubble(this Pawn pawn, Thought thought, Texture2D icon, ThingDef bubble, List <ThingDef> DestroyingBubbles = null, List <ThingDef> ResistantBubbles = null)
        {
            if (Current.ProgramState != ProgramState.Playing)
            {
                return(null);
            }
            if (!pawn.Spawned)
            {
                return(null);
            }
            MoteBubble moteBubble = ExistingMoteBubbleOn(pawn);

            if (moteBubble != null)
            {
                if (!ResistantBubbles.NullOrEmpty() && ResistantBubbles.Contains(moteBubble.def))
                {
                    return(null);
                }

                if (!DestroyingBubbles.NullOrEmpty() && DestroyingBubbles.Contains(bubble))
                {
                    moteBubble.Destroy();
                }
                else
                {
                    return(null);
                }
            }
            MoteBubble obj = (MoteBubble)ThingMaker.MakeThing(bubble);

            //obj.SetupMoteBubble(thought.Icon, null);
            obj.SetupMoteBubble(icon, null);
            obj.Attach(pawn);
            GenSpawn.Spawn(obj, pawn.Position, pawn.Map);
            return(obj);
        }
コード例 #8
0
 private static MoteBubble ExistingMoteBubbleOn(Pawn pawn)
 {
     if (!pawn.Spawned)
     {
         return(null);
     }
     for (int i = 0; i < 4; i++)
     {
         if (!(pawn.Position + UpRightPattern[i]).InBounds(pawn.Map))
         {
             continue;
         }
         List <Thing> thingList = pawn.Position.GetThingList(pawn.Map);
         for (int j = 0; j < thingList.Count; j++)
         {
             MoteBubble moteBubble = thingList[j] as MoteBubble;
             if (moteBubble != null && moteBubble.link1.Linked && moteBubble.link1.Target.HasThing && moteBubble.link1.Target == pawn)
             {
                 return(moteBubble);
             }
         }
     }
     return(null);
 }