public static void ThrowSprayTrail(Vector3 loc, Map map, float angle, float angleR, string defname = null, float size = 1.5f, int rotationRate = 240, float projectieSpeed = 0, Color?color = null) { ThingDef def = defname.NullOrEmpty() ? null : DefDatabase <ThingDef> .GetNamedSilentFail(defname); MoteThrown moteThrown = TrailThrower.NewBaseAirPuff(def, size, rotationRate); moteThrown.exactPosition = loc; moteThrown.solidTimeOverride = 0; moteThrown.exactPosition += Quaternion.AngleAxis(Rand.Range(-10, 10) + angle, Vector3.up) * Vector3.back * Rand.Range(0, projectieSpeed); //moteThrown.exactPosition += new Vector3(Rand.Range(-0.05f, 0.05f), 0f, Rand.Range(-0.05f, 0.05f)); moteThrown.exactRotation = Rand.Range(0, 360); if (color.HasValue) { moteThrown.instanceColor = color.Value; } moteThrown.SetVelocity((float)Rand.Range(-15, 15) + angle, Rand.Range(1.2f, 1.5f) + (-(projectieSpeed / 2))); GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish); }
public static void ThrowAirPuffUp(Vector3 loc, Map map) { if (map == null) { return; } if (!loc.InBounds(map)) { return; } if (!GenView.ShouldSpawnMotesAt(loc, map)) { return; } MoteThrown moteThrown = TrailThrower.NewBaseAirPuff(); moteThrown.exactPosition = loc; moteThrown.exactPosition += new Vector3(Rand.Range(-0.02f, 0.02f), 0f, Rand.Range(-0.02f, 0.02f)); moteThrown.SetVelocity((float)Rand.Range(-45, 45), Rand.Range(1.2f, 1.5f)); GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish); }