public static void ThrowCoupleMotes(Vector3 loc, Map map, MyDefs.SpotKind spotKind) { int randMotesNum = Rand.Range(3, 7); for (int i = 0; i < randMotesNum; i++) { if (!loc.ShouldSpawnMotesAt(map) || map.moteCounter.SaturatedLowPriority) { return; } ThrowMindMote(loc, map, spotKind); } }
public static ThingDef RandomMote(MyDefs.SpotKind spotKind = MyDefs.SpotKind.flay, bool myDebug = false) { switch ((int)spotKind) { case (int)MyDefs.SpotKind.flay: return(ThingDef.Named(MyGfx.moteFlayPool[(int)Rand.Range(0, MyGfx.moteFlayPool.Length)])); case (int)MyDefs.SpotKind.fondle: return(ThingDef.Named(MyGfx.moteFondlePool[(int)Rand.Range(0, MyGfx.moteFondlePool.Length)])); default: Tools.Warn("RandomMote : Unexpected spotkind", myDebug); return(ThingDef.Named(MyGfx.moteFlayPool[(int)Rand.Range(0, MyGfx.moteFlayPool.Length)])); } }
private void SetSpotKind() { if (HasFlaySpotDefName) { spotKind = MyDefs.SpotKind.flay; } else if (HasFondleSpotDefName) { spotKind = MyDefs.SpotKind.fondle; } else { spotKind = MyDefs.SpotKind.na; Tools.Warn("SetSpotKind - No valid spotKind, defname wont match ", myDebug); } }
/* * public static void ThrowPsycastAreaMote(Vector3 loc, Map map, bool myDebug = false) * { * if (!loc.ShouldSpawnMotesAt(map) || map.moteCounter.SaturatedLowPriority) * return; * * MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(MyDefs.Mote_PsycastArea); * GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map); * } */ public static void ThrowMindMote(Vector3 loc, Map map, MyDefs.SpotKind spotKind, bool myDebug = false) { if (!loc.ShouldSpawnMotesAt(map) || map.moteCounter.SaturatedLowPriority) { return; } MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(RandomMote(spotKind, myDebug)); moteThrown.Scale = Rand.Range(0.5f, 1.2f); moteThrown.rotationRate = Rand.Range(0, 180); moteThrown.exactPosition = loc; moteThrown.SetVelocity(Rand.Range(0f, 360f), Rand.Range(1f, 4f)); GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map); }
public static Thing CreateMindSpot(IntVec3 destinationCell, Map map, MyDefs.SpotKind spotKind) { ThingDef thingDef = null; if (spotKind == MyDefs.SpotKind.flay) { thingDef = MyDefs.MindFlaySpotThingDef; } else if (spotKind == MyDefs.SpotKind.fondle) { thingDef = MyDefs.MindFondleSpotThingDef; } else { Tools.Warn("CreateMindSpot - bad spotkind", true); } Building mindFlaySpot = (Building)ThingMaker.MakeThing(thingDef, null); //lockBlock.SetColor(lockDowner.DrawColor); GenSpawn.Spawn(mindFlaySpot, destinationCell, map, Rot4.North, WipeMode.Vanish); mindFlaySpot.SetFaction(Faction.OfPlayer); GfxEffects.ThrowCoupleMotes(destinationCell.ToVector3(), map, spotKind); foreach (IntVec3 puff in GenAdj.CellsAdjacent8Way(mindFlaySpot)) { if (puff.InBounds(map)) { MoteMaker.ThrowAirPuffUp(puff.ToVector3(), map); } } return(mindFlaySpot); }