public override void PawnDied(Corpse corpse) { Color color = new Color(); if (corpse.InnerPawn.Faction == Faction.OfPlayer) { color = new Color(1, 1, 1); // White Smoke } else { color = new Color(0, 0, 0); // Black Smoke if (Rand.Chance(corpse.InnerPawn.RaceProps.AnyPawnKind.combatPower / 100000)) { ThingWithComps createdWeapon = (ThingWithComps)ThingMaker.MakeThing(RWBYDefOf.RWBY_Grimm_Glove); createdWeapon.TryGetComp <CompQuality>().SetQuality((QualityCategory)Rand.RangeInclusive(0, 6), ArtGenerationContext.Colony); GenSpawn.Spawn(createdWeapon, corpse.Position, corpse.Map); } } for (int i = 0; i < 5; i++) { MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.Mote_Smoke, null); moteThrown.Scale = Rand.Range(2.5f, 4.5f); moteThrown.rotationRate = Rand.Range(-30f, 30f); moteThrown.exactPosition = corpse.Position.ToVector3(); moteThrown.instanceColor = color; moteThrown.SetVelocity((float)Rand.Range(0, 360), 0.2f); GenSpawn.Spawn(moteThrown, corpse.Position, corpse.Map, WipeMode.Vanish); } corpse.Destroy(); }
public static void MakeBreath(Pawn pawn) { if (Find.TickManager.TicksGame % 150 == 0) { Map map = pawn.Map; Watcher watcher = map.GetComponent <Watcher>(); bool isCold = watcher.checkIfCold(pawn.Position); if (isCold) { IntVec3 head = pawn.Position; head.z += 1; if (!head.ShouldSpawnMotesAt(map) || map.moteCounter.SaturatedLowPriority) { return; } MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDef.Named("TKKN_Mote_ColdBreath"), null); moteThrown.airTimeLeft = 99999f; moteThrown.Scale = Rand.Range(.5f, 1.5f); moteThrown.rotationRate = Rand.Range(-30f, 30f); moteThrown.exactPosition = head.ToVector3(); moteThrown.SetVelocity((float)Rand.Range(20, 30), Rand.Range(0.5f, 0.7f)); GenSpawn.Spawn(moteThrown, head, map); } } }
/// <summary> /// The for arrows ballanced mote thrower /// Original: MoteThrower.ThrowHorseshoe /// </summary> public static void ShootArrow(Pawn thrower, IntVec3 targetCell) { if (!thrower.Position.ShouldSpawnMotesAt(thrower.Map) || thrower.Map.moteCounter.Saturated) { return; } float speed = Rand.Range(4.0f, 6.5f) * 1.8f; Vector3 vector = targetCell.ToVector3Shifted() + Vector3Utility.RandomHorizontalOffset((1f - (float)thrower.skills.GetSkill(SkillDefOf.Shooting).Level / 20f) * 1.8f); vector.y = thrower.DrawPos.y; MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("Mote_ArcheryArrow"), null); moteThrown.Scale = 1f; moteThrown.rotationRate = 0f; moteThrown.exactPosition = thrower.DrawPos; moteThrown.exactRotation = (vector - moteThrown.exactPosition).AngleFlat(); // this corrects the angle of the arrow moteThrown.SetVelocity((vector - moteThrown.exactPosition).AngleFlat(), speed); moteThrown.airTimeLeft = ((moteThrown.exactPosition - vector).MagnitudeHorizontal() / speed); if (moteThrown.airTimeLeft > 1f) // reduce the airtime randomly to let the arrows be too short from time to time { moteThrown.airTimeLeft -= Rand.Value; } GenSpawn.Spawn(moteThrown, thrower.Position, thrower.Map); }
// Token: 0x060026BE RID: 9918 RVA: 0x00126330 File Offset: 0x00124730 public static void ThrowFireGlow(IntVec3 c, Map map, float size) { Vector3 vector = c.ToVector3Shifted(); if (!vector.ShouldSpawnMotesAt(map) || map.moteCounter.SaturatedLowPriority) { return; } Rand.PushState(); vector += size * new Vector3(Rand.Value - 0.5f, 0f, Rand.Value - 0.5f); Rand.PopState(); if (!vector.InBounds(map)) { return; } MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(AdeptusThingDefOf.OG_Mote_WarpFireGlow, null); Rand.PushState(); moteThrown.Scale = Rand.Range(4f, 6f) * size; moteThrown.rotationRate = Rand.Range(-3f, 3f); moteThrown.exactPosition = vector; moteThrown.SetVelocity((float)Rand.Range(0, 360), 0.12f); Rand.PopState(); GenSpawn.Spawn(moteThrown, vector.ToIntVec3(), map, WipeMode.Vanish); }
public static Mote ThrowNoRobotSign(Vector3 loc, Map map, float scale) { // Note: For code comparism look at RimWorld.MoteMaker.ThrowMetaIcon(..) if (!loc.ShouldSpawnMotesAt(map) || map.moteCounter.Saturated) { return(null); } ThingDef moteDef = DefDatabase <ThingDef> .GetNamedSilentFail("Mote_NoRobotSign"); if (moteDef == null) { return(null); } MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(moteDef); moteThrown.Scale = scale; moteThrown.rotationRate = (float)Rand.Range(-1, 1); moteThrown.exactPosition = loc; moteThrown.exactPosition += new Vector3(0.35f, 0f, 0.35f); moteThrown.exactPosition += new Vector3(Rand.Value, 0f, Rand.Value) * 0.1f; //moteThrown.SetVelocity((float)Rand.Range(0, 360), Rand.Range(0.35f, 0.55f)); moteThrown.SetVelocity(Rand.Range(30f, 60f), Rand.Range(0.15f, 0.35f)); GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map); return(moteThrown); }
// Process the dart public static void ThrowDart(Pawn thrower, IntVec3 target) { // If the pawn can't spawn motes, do nothing if (!thrower.Position.ShouldSpawnMotesAt(thrower.Map) || thrower.Map.moteCounter.SaturatedLowPriority) { return; } Vector3 preciseTarget = target.ToVector3Shifted(); // Dart color based on player ThingDef dart = AjoDefOf.AJO_Mote_GreenDart; if (target.x == thrower.Position.x - 1 || target.z == thrower.Position.z - 1) { dart = AjoDefOf.AJO_Mote_RedDart; } else if (target.x == thrower.Position.x + 1 || target.z == thrower.Position.z + 1) { dart = AjoDefOf.AJO_Mote_BlueDart; } // Transforms for the dart MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(dart, null); moteThrown.Scale = 1f; moteThrown.rotationRate = 0f; moteThrown.exactPosition = thrower.DrawPos; moteThrown.exactRotation = (preciseTarget - moteThrown.exactPosition).AngleFlat(); moteThrown.SetVelocity((preciseTarget - moteThrown.exactPosition).AngleFlat(), dartSpeed); moteThrown.MoveAngle = (preciseTarget - moteThrown.exactPosition).AngleFlat(); moteThrown.airTimeLeft = (moteThrown.exactPosition - preciseTarget).MagnitudeHorizontal() / dartSpeed; // Throw the dart lol GenSpawn.Spawn(moteThrown, thrower.Position, thrower.Map); }
public override void Tick() { if (launcher is Pawn launcherPawn && launcherPawn != null) { if (launcherPawn.Downed || launcherPawn.Dead) { launcherPawn.health.hediffSet.hediffs.RemoveAll(h => h.def == RWBYDefOf.RWBY_RubyDashForm); this.Destroy(); return; } Find.Selector.Deselect(launcher); Hediff dashHediff = new Hediff(); dashHediff = HediffMaker.MakeHediff(RWBYDefOf.RWBY_RubyDashForm, launcherPawn); launcherPawn.health.AddHediff(dashHediff); launcherPawn.Position = Position; launcherPawn.Notify_Teleported(true, false); } MoteMaker.ThrowDustPuffThick(Position.ToVector3(), Map, 2, Def.color); if (Find.TickManager.TicksGame % 2 == 0) { if (!Position.ShouldSpawnMotesAt(Map)) { return; } MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(RWBYDefOf.RWBY_Rose_Petal, null); moteThrown.Scale = 1.9f; moteThrown.rotationRate = 0f; moteThrown.exactPosition = Position.ToVector3(); moteThrown.SetVelocity((float)Rand.Range(0, 360), 0.2f); GenSpawn.Spawn(moteThrown, Position, Map, WipeMode.Vanish); } base.Tick(); }
public static void ThrowSmoke(Vector3 loc, float size, Map map, ThingDef def = null, Color?color = null, float?exactRotation = null) { if (!GenView.ShouldSpawnMotesAt(loc, map)) { return; } Rand.PushState(); MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(def ?? ThingDefOf.Mote_Smoke, null); moteThrown.Scale = Rand.Range(1.5f, 2.5f) * size; moteThrown.rotationRate = Rand.Range(-30f, 30f); moteThrown.exactPosition = loc; moteThrown.SetVelocity((float)Rand.Range(30, 40), Rand.Range(0.5f, 0.7f)); if (color.HasValue) { moteThrown.instanceColor = color.Value; // moteThrown.instanceColor = new Color(0.368f, 0f, 1f); } if (exactRotation.HasValue) { moteThrown.exactRotation += exactRotation.Value; } Rand.PopState(); GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish); }
public static Thing TryAnyMoteSpawn(this Vector3 loc, Map map, float rot, float scale, ThingDef moteDef, bool debug = false) { if (loc.ForbiddenMote(map)) { return(null); } //if(Pawn.story.bodyType == BodyTypeDefOf. if (moteDef == null) { if (debug) { Log.Warning("null mote"); } return(null); } Type moteType = moteDef.thingClass; if (moteType == typeof(CustomTransformation_Mote)) { CustomTransformation_Mote castedMote = (CustomTransformation_Mote)ThingMaker.MakeThing(moteDef); return(castedMote.FinalizeMoteSpawn(loc, map, rot, scale)); } else if (moteType == typeof(MoteThrown)) { MoteThrown castedMote = (MoteThrown)ThingMaker.MakeThing(moteDef); return(castedMote.FinalizeMoteSpawn(loc, map, rot, scale)); } return(null); }
public static Thing TryMoteSpawn(this Vector3 loc, Map map, float rot, float scale, ThingDef moteDef, bool debug = false) { if (loc.ForbiddenMote(map)) { return(null); } //if(Pawn.story.bodyType == BodyTypeDefOf. if (moteDef == null) { if (debug) { Log.Warning("null mote"); } return(null); } MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(moteDef); if (moteThrown == null) { return(null); } moteThrown.Scale = scale; moteThrown.exactRotation = rot; moteThrown.exactPosition = loc; //if (debug) Log.Warning("mote loc:" + loc + " mote.ep:"+ moteThrown.exactPosition); return(GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish)); }
public static Thing MoteSpawner_ThrowObjectAt(this JobDriver_PlayGenericTargetingGame PGTG) { IntVec3 targetCell = PGTG.PetanqueSpotCell; Pawn thrower = PGTG.pawn; ThingDef moteDef = PGTG.MoteDef; SkillDef skillDef = PGTG.SkillDefScaling; if (thrower.Position.ShouldSpawnMotesAt(thrower.Map) && !thrower.Map.moteCounter.Saturated) { float randomSpeed = PGTG.Speed.RandomInRange; Vector3 destinationCell = targetCell.ToVector3Shifted() + Vector3Utility.RandomHorizontalOffset((1f - (float)thrower.skills.GetSkill(skillDef).Level / 20f) * 1.8f); destinationCell.y = thrower.DrawPos.y; MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(moteDef); moteThrown.Scale = 1f; moteThrown.rotationRate = PGTG.Rotation.RandomInRange; moteThrown.exactPosition = thrower.DrawPos; moteThrown.SetVelocity((destinationCell - moteThrown.exactPosition).AngleFlat(), randomSpeed); moteThrown.airTimeLeft = Mathf.RoundToInt((moteThrown.exactPosition - destinationCell).MagnitudeHorizontal() / randomSpeed); return(GenSpawn.Spawn(moteThrown, thrower.Position, thrower.Map)); } return(null); }
public void ThrowMote(Vector3 loc, Map map, float size) { if (!loc.ShouldSpawnMotesAt(map)) { return; } MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(Props.moteDef, null); moteThrown.Scale = size; if (Props.rotationRate != null) { moteThrown.rotationRate = Props.rotationRate.RandomInRange; } moteThrown.exactPosition = loc; if (Props.velocityAngle != null && Props.velocitySpeed != null) { moteThrown.SetVelocity(Props.velocityAngle.RandomInRange, Props.velocitySpeed.RandomInRange); } if (Props.instanceColor != null) { moteThrown.instanceColor = Props.instanceColor; } GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish); }
public override void Spawn(Map map, Vector3 origin, float initialAngle) { if (map == null) { return; } for (int i = 0; i < moteCount; i++) { MoteThrown moteThrown = ThingMaker.MakeThing(mote, null) as MoteThrown; if (moteThrown == null) { return; } moteThrown.thingIDNumber = -1 - i; float angle = initialAngle + Rand.Range(-arc / 2, arc / 2); Vector3 dir = new Vector3(0f, 0f, 1f).RotatedBy(angle); float magnitude = Rand.Range(0f, 1f); float actualScale = scale.LerpThroughRange(magnitude); moteThrown.exactPosition = origin + dir * radius.LerpThroughRange(magnitude); moteThrown.exactRotation = angle; moteThrown.exactScale = new Vector3(actualScale, actualScale, actualScale); moteThrown.SetVelocity(angle, magnitude * speed); moteThrown.rotationRate = rotationRate.RandomInRange; GenSpawn.Spawn(moteThrown, origin.ToIntVec3(), map, WipeMode.Vanish); moteThrown.spawnTick -= (int)(magnitude * 0.75f * (mote.mote.fadeOutTime * 60)); } }
public static MoteThrown NewMote(ThingDef def) { MoteThrown ret = ThingMaker.MakeThing(def, null) as MoteThrown; ret.Scale = 1.5f; ret.rotationRate = (float)Rand.RangeInclusive(-30, 30); return(ret); }
public static Thing FinalizeMoteSpawn(this MoteThrown mote, Vector3 loc, Map map, float rot, float scale) { mote.Scale = scale; mote.exactRotation = rot; mote.exactPosition = loc; return(GenSpawn.Spawn(mote, loc.ToIntVec3(), map, WipeMode.Vanish)); }
private static MoteThrown NewBaseAirPuff() { MoteThrown obj = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.Mote_AirPuff); obj.Scale = 1.5f; obj.rotationRate = Rand.RangeInclusive(-240, 240); return(obj); }
private static MoteThrown NewBaseAirPuff(ThingDef def = null, float size = 1.5f, int rotationRate = 240) { MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(def ?? ThingDefOf.Mote_AirPuff, null); moteThrown.Scale = size; moteThrown.rotationRate = (float)Rand.RangeInclusive(-rotationRate, rotationRate); return(moteThrown); }
private static MoteThrown NewBaseAirPuff() { MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.Mote_AirPuff, null); moteThrown.Scale = 1.5f; moteThrown.rotationRate = (float)Rand.RangeInclusive(-240, 240); return(moteThrown); }
// Make basic setup of level up motes. MoteThrown MakeMote(ThingDef def, Pawn pawn) { MoteThrown mote = (MoteThrown)ThingMaker.MakeThing(def); mote.Attach(new TargetInfo(pawn)); mote.Scale = 1.5f; mote.exactPosition = pawn.Drawer.DrawPos; return(mote); }
public static void ThrowAirPuffUp(Vector3 loc, Map map) { if (loc.ToIntVec3().ShouldSpawnMotesAt(map) && !map.moteCounter.SaturatedLowPriority) { MoteThrown moteThrown = 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); } }
public static void PlaceFootprint(Vector3 loc, Map map, float rot) { if (loc.ShouldSpawnMotesAt(map) && !map.moteCounter.SaturatedLowPriority) { MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.Mote_Footprint, null); moteThrown.Scale = 0.5f; moteThrown.exactRotation = rot; moteThrown.exactPosition = loc; GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map); } }
public static void ThrowLightningGlow(Vector3 loc, Map map, float size) { if (loc.ShouldSpawnMotesAt(map) && !map.moteCounter.SaturatedLowPriority) { MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.Mote_LightningGlow, null); moteThrown.Scale = Rand.Range(4f, 6f) * size; moteThrown.rotationRate = Rand.Range(-3f, 3f); moteThrown.exactPosition = loc + size * new Vector3((float)(Rand.Value - 0.5), 0f, (float)(Rand.Value - 0.5)); moteThrown.SetVelocity((float)Rand.Range(0, 360), 1.2f); GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map); } }
public static void ThrowSmoke(Vector3 loc, Map map, float size) { if (loc.ShouldSpawnMotesAt(map) && !map.moteCounter.SaturatedLowPriority) { MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.Mote_Smoke, null); moteThrown.Scale = Rand.Range(1.5f, 2.5f) * size; moteThrown.rotationRate = Rand.Range(-30f, 30f); moteThrown.exactPosition = loc; moteThrown.SetVelocity((float)Rand.Range(30, 40), Rand.Range(0.5f, 0.7f)); GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map); } }
public static void ThrowDustPuff(Vector3 loc, Map map, float scale) { if (loc.ShouldSpawnMotesAt(map) && !map.moteCounter.SaturatedLowPriority) { MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.Mote_DustPuff, null); moteThrown.Scale = (float)(1.8999999761581421 * scale); moteThrown.rotationRate = (float)Rand.Range(-60, 60); moteThrown.exactPosition = loc; moteThrown.SetVelocity((float)Rand.Range(0, 360), Rand.Range(0.6f, 0.75f)); GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map); } }
public static void ThrowMetaPuff(Vector3 loc, Map map) { if (loc.ShouldSpawnMotesAt(map)) { MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.Mote_MetaPuff, null); moteThrown.Scale = 1.9f; moteThrown.rotationRate = (float)Rand.Range(-60, 60); moteThrown.exactPosition = loc; moteThrown.SetVelocity((float)Rand.Range(0, 360), Rand.Range(0.6f, 0.78f)); GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map); } }
public static void ThrowSmokeTrail(Vector3 loc, float size, Map map, string defName) { if (GenView.ShouldSpawnMotesAt(loc, map) && !map.moteCounter.Saturated) { MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDef.Named(defName), null); moteThrown.Scale = Rand.Range(2f, 3f) * size; moteThrown.exactPosition = loc; moteThrown.rotationRate = Rand.Range(-0.5f, 0.5f); moteThrown.SetVelocity((float)Rand.Range(30, 40), Rand.Range(0.008f, 0.012f)); GenSpawn.Spawn(moteThrown, IntVec3Utility.ToIntVec3(loc), map, WipeMode.Vanish); } }
public static void ThrowCustomSmoke(ThingDef moteDef, Vector3 loc, Map map, float size) { if (loc.ShouldSpawnMotesAt(map) && !map.moteCounter.SaturatedLowPriority) { MoteThrown obj = (MoteThrown)ThingMaker.MakeThing(moteDef); obj.Scale = Rand.Range(1.5f, 2.5f) * size; obj.rotationRate = Rand.Range(-30f, 30f); obj.exactPosition = loc; obj.SetVelocity(Rand.Range(30, 40), Rand.Range(0.5f, 0.7f)); GenSpawn.Spawn(obj, loc.ToIntVec3(), map); } }
public static void ThrowMetaPuff(Vector3 loc, Map map) { if (loc.ShouldSpawnMotesAt(map)) { MoteThrown obj = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.Mote_MetaPuff); obj.Scale = 1.9f; obj.rotationRate = Rand.Range(-60, 60); obj.exactPosition = loc; obj.SetVelocity(Rand.Range(0, 360), Rand.Range(0.6f, 0.78f)); GenSpawn.Spawn(obj, loc.ToIntVec3(), map); } }
public static void ThrowExplosionInteriorMote(Vector3 loc, Map map, ThingDef moteDef) { if (loc.ShouldSpawnMotesAt(map) && !map.moteCounter.SaturatedLowPriority) { MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(moteDef, null); moteThrown.Scale = Rand.Range(3f, 4.5f); moteThrown.rotationRate = Rand.Range(-30f, 30f); moteThrown.exactPosition = loc; moteThrown.SetVelocity((float)Rand.Range(0, 360), Rand.Range(0.48f, 0.72f)); GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map); } }
public static void ThrowDustPuff(Vector3 loc, Map map, float scale) { if (loc.ShouldSpawnMotesAt(map) && !map.moteCounter.SaturatedLowPriority) { MoteThrown obj = (MoteThrown)ThingMaker.MakeThing(ThingDefOf.Mote_DustPuff); obj.Scale = 1.9f * scale; obj.rotationRate = Rand.Range(-60, 60); obj.exactPosition = loc; obj.SetVelocity(Rand.Range(0, 360), Rand.Range(0.6f, 0.75f)); GenSpawn.Spawn(obj, loc.ToIntVec3(), map); } }