Unstable 0.1300.0.4

This commit is contained in:
Markus Isberg
2021-03-30 15:51:49 +03:00
parent 58c50a235d
commit 862221635c
108 changed files with 907 additions and 378 deletions
@@ -173,7 +173,15 @@ namespace Barotrauma
string savePath = SaveUtil.CreateSavePath(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer, saveNameBox.Text);
bool hasRequiredContentPackages = selectedSub.RequiredContentPackagesInstalled;
CampaignSettings settings = new CampaignSettings { RadiationEnabled = EnableRadiationToggle?.Selected ?? GameMain.NetLobbyScreen.IsRadiationEnabled() };
CampaignSettings settings = new CampaignSettings();
if (isMultiplayer)
{
settings.RadiationEnabled = GameMain.NetLobbyScreen.IsRadiationEnabled();
}
else
{
settings.RadiationEnabled = EnableRadiationToggle?.Selected ?? false;
}
if (selectedSub.HasTag(SubmarineTag.Shuttle) || !hasRequiredContentPackages)
{
@@ -257,11 +265,14 @@ namespace Barotrauma
if (!isMultiplayer)
{
EnableRadiationToggle = new GUITickBox(new RectTransform(new Vector2(0.3f, 1f), buttonContainer.RectTransform), TextManager.Get("CampaignOption.EnableRadiation"), font: GUI.Style.Font)
if (MapGenerationParams.Instance.RadiationParams != null)
{
Selected = true,
ToolTip = TextManager.Get("campaignoption.enableradiation.tooltip")
};
EnableRadiationToggle = new GUITickBox(new RectTransform(new Vector2(0.3f, 1f), buttonContainer.RectTransform), TextManager.Get("CampaignOption.EnableRadiation"), font: GUI.Style.Font)
{
Selected = true,
ToolTip = TextManager.Get("campaignoption.enableradiation.tooltip")
};
}
var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(1.0f, 0.8f), rightColumn.RectTransform, Anchor.TopRight) { AbsoluteOffset = new Point(5) }, style: "GUINotificationButton")
{
@@ -306,7 +306,7 @@ namespace Barotrauma
{
var map = GameMain.GameSession?.Map;
if (map == null) { return; }
if (selectedLocation != null && selectedLocation == map.CurrentDisplayLocation)
if (selectedLocation != null && selectedLocation == GameMain.GameSession.Campaign.GetCurrentDisplayLocation())
{
map.SelectLocation(-1);
}
@@ -438,7 +438,7 @@ namespace Barotrauma
};
SelectedLevel = connection?.LevelData;
Location currentDisplayLocation = Campaign.CurrentDisplayLocation;
Location currentDisplayLocation = Campaign.GetCurrentDisplayLocation();
if (connection != null && connection.Locations.Contains(currentDisplayLocation))
{
List<Mission> availableMissions = currentDisplayLocation.GetMissionsInConnection(connection).ToList();
@@ -711,7 +711,7 @@ namespace Barotrauma.CharacterEditor
}
}
// Camera
Cam.MoveCamera((float)deltaTime, allowMove: false);
Cam.MoveCamera((float)deltaTime, allowMove: false, allowZoom: GUI.MouseOn == null);
Vector2 targetPos = character.WorldPosition;
if (PlayerInput.MidButtonHeld())
{
@@ -953,7 +953,7 @@ namespace Barotrauma
CreateGUI();
}
Cam.MoveCamera((float) deltaTime, true, true);
Cam.MoveCamera((float) deltaTime, allowMove: true, allowZoom: GUI.MouseOn == null);
Vector2 mousePos = Cam.ScreenToWorld(PlayerInput.MousePosition);
mousePos.Y = -mousePos.Y;
@@ -843,7 +843,7 @@ namespace Barotrauma
pointerLightSource.Position = cam.ScreenToWorld(PlayerInput.MousePosition);
pointerLightSource.Enabled = cursorLightEnabled.Selected;
pointerLightSource.IsBackground = true;
cam.MoveCamera((float)deltaTime);
cam.MoveCamera((float)deltaTime, allowZoom: GUI.MouseOn == null);
cam.UpdateTransform();
Level.Loaded?.Update((float)deltaTime, cam);
@@ -1173,7 +1173,10 @@ namespace Barotrauma
(int)(campaignSetupUI.StartButton.TextBlock.TextSize.X * 1.5f),
campaignSetupUI.StartButton.RectTransform.MinSize.Y);
startButtonContainer.RectTransform.MinSize = new Point(0, campaignSetupUI.StartButton.RectTransform.MinSize.Y);
campaignSetupUI.EnableRadiationToggle.RectTransform.Parent = startButtonContainer.RectTransform;
if (campaignSetupUI.EnableRadiationToggle != null)
{
campaignSetupUI.EnableRadiationToggle.RectTransform.Parent = startButtonContainer.RectTransform;
}
campaignSetupUI.InitialMoneyText.RectTransform.Parent = startButtonContainer.RectTransform;
}
@@ -485,6 +485,7 @@ namespace Barotrauma
if (socialHolder != null) { socialHolder.Visible = false; }
if (!(serverLogHolder?.Visible ?? true))
{
if (GameMain.Client?.ServerSettings?.ServerLog == null) { return false; }
serverLogHolder.Visible = true;
GameMain.Client.ServerSettings.ServerLog.AssignLogFrame(serverLogReverseButton, serverLogBox, serverLogFilterTicks.Content, serverLogFilter);
}
@@ -1134,15 +1135,19 @@ namespace Barotrauma
}
};
radiationEnabledTickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), settingsContent.RectTransform), TextManager.Get("CampaignOption.EnableRadiation"), font: GUI.Style.Font)
if (MapGenerationParams.Instance.RadiationParams != null)
{
Selected = true,
OnSelected = box =>
radiationEnabledTickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), settingsContent.RectTransform), TextManager.Get("CampaignOption.EnableRadiation"), font: GUI.Style.Font)
{
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, radiationEnabled: box.Selected);
return true;
}
};
Selected = true,
OnSelected = box =>
{
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, radiationEnabled: box.Selected);
return true;
}
};
}
List<GUIComponent> settingsElements = settingsContent.Children.ToList();
for (int i = 0; i < settingsElements.Count; i++)
@@ -1292,7 +1297,10 @@ namespace Barotrauma
}
SeedBox.Enabled = !CampaignFrame.Visible && !CampaignSetupFrame.Visible && GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
levelDifficultyScrollBar.Enabled = !CampaignFrame.Visible && !CampaignSetupFrame.Visible && GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
radiationEnabledTickBox.Enabled = CampaignSetupFrame.Visible && GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
if (radiationEnabledTickBox != null)
{
radiationEnabledTickBox.Enabled = CampaignSetupFrame.Visible && GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
}
traitorProbabilityButtons[0].Enabled = traitorProbabilityButtons[1].Enabled = traitorProbabilityText.Enabled =
!CampaignFrame.Visible && !CampaignSetupFrame.Visible && GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
botCountButtons[0].Enabled = botCountButtons[1].Enabled = GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
@@ -2611,6 +2619,18 @@ namespace Barotrauma
UserData = message,
CanBeFocused = false
};
msg.CalculateHeightFromText();
if (msg.RichTextData != null)
{
foreach (var data in msg.RichTextData)
{
msg.ClickableAreas.Add(new GUITextBlock.ClickableArea()
{
Data = data,
OnClick = GameMain.NetLobbyScreen.SelectPlayer
});
}
}
msg.RectTransform.SizeChanged += Recalculate;
void Recalculate()
{
@@ -311,7 +311,7 @@ namespace Barotrauma
public override void Update(double deltaTime)
{
cam.MoveCamera((float)deltaTime, true);
cam.MoveCamera((float)deltaTime, allowMove: true, allowZoom: GUI.MouseOn == null);
if (selectedPrefab != null)
{
@@ -4291,7 +4291,7 @@ namespace Barotrauma
if (PlayerInput.IsCtrlDown() && MapEntity.StartMovingPos == Vector2.Zero)
{
cam.MoveCamera((float) deltaTime, allowMove: false);
cam.MoveCamera((float) deltaTime, allowMove: false, allowZoom: GUI.MouseOn == null);
// Save menu
if (PlayerInput.KeyHit(Keys.S))
{
@@ -4330,12 +4330,12 @@ namespace Barotrauma
}
else
{
cam.MoveCamera((float) deltaTime, allowMove: true);
cam.MoveCamera((float) deltaTime, allowMove: true, allowZoom: GUI.MouseOn == null);
}
}
else
{
cam.MoveCamera((float) deltaTime, allowMove: false);
cam.MoveCamera((float) deltaTime, allowMove: false, allowZoom: GUI.MouseOn == null);
}
if (PlayerInput.MidButtonHeld())