public void Effect() { IntVec3 correctedCell = currentTarget.Cell; if (ToolsCell.CellHasBuildingOrMaturePlant(currentTarget.Cell, CasterPawn.Map, myDebug)) { correctedCell = ToolsCell.GetCloserCell(CasterPawn.Position, currentTarget.Cell, CasterPawn.Map, myDebug); } if (correctedCell == IntVec3.Zero) { Tools.Warn("Failed to find a better cell", myDebug); return; } Thing myNewSpot = MindSpotUtils.CreateMindSpot(correctedCell, CasterPawn.Map, MyDefs.SpotKind.fondle); if (myNewSpot == null) { Tools.Warn("myNewSpot is null after CreateMindFlaySpot", myDebug); return; } MindSpotUtils.TryGetMindSpotComp(myNewSpot).SetPawn(CasterPawn); }
public override void CompTickRare() { base.CompTickRare(); //Applying torment List <Pawn> affectedPawnList = new List <Pawn> { }; affectedPawnList = ToolsCell.GetPawnsInRadius( buildingPos.ToIntVec3(), Range, myMap, Props.affectsAnimals, Props.affectsHumanlike, Props.affectsMechanoids, Props.affectsColonists, Props.affectsNeutralOrFriends, Props.affectsEnemies, prcDebug ); foreach (Pawn curPawn in affectedPawnList) { // Slugs are immune to this if (curPawn.IsSlug()) { Tools.Warn(curPawn.Label + " is slug, not affected", prcDebug); continue; } // Add psychicSensitivity * SocialImpact * SocialSkill fight here if (ToolsBodyPart.ApplyHediffOnBodyPartTag(curPawn, BodyPartTagDefOf.ConsciousnessSource, hediffDefToApply, prcDebug)) { if (IsFlaySpot) { Thought_Memory MindFlayed = (Thought_Memory)ThoughtMaker.MakeThought(MyDefs.MindFlayThought); curPawn.needs.mood.thoughts.memories.TryGainMemory(MindFlayed, Initiator); } //GfxEffects.ThrowPsycastAreaMote(curPawn.Position.ToVector3(), myMap); GfxEffects.ThrowMindMote(curPawn.Position.ToVector3(), myMap, spotKind); AffectedPawnsNum++; } } if (IsLimitExceeded) { Initiator.ApplyTiredness(); } //Checking if Initiator is not mad or downed or sleepin or on fire if (Initiator.InMentalState || Initiator.Downed || Initiator.IsSleepingOrOnFire() || AffectedPawnsNum > Props.hediffAppliedLimit) { GfxEffects.ThrowCoupleMotes(buildingPos, myMap, spotKind); building.Destroy(); } }