private void ResolveNextBlast() { this.timeSinceLastExplosion += Time.deltaTime; if (this.timeSinceLastExplosion > this.timeBetweenExplosions) { Vector3 blastOrigin = this.AmbushPositions.Pop(); AOEBlastDef blastDef = this.AmbushBlasts.Pop(); Mod.Log.Info?.Write($"Spawning blast at position: {blastOrigin} that does {blastDef.Damage} damage, {blastDef.Heat} heat, and {blastDef.Stability} stability."); // Publish the floatie first string floatieText = new Text(Mod.Config.LocalizedText[blastDef.FloatieTextKey]).ToString(); ModState.Combat.MessageCenter.PublishMessage( new FloatieMessage(null, null, floatieText, 16.0f, FloatieMessage.MessageNature.CriticalHit, blastOrigin.x, blastOrigin.y, blastOrigin.z) ); Mod.Log.Debug?.Write($"Sent floatie with text: '{floatieText}'"); // Now do the CAC explosion ExplosionAPIHelper.AoEExplode( Mod.Config.ExplosionAmbush.VFX, Vector3.one * this.explosionVFXScale, this.explosionVFXDuration, Mod.Config.ExplosionAmbush.SFX, blastOrigin, blastDef.Radius, blastDef.Damage, blastDef.Heat, blastDef.Stability, new List <EffectData>(), false, blastDef.FireRadius, blastDef.FireStrength, blastDef.FireChance, blastDef.FireDurationNoForest, string.Empty, Vector3.zero, string.Empty, 0, 0); Mod.Log.Debug?.Write($"Asked CAC for AoE explosion"); this.timeSinceLastExplosion = 0f; } }
private static List <AOEBlastDef> RandomizeBlastDefs(int count) { // Shuffle the weaponDefs over and over again, and add the weapon to the list. List <AOEBlastDef> randomizedBlasts = new List <AOEBlastDef>(); List <AOEBlastDef> shuffledAOEDefs = new List <AOEBlastDef>(); shuffledAOEDefs.AddRange(ModState.ExplosionAmbushDefForContract.SpawnPool); Mod.Log.Debug?.Write($"Shuffling AOEBlasts for explosive ambush"); for (int i = 0; i < count; i++) { shuffledAOEDefs.Shuffle(); AOEBlastDef blastDef = shuffledAOEDefs[0]; Mod.Log.Debug?.Write($" [{i}] = blastDef.label: {blastDef.FloatieTextKey}"); randomizedBlasts.Add(blastDef); } return(randomizedBlasts); }