Merge branch 'master' into post-scal-assets

This commit is contained in:
DominicKarma committed 2021-09-21 17:01:09 -05:00
commit c12e2bc95f
11 files changed
+101 -42

No files matched your search

+19
View File
@@ -216,6 +216,9 @@ namespace CalamityMod
int type = reader.ReadInt32();
CalamityWorld.bossType = type;
break;
case CalamityModMessageType.EndBossRush:
BossRushEvent.EndEffects();
break;
case CalamityModMessageType.BRHostileProjKillSync:
int countdown3 = reader.ReadInt32();
CalamityWorld.bossRushHostileProjKillCounter = countdown3;
@@ -240,6 +243,17 @@ namespace CalamityMod
CalamityWorld.encounteredOldDuke = reader.ReadBoolean();
break;
//
// Draedon Summoner stuff
//
case CalamityModMessageType.CodebreakerSummonStuff:
CalamityWorld.DraedonSummonCountdown = reader.ReadInt32();
CalamityWorld.DraedonSummonPosition = reader.ReadVector2();
break;
case CalamityModMessageType.ExoMechSelection:
CalamityWorld.DraedonMechToSummon = (ExoMech)reader.ReadInt32();
break;
//
// Death Mode environmental syncs
//
@@ -359,12 +373,17 @@ namespace CalamityMod
UpdateCodebreakerContainedStuff,
UpdateCodebreakerDecryptCountdown,
// Draedon Summoner
CodebreakerSummonStuff,
ExoMechSelection,
// Boss Rush
BossRushStage,
BossRushStartTimer,
BossRushEndTimer,
BossSpawnCountdownSync,
BossTypeSync,
EndBossRush,
BRHostileProjKillSync, // TODO -- Simplify this. Only one packet needs be sent: "kill all hostile projectiles for N frames".
TeleportPlayer, // also used by Astral Arcanum.
+19 -17
View File
@@ -469,8 +469,21 @@ namespace CalamityMod.Events
}
public static void End()
{
if (Main.netMode == NetmodeID.SinglePlayer)
{
EndEffects();
return;
}
var netMessage = CalamityMod.Instance.GetPacket();
netMessage.Write((byte)CalamityModMessageType.EndBossRush);
netMessage.Send();
}
internal static void EndEffects()
{
for (int doom = 0; doom < 200; doom++)
for (int doom = 0; doom < Main.maxNPCs; doom++)
{
NPC n = Main.npc[doom];
if (!n.active)
@@ -480,29 +493,18 @@ namespace CalamityMod.Events
bool shouldDespawn = n.boss || n.type == NPCID.EaterofWorldsHead || n.type == NPCID.EaterofWorldsBody || n.type == NPCID.EaterofWorldsTail;
if (shouldDespawn)
{
n.life = 0;
n.HitEffect();
n.checkDead();
n.active = false;
n.netUpdate = true;
}
}
BossRushActive = false;
BossRushStage = 0;
StartTimer = 0;
EndTimer = 0;
CalamityUtils.KillAllHostileProjectiles();
CalamityNetcode.SyncWorld();
if (Main.netMode != NetmodeID.MultiplayerClient)
{
SyncStartTimer(0);
SyncEndTimer(0);
}
if (Main.netMode == NetmodeID.Server)
{
var netMessage = CalamityMod.Instance.GetPacket();
netMessage.Write((byte)CalamityModMessageType.BossRushStage);
netMessage.Write(BossRushStage);
netMessage.Send();
}
}
#endregion
+3 -2
View File
@@ -314,8 +314,9 @@ namespace CalamityMod.NPCs.ExoMechs
public override void FindFrame(int frameHeight)
{
npc.frame.Width = 102;
int xFrame = npc.frame.X / npc.frame.Width;
int yFrame = npc.frame.Y / npc.frame.Height;
int yFrame = npc.frame.Y / frameHeight;
int frame = xFrame * Main.npcFrameCount[npc.type] + yFrame;
// Prepare to stand up if called for and not already doing so.
@@ -347,7 +348,7 @@ namespace CalamityMod.NPCs.ExoMechs
}
npc.frame.X = frame / Main.npcFrameCount[npc.type] * npc.frame.Width;
npc.frame.Y = frame % Main.npcFrameCount[npc.type] * npc.frame.Height;
npc.frame.Y = frame % Main.npcFrameCount[npc.type] * frameHeight;
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
+2
View File
@@ -74,6 +74,7 @@ namespace CalamityMod.NPCs.Leviathan
writer.Write(frameUsed);
writer.Write(npc.dontTakeDamage);
writer.Write(npc.Calamity().newAI[0]);
writer.Write(HasBegunSummoningLeviathan);
}
public override void ReceiveExtraAI(BinaryReader reader)
@@ -86,6 +87,7 @@ namespace CalamityMod.NPCs.Leviathan
frameUsed = reader.ReadInt32();
npc.dontTakeDamage = reader.ReadBoolean();
npc.Calamity().newAI[0] = reader.ReadSingle();
HasBegunSummoningLeviathan = reader.ReadBoolean();
}
public override void AI()
+2 -1
View File
@@ -132,7 +132,8 @@ namespace CalamityMod.NPCs.TownNPCs
dialogue.Add("Are you sure you're 21? ...alright, fine, but don't tell anyone I sold you this.");
}
dialogue.Add("Drink something that turns you into a magical flying unicorn so you can be super gay.");
dialogue.Add("I HATE WALMART!");
dialogue.Add("Drink something that turns you into a magical flying unicorn so you can be super gay.");
dialogue.Add("Did anyone ever tell you that large assets cause back pain? Well, they were right.");
if (BirthdayParty.PartyIsUp)
+29 -13
View File
@@ -12,7 +12,6 @@ namespace CalamityMod.Projectiles.Boss
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public ref float Time => ref projectile.ai[0];
public const int PulseTime = 45;
public const int TotalRitualTime = 270;
public override void SetStaticDefaults() => DisplayName.SetDefault("Calamitous Ritual Drama");
@@ -21,18 +20,32 @@ namespace CalamityMod.Projectiles.Boss
projectile.width = projectile.height = 2;
projectile.tileCollide = false;
projectile.ignoreWater = true;
projectile.timeLeft = TotalRitualTime;
projectile.timeLeft = TotalRitualTime + 420;
}
public override void AI()
{
SCalSky.OverridingIntensity = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true);
Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true);
Main.LocalPlayer.Calamity().GeneralScreenShakePower *= Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 4f;
public override void AI()
{
// If needed, these effects may continue after the ritual timer, to ensure that there are no awkward
// background changes between the time it takes for SCal to appear after this projectile is gone.
// If SCal is already present, this does not happen.
if (!NPC.AnyNPCs(ModContent.NPCType<SupremeCalamitas>()))
{
SCalSky.OverridingIntensity = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true);
Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(90f, TotalRitualTime - 25f, Time, true);
Main.LocalPlayer.Calamity().GeneralScreenShakePower *= Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 4f;
}
// Summon SCal right before the ritual effect ends.
// The projectile lingers a little longer, however, to ensure that desync delays in MP do not interfere with the background transition.
if (Time == TotalRitualTime - 1f)
SummonSCal();
if (Time >= TotalRitualTime)
return;
int fireReleaseRate = Time > 150f ? 2 : 1;
for (int i = 0; i < fireReleaseRate; i++)
{
{
if (Main.rand.NextBool(4))
{
Dust brimstone = Dust.NewDustPerfect(projectile.Center + new Vector2(Main.rand.NextFloat(-20f, 24f), Main.rand.NextFloat(10f, 18f)), 267);
@@ -45,19 +58,22 @@ namespace CalamityMod.Projectiles.Boss
}
Time++;
}
}
public override void Kill(int timeLeft)
{
public void SummonSCal()
{
// Summon SCal serverside.
// All the other acoustic and visual effects can happen client-side.
if (Main.netMode != NetmodeID.MultiplayerClient)
CalamityUtils.SpawnBossBetter(projectile.Center - new Vector2(60f), ModContent.NPCType<SupremeCalamitas>());
// Make a laugh sound and create a burst of brimstone dust.
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), projectile.Center);
// Make a sudden screen shake.
Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 16f;
// Generate a dust explosion
// Generate a dust explosion at the ritual's position.
float burstDirectionVariance = 3;
float burstSpeed = 14f;
for (int j = 0; j < 16; j++)
@@ -74,5 +90,5 @@ namespace CalamityMod.Projectiles.Boss
burstSpeed += 1.8f;
}
}
}
}
}
+3
View File
@@ -184,6 +184,7 @@ namespace CalamityMod.TileEntities
packet.Write((byte)CalamityModMessageType.UpdateCodebreakerConstituents);
packet.Write(ID);
packet.Write(containmentFlagWrapper);
packet.Send();
}
public static void ReadConstituentsUpdateSync(Mod mod, BinaryReader reader)
@@ -228,6 +229,7 @@ namespace CalamityMod.TileEntities
packet.Write(InputtedCellCount);
packet.Write(InitialCellCountBeforeDecrypting);
packet.Write(HeldSchematicID);
packet.Send();
}
public static void ReadContainmentSync(Mod mod, BinaryReader reader)
@@ -265,6 +267,7 @@ namespace CalamityMod.TileEntities
packet.Write((byte)CalamityModMessageType.UpdateCodebreakerDecryptCountdown);
packet.Write(ID);
packet.Write(DecryptionCountdown);
packet.Send();
}
public static void ReadDecryptCountdownSync(Mod mod, BinaryReader reader)
+5 -1
View File
@@ -434,7 +434,11 @@ namespace CalamityMod.UI
CalamityWorld.DraedonSummonCountdown = CalamityWorld.DraedonSummonCountdownMax;
CalamityWorld.DraedonSummonPosition = codebreakerTileEntity.Center + new Vector2(-8f, -100f);
CalamityNetcode.SyncWorld();
var netMessage = CalamityMod.Instance.GetPacket();
netMessage.Write((byte)CalamityModMessageType.CodebreakerSummonStuff);
netMessage.Write(CalamityWorld.DraedonSummonCountdown);
netMessage.WriteVector2(CalamityWorld.DraedonSummonPosition);
netMessage.Send();
}
}
+5 -1
View File
@@ -76,7 +76,11 @@ namespace CalamityMod.UI
if (Main.mouseLeft && Main.mouseLeftRelease)
{
CalamityWorld.DraedonMechToSummon = exoMech;
CalamityNetcode.SyncWorld();
var netMessage = CalamityMod.Instance.GetPacket();
netMessage.Write((byte)CalamityModMessageType.ExoMechSelection);
netMessage.Write((int)CalamityWorld.DraedonMechToSummon);
netMessage.Send();
}
Main.blockMouse = Main.LocalPlayer.mouseInterface = true;
}
+10
View File
@@ -892,6 +892,11 @@ namespace CalamityMod.World
writer.Write(DraedonSummonCountdown);
writer.Write((int)DraedonMechToSummon);
writer.WriteVector2(DraedonSummonPosition);
writer.WriteVector2(SunkenSeaLabCenter);
writer.WriteVector2(PlanetoidLabCenter);
writer.WriteVector2(JungleLabCenter);
writer.WriteVector2(HellLabCenter);
writer.WriteVector2(IceLabCenter);
}
#endregion
@@ -1014,6 +1019,11 @@ namespace CalamityMod.World
DraedonSummonCountdown = reader.ReadInt32();
DraedonMechToSummon = (ExoMech)reader.ReadInt32();
DraedonSummonPosition = reader.ReadVector2();
SunkenSeaLabCenter = reader.ReadVector2();
PlanetoidLabCenter = reader.ReadVector2();
JungleLabCenter = reader.ReadVector2();
HellLabCenter = reader.ReadVector2();
IceLabCenter = reader.ReadVector2();
}
#endregion
+4 -7
View File
@@ -39,13 +39,10 @@ namespace CalamityMod.World
public static void PerformWorldUpdates()
{
// Reset the exo mech to summon if Draedon is absent.
if (Main.netMode != NetmodeID.MultiplayerClient && DraedonMechToSummon != ExoMech.None && CalamityGlobalNPC.draedon == -1)
{
if (DraedonMechToSummon != ExoMech.None && CalamityGlobalNPC.draedon == -1)
DraedonMechToSummon = ExoMech.None;
CalamityNetcode.SyncWorld();
}
if (DraedonSummonCountdown > 0)
if (Main.netMode != NetmodeID.MultiplayerClient && DraedonSummonCountdown > 0)
{
DraedonSummonCountdown--;
HandleDraedonSummoning();
@@ -131,11 +128,11 @@ namespace CalamityMod.World
public static void HandleDraedonSummoning()
{
// Fire a giant laser into the sky.
if (Main.netMode != NetmodeID.MultiplayerClient && DraedonSummonCountdown == DraedonSummonCountdownMax - 45)
if (DraedonSummonCountdown == DraedonSummonCountdownMax - 45)
Projectile.NewProjectile(DraedonSummonPosition + Vector2.UnitY * 80f, Vector2.Zero, ModContent.ProjectileType<DraedonSummonLaser>(), 70, 0f);
if (DraedonSummonCountdown == 0)
NPC.NewNPC((int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, ModContent.NPCType<Draedon>(), 0, 0f, (int)DraedonMechToSummon);
NPC.NewNPC((int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, ModContent.NPCType<Draedon>());
}
#endregion Handle Draedon Summoning