This commit is contained in:
EvilFactory
2025-04-29 07:27:36 -03:00
26 changed files with 198 additions and 76 deletions
@@ -1047,6 +1047,8 @@ namespace Barotrauma
showCaseClosureQueue.Enqueue(identifier);
}
}
NetLobbyScreen.UpdateJobVariantSelectionIfNeeded();
}
private static bool IsOwnCharacter(CharacterInfo? info)
@@ -879,6 +879,8 @@ namespace Barotrauma
{
if (requireCorrectRoundId && roundId != campaign.RoundID)
{
//set update flag anyway so we can tell the server we received this data and it won't need to keep resending it
campaign.SetLastUpdateIdForFlag(flag, id);
DebugConsole.Log($"Received campaing update for a different round (client: {campaign.RoundID}, server: {roundId}), ignoring...");
return false;
}
@@ -1,4 +1,4 @@
using Barotrauma.Lights;
using Barotrauma.Lights;
using Barotrauma.Particles;
using Microsoft.Xna.Framework;
using System;
@@ -13,21 +13,14 @@ namespace Barotrauma
partial void UpdateProjSpecific(float growModifier, float deltaTime)
{
if (this is DummyFireSource)
{
EmitParticles(size, WorldPosition, deltaTime, hull, growModifier, null);
}
else
{
EmitParticles(size, WorldPosition, deltaTime, hull, growModifier, OnChangeHull);
}
EmitParticles(size, WorldPosition, deltaTime, hull, growModifier);
lightSource.Color = new Color(1.0f, 0.45f, 0.3f) * Rand.Range(0.8f, 1.0f);
if (Math.Abs((lightSource.Range * 0.2f) - Math.Max(size.X, size.Y)) > 1.0f) { lightSource.Range = Math.Max(size.X, size.Y) * 5.0f; }
if (Vector2.DistanceSquared(lightSource.Position, position) > 5.0f) { lightSource.Position = position + Vector2.UnitY * 30.0f; }
}
public void EmitParticles(Vector2 size, Vector2 worldPosition, float deltaTime, Hull hull, float growModifier, Particle.OnChangeHullHandler onChangeHull = null)
public void EmitParticles(Vector2 size, Vector2 worldPosition, float deltaTime, Hull hull, float growModifier)
{
var particlePrefab = ParticleManager.FindPrefab("flame");
if (particlePrefab == null) { return; }
@@ -54,9 +47,6 @@ namespace Barotrauma
if (particle == null) { continue; }
//make some of the particles create another firesource when they enter another hull
if (Rand.Int(20) == 1) { particle.OnChangeHull = onChangeHull; }
particle.Size *= MathHelper.Clamp(size.X / 60.0f * Math.Max(hull.Oxygen / hull.Volume, 0.4f), 0.5f, 1.0f);
if (Rand.Int(5) == 1)
@@ -394,6 +394,10 @@ namespace Barotrauma
Rectangle fireSourceRect = new Rectangle((int)fs.WorldPosition.X, -(int)fs.WorldPosition.Y, (int)fs.Size.X, (int)fs.Size.Y);
GUI.DrawRectangle(spriteBatch, fireSourceRect, GUIStyle.Red, false, 0, 5);
GUI.DrawRectangle(spriteBatch, new Rectangle(fireSourceRect.X - (int)fs.DamageRange, fireSourceRect.Y, fireSourceRect.Width + (int)fs.DamageRange * 2, fireSourceRect.Height), GUIStyle.Orange, false, 0, 5);
Vector2 topCenter = new Vector2(fireSourceRect.Center.X, fireSourceRect.Y);
GUI.DrawLine(spriteBatch, topCenter, topCenter - Vector2.UnitY * fs.FlameHeight, GUIStyle.Red * 0.7f, width: 5);
//GUI.DrawRectangle(spriteBatch, new Rectangle((int)fs.LastExtinguishPos.X, (int)-fs.LastExtinguishPos.Y, 5,5), Color.Yellow, true);
}
foreach (FireSource fs in FakeFireSources)
@@ -18,7 +18,7 @@ namespace Barotrauma
private GUIButton serverLogReverseButton;
private GUIListBox serverLogBox, serverLogFilterTicks;
private GUIComponent jobVariantTooltip;
private static GUIComponent jobVariantTooltip;
private GUIComponent playStyleIconContainer;
@@ -2876,7 +2876,7 @@ namespace Barotrauma
};
}
private void CreateJobVariantTooltip(JobPrefab jobPrefab, CharacterTeamType team, int variant, bool isPvPMode, GUIComponent parentSlot)
private static void CreateJobVariantTooltip(JobPrefab jobPrefab, CharacterTeamType team, int variant, bool isPvPMode, GUIComponent parentSlot)
{
jobVariantTooltip = new GUIFrame(new RectTransform(new Point((int)(400 * GUI.Scale), (int)(180 * GUI.Scale)), GUI.Canvas, pivot: Pivot.BottomRight),
style: "GUIToolTip")
@@ -4111,20 +4111,28 @@ namespace Barotrauma
JobSelectionFrame.Visible = false;
}
if (GUI.MouseOn?.UserData is JobVariant jobPrefab &&
UpdateJobVariantSelectionIfNeeded();
}
public static void UpdateJobVariantSelectionIfNeeded()
{
if (GUI.MouseOn?.UserData is JobVariant jobPrefab &&
GUI.MouseOn.Style?.Name == "JobVariantButton" &&
GUI.MouseOn.Parent != null)
{
if (jobVariantTooltip?.UserData is not JobVariant prevVisibleVariant ||
prevVisibleVariant.Prefab != jobPrefab.Prefab ||
bool isMultiplayer = GameMain.NetLobbyScreen != null && GameMain.NetworkMember != null;
var teamPreference = isMultiplayer ? GameMain.NetLobbyScreen.TeamPreference : CharacterTeamType.Team1;
var isPvPMode = isMultiplayer ? GameMain.NetLobbyScreen.SelectedMode == GameModePreset.PvP : false;
if (jobVariantTooltip?.UserData is not JobVariant prevVisibleVariant ||
prevVisibleVariant.Prefab != jobPrefab.Prefab ||
prevVisibleVariant.Variant != jobPrefab.Variant)
{
CreateJobVariantTooltip(jobPrefab.Prefab, TeamPreference, jobPrefab.Variant, isPvPMode: SelectedMode == GameModePreset.PvP, GUI.MouseOn.Parent);
CreateJobVariantTooltip(jobPrefab.Prefab, teamPreference, jobPrefab.Variant, isPvPMode, GUI.MouseOn.Parent);
}
}
if (jobVariantTooltip != null)
{
jobVariantTooltip?.AddToGUIUpdateList();
jobVariantTooltip?.AddToGUIUpdateList(order: 1);
Rectangle mouseRect = jobVariantTooltip.MouseRect;
mouseRect.Inflate(60 * GUI.Scale, 60 * GUI.Scale);
if (!mouseRect.Contains(PlayerInput.MousePosition)) { jobVariantTooltip = null; }
@@ -4547,7 +4555,7 @@ namespace Barotrauma
team: TeamPreference,
isPvPMode: SelectedMode == GameModePreset.PvP,
selectedByPlayer: false);
if (images != null && images.Length > 1)
if (images != null && images.Length > 0)
{
jobPrefab.Variant = Math.Min(jobPrefab.Variant, images.Length);
int currVisible = jobPrefab.Variant;
@@ -5055,9 +5063,8 @@ namespace Barotrauma
for (int variantIndex = 0; variantIndex < images.Length; variantIndex++)
{
int selectedVariantIndex = Math.Min(jobPrefab.Variant, images.Length);
images[variantIndex].Visible = images.Length == 1 || selectedVariantIndex == variantIndex;
if (images.Length > 1)
images[variantIndex].Visible = images.Length == 1 || selectedVariantIndex == variantIndex;
if (images.Length > 0)
{
var variantButton = CreateJobVariantButton(jobPrefab, variantIndex, images.Length, slot);
variantButton.OnClicked = (btn, obj) =>