cd50479...1ec6577
commit 1ec6577ad95e1d7ebc8cbfa261c9893c55ea987c Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 17:10:31 2019 +0200 Don't attempt to move character's hands in UpdateUseItem if the character is disabled. May be causing "attempted to move pulljoint extremely far" errors (see #895) commit 1aabc5110ce8e0ec208adce6380cbafd255b576f Author: ezjamsen <ezjames.fi@gmail.com> Date: Mon Feb 4 16:47:50 2019 +0200 removed syringes from the fabricator commit 0a80a2d8029275f6cffdae580d1ba86cd44dd1a2 Merge: 039c04818 686d4c482 Author: Eetu <pitkanen.eetu@gmail.com> Date: Mon Feb 4 16:43:55 2019 +0200 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev commit 039c04818e3598f2e4cdef4065434000a48bb229 Author: Eetu <pitkanen.eetu@gmail.com> Date: Mon Feb 4 16:43:51 2019 +0200 Updated: Alien artifacts to spawn inside containers tagged artifactholders in salvage missions & artifact events commit 686d4c482f692bcc31eb37aeaea0d5074a537fe9 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 16:42:11 2019 +0200 Fixed a bunch more buttons/sliders being invisible while pressed commit 823728511547f14a3dcb4fcf5025db592ea3dac9 Author: itchyOwl <lauri.harkanen@gmail.com> Date: Mon Feb 4 16:13:36 2019 +0200 Reset the unsaved changes when exitting the character editor (Not applied when the switching between the game view and the character editor). commit 9ecc56db4e73dd2ccd577130014020a1a502ae15 Merge: efbeda895 b824fc3f2 Author: itchyOwl <lauri.harkanen@gmail.com> Date: Mon Feb 4 16:04:57 2019 +0200 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev commit efbeda895fceecb8b4701f23ae5a51057aa44efb Author: itchyOwl <lauri.harkanen@gmail.com> Date: Mon Feb 4 16:03:54 2019 +0200 Fix crash on trying to undo limb/joint deletion. Undo does not currently work on these cases, but the ragdoll can be reset to the original state from the reset button. commit b824fc3f281aed76e8e0ed78ffb16d2213d2fda1 Author: ezjamsen <ezjames.fi@gmail.com> Date: Mon Feb 4 16:03:03 2019 +0200 removed syringe from medical doctor default kit commit c40c716962c7ae1a16d791b0fbd744627a2283c5 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 16:01:33 2019 +0200 Nerfed door welding (takes 4x longer to weld a door shut now) commit 7a27fcab1cec322fe75bcfad553aa42a37ec7d53 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 16:01:09 2019 +0200 Fixed StatusEffects not being able to target item components. Caused doors to be impossible to weld and most likely other issues with item StatusEffects as well. Closes #1053 commit 50c09ad85ee44018418f537827c009892f4feb23 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 15:52:38 2019 +0200 Fixed depth charges disappearing from loaders when interacting them with both hand slots full. Closes #1046 commit 648a5ba889623f776f184fb30b99133a8551234a Author: itchyOwl <lauri.harkanen@gmail.com> Date: Mon Feb 4 15:47:16 2019 +0200 Allow to delete the main limb in the character editor. Should not crash anymore. commit 751bda4d29b81c58c1b1df1653158543a3b7710d Author: itchyOwl <lauri.harkanen@gmail.com> Date: Mon Feb 4 15:46:53 2019 +0200 Add a bunch of null checks to prevent crashes when the main limb is null. commit 05c068f7aa35f7070e2cf19c526eff0c8d196b53 Author: ezjamsen <ezjames.fi@gmail.com> Date: Mon Feb 4 15:35:20 2019 +0200 Syringes removed from medical.xml due to being legacy items we should no longer support. commit 74389aa95e29fc7415de48230c8f12fd4a0a6847 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 15:30:13 2019 +0200 Attempt to fix LightSource removal causing nullref exceptions. commit 0907516bcac599b5ae20dc8e35f3a66adb8704b5 Merge: 659e1c58d f042994f4 Author: Eetu <pitkanen.eetu@gmail.com> Date: Mon Feb 4 15:25:07 2019 +0200 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev commit 659e1c58d3fb03d21acf2bb6065d07d1ac2ab914 Author: Eetu <pitkanen.eetu@gmail.com> Date: Mon Feb 4 15:24:59 2019 +0200 Added: Yes to All / No to All to the prompts when deleting multiple containers with contents. Fixed: Aforementioned prompts staying active when quitting the submarine editor. Moved: Logic for the prompts from ItemContainer.cs to SubEditorScreen.cs commit f042994f4b7eeff8cf5a6a68715c7c6aa6b8ddfb Merge: 70a968a16 5a2ca22bd Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 15:08:15 2019 +0200 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev commit 70a968a165c383c2ee765164b4507aa6072e0504 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 15:08:01 2019 +0200 Use inventory icons in the extra cargo menu, layout fixes commit 5a2ca22bde4be43f4577d20ae4e0a1ec20a23497 Merge: b2f89ea59 9ca7440be Author: ezjamsen <ezjames.fi@gmail.com> Date: Mon Feb 4 15:06:11 2019 +0200 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev commit b2f89ea59d481c109046d1edbd2807a516502b0c Author: ezjamsen <ezjames.fi@gmail.com> Date: Mon Feb 4 15:05:39 2019 +0200 redesigned walls in junction compartment of Typhon, closing #1042 commit 9ca7440be41a4fc2082b73618e90312af57c0817 Author: itchyOwl <lauri.harkanen@gmail.com> Date: Mon Feb 4 15:05:35 2019 +0200 Add some null checks to prevent crashing if the xml document or the source element is not found. commit 6d1331e9b86a5583761bc374c5dfb42868b03f45 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 15:03:53 2019 +0200 Fixed the layout of the extra cargo menu in server settings. Closes #1038 commit 02ac14076ace0418a5d35df7a574f99811d56017 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 14:10:34 2019 +0200 Fixed fire sounds persisting in menus. Closes #1047 commit d7d4516ddc9e21a2dba8f7bfd14a61ba7a805d4a Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 14:06:03 2019 +0200 Added a null check to CampaignUI to help diagnose #1029 commit 0fee58808c261cecd4a602db22e39dfb855ee018 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 13:55:50 2019 +0200 Fixed "attempting to remove an already removed item" console errors when ending a round. commit 5e4448024ce00231e9e479aa238ed4b134b07321 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 13:53:59 2019 +0200 Fixed crashing when ending a round while a character is outside the sub. Closes #1040 commit e3ff050561a8f823fc8abfddfec9d22ad4dc14a5 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 13:35:28 2019 +0200 Fixed battery positioning in charging docks. Closes #1041 commit d383aec6cb7f4525906fa858375729d4ad4fc0d4 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 13:26:00 2019 +0200 Fixed debugconsole adding the file number after the extension ("file123.txt (2)" instead of "file123 (2).txt"). Closes #1043 commit fee18b7ebcaea949c3f7d0c8027ab6253769b49c Merge: d03807237 c06e8990f Author: Eetu <pitkanen.eetu@gmail.com> Date: Mon Feb 4 12:10:12 2019 +0200 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev commit d038072372ab1993a44542298fe4031db6448ae4 Author: Eetu <pitkanen.eetu@gmail.com> Date: Mon Feb 4 12:10:04 2019 +0200 Fixed: Setting an item's condition to zero in the SubmarineEditor causing its OnBroken status effects to be fired commit c06e8990f97af7ae9b4788b281bf2801cdd8e2ff Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 11:43:35 2019 +0200 Fixed chatbox being deselected in the net lobby when receiving a lobby update from the server. Closes #1019 commit 2962647c37cec01fdb01092b94c25063c74c9ee0 Merge: b77bc3654 c89df8750 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 10:41:24 2019 +0200 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev commit b77bc365470c8cfb86dc83e4b21e5b36e0e28918 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 10:41:08 2019 +0200 Warning about automatic hull generation not working correctly with sloped walls when using the autohull command commit 85ef20a48532e06ef0c2774aa81e1fb517814b14 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 10:40:20 2019 +0200 Log the name of the item in the "attempting to remove an already removed item" error commit b6e32d4009a898db9c97316bcb6236170a7a92fe Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 10:39:46 2019 +0200 Fixed sliders not moving in the PowerContainer interface when an AI character is operating it commit 4b4848b5caa7bf3893e4ae2f5afef3c980f60e46 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Mon Feb 4 10:39:09 2019 +0200 Nullref fix in AIObjectiveGoto commit c89df87500c9026b3a6e75139391e64a4b1073e7 Author: Juan Pablo Arce <juanjp600@users.noreply.github.com> Date: Sun Feb 3 21:02:59 2019 -0300 whoops commit a85cc7705ea7611fff02fff7c18bc9826f03029a Author: Juan Pablo Arce <juanjp600@users.noreply.github.com> Date: Sun Feb 3 21:01:51 2019 -0300 ReduceAffliction loops back around if there's a surplus on index 0 commit e0047df3e089fd8be1646aecbd53b86b69949b13 Author: Juan Pablo Arce <juanjp600@users.noreply.github.com> Date: Sun Feb 3 19:45:52 2019 -0300 Fixed ReduceAffliction freezing Thanks to nilanthanimosus for catching this
This commit is contained in:
@@ -249,13 +249,19 @@ namespace Barotrauma
|
||||
if (MapEntity.mapEntityList.Any(e => e is Hull || e is Gap))
|
||||
{
|
||||
ShowQuestionPrompt("This submarine already has hulls and/or gaps. This command will delete them. Do you want to continue? Y/N",
|
||||
(option) => {
|
||||
if (option.ToLower() == "y") GameMain.SubEditorScreen.AutoHull();
|
||||
(option) =>
|
||||
{
|
||||
ShowQuestionPrompt("The automatic hull generation may not work correctly if your submarine uses curved walls. Do you want to continue? Y/N",
|
||||
(option2) =>
|
||||
{
|
||||
if (option2.ToLower() == "y") { GameMain.SubEditorScreen.AutoHull(); }
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMain.SubEditorScreen.AutoHull();
|
||||
ShowQuestionPrompt("The automatic hull generation may not work correctly if your submarine uses curved walls. Do you want to continue? Y/N",
|
||||
(option) => { if (option.ToLower() == "y") GameMain.SubEditorScreen.AutoHull(); });
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Barotrauma
|
||||
public GUIFrame InnerFrame { get; private set; }
|
||||
public GUITextBlock Header { get; private set; }
|
||||
public GUITextBlock Text { get; private set; }
|
||||
public string Tag { get; private set; }
|
||||
|
||||
public static GUIComponent VisibleBox => MessageBoxes.LastOrDefault();
|
||||
|
||||
@@ -34,7 +35,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
// TODO: allow to use a relative size.
|
||||
public GUIMessageBox(string headerText, string text, string[] buttons, int width = DefaultWidth, int height = 0, Alignment textAlignment = Alignment.TopLeft)
|
||||
public GUIMessageBox(string headerText, string text, string[] buttons, int width = DefaultWidth, int height = 0, Alignment textAlignment = Alignment.TopLeft, string tag = "")
|
||||
: base(new RectTransform(Vector2.One, GUI.Canvas, Anchor.Center), style: "")
|
||||
{
|
||||
int headerHeight = 30;
|
||||
@@ -43,6 +44,7 @@ namespace Barotrauma
|
||||
GUI.Style.Apply(InnerFrame, "", this);
|
||||
|
||||
Content = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.85f), InnerFrame.RectTransform, Anchor.Center)) { AbsoluteSpacing = 5 };
|
||||
Tag = tag;
|
||||
|
||||
if (height == 0)
|
||||
{
|
||||
|
||||
@@ -1061,6 +1061,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (lobbyUpdated)
|
||||
{
|
||||
var prevDispatcher = GUI.KeyboardDispatcher.Subscriber;
|
||||
|
||||
UInt16 updateID = inc.ReadUInt16();
|
||||
string serverName = inc.ReadString();
|
||||
string serverText = inc.ReadString();
|
||||
@@ -1162,9 +1164,19 @@ namespace Barotrauma.Networking
|
||||
ConnectedClients.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
//remove clients that aren't present anymore
|
||||
for (int i = ConnectedClients.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (!currentClients.Contains(ConnectedClients[i]))
|
||||
{
|
||||
GameMain.NetLobbyScreen.RemovePlayer(ConnectedClients[i].Name);
|
||||
ConnectedClients.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
Voting.AllowSubVoting = allowSubVoting;
|
||||
Voting.AllowModeVoting = allowModeVoting;
|
||||
GUI.KeyboardDispatcher.Subscriber = prevDispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -290,25 +290,32 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (ip == null || (!ip.CanBeBought && !ip.Tags.Contains("smallitem"))) continue;
|
||||
|
||||
GUITextBlock textBlock = new GUITextBlock(new RectTransform(new Vector2(0.9f, 0.15f), cargoFrame.Content.RectTransform) { MinSize = new Point(0, 30) },
|
||||
var itemFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.15f), cargoFrame.Content.RectTransform) { MinSize = new Point(0, 30) }, isHorizontal: true)
|
||||
{
|
||||
Stretch = true,
|
||||
UserData = cargoFrame,
|
||||
RelativeSpacing = 0.05f
|
||||
};
|
||||
|
||||
|
||||
if (ip.InventoryIcon != null || ip.sprite != null)
|
||||
{
|
||||
GUIImage img = new GUIImage(new RectTransform(new Point(itemFrame.Rect.Height), itemFrame.RectTransform),
|
||||
ip.InventoryIcon ?? ip.sprite, scaleToFit: true)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
img.Color = img.Sprite == ip.InventoryIcon ? ip.InventoryIconColor : ip.SpriteColor;
|
||||
}
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), itemFrame.RectTransform),
|
||||
ip.Name, font: GUI.SmallFont)
|
||||
{
|
||||
Padding = new Vector4(40.0f, 3.0f, 0.0f, 0.0f),
|
||||
UserData = cargoFrame,
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
if (ip.sprite != null)
|
||||
{
|
||||
GUIImage img = new GUIImage(new RectTransform(new Point(textBlock.Rect.Height), textBlock.RectTransform), ip.sprite, scaleToFit: true)
|
||||
{
|
||||
Color = ip.SpriteColor
|
||||
};
|
||||
}
|
||||
|
||||
extraCargo.TryGetValue(ip, out int cargoVal);
|
||||
var amountInput = new GUINumberInput(new RectTransform(new Vector2(0.3f, 1.0f), textBlock.RectTransform, Anchor.CenterRight),
|
||||
GUINumberInput.NumberType.Int)
|
||||
var amountInput = new GUINumberInput(new RectTransform(new Vector2(0.3f, 1.0f), itemFrame.RectTransform),
|
||||
GUINumberInput.NumberType.Int, textAlignment: Alignment.CenterLeft)
|
||||
{
|
||||
MinValueInt = 0,
|
||||
MaxValueInt = 100,
|
||||
|
||||
@@ -253,6 +253,14 @@ namespace Barotrauma
|
||||
|
||||
private void UpdateLocationView(Location location)
|
||||
{
|
||||
if (location == null)
|
||||
{
|
||||
string errorMsg = "Failed to update CampaignUI location view (location was null)\n" + Environment.StackTrace;
|
||||
DebugConsole.ThrowError(errorMsg);
|
||||
GameAnalyticsManager.AddErrorEventOnce("CampaignUI.UpdateLocationView:LocationNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (characterPreviewFrame != null)
|
||||
{
|
||||
characterPreviewFrame.Parent.RemoveChild(characterPreviewFrame);
|
||||
|
||||
@@ -126,6 +126,8 @@ namespace Barotrauma
|
||||
isEndlessRunner = false;
|
||||
if (character != null)
|
||||
{
|
||||
AnimParams.ForEach(a => a.Reset(true));
|
||||
RagdollParams.Reset(true);
|
||||
RagdollParams.ClearHistory();
|
||||
CurrentAnimation.ClearHistory();
|
||||
if (!character.Removed)
|
||||
@@ -833,12 +835,12 @@ namespace Barotrauma
|
||||
break;
|
||||
}
|
||||
var limb = selectedLimbs[i];
|
||||
if (limb == character.AnimController.MainLimb)
|
||||
{
|
||||
// TODO: this should be possible now -> test
|
||||
DebugConsole.ThrowError("Can't remove the main limb, because it will crash the game.");
|
||||
continue;
|
||||
}
|
||||
//if (limb == character.AnimController.MainLimb)
|
||||
//{
|
||||
// // TODO: this should be possible now -> test
|
||||
// DebugConsole.ThrowError("Can't remove the main limb, because it will crash the game.");
|
||||
// continue;
|
||||
//}
|
||||
removedIDs.Add(limb.limbParams.ID);
|
||||
limb.limbParams.Element.Remove();
|
||||
RagdollParams.Limbs.Remove(limb.limbParams);
|
||||
|
||||
@@ -64,6 +64,8 @@ namespace Barotrauma
|
||||
|
||||
private DateTime editorSelectedTime;
|
||||
|
||||
private readonly string containerDeleteTag = "containerdelete";
|
||||
|
||||
public override Camera Cam
|
||||
{
|
||||
get { return cam; }
|
||||
@@ -580,6 +582,143 @@ namespace Barotrauma
|
||||
dummyCharacter = null;
|
||||
GameMain.World.ProcessChanges();
|
||||
}
|
||||
|
||||
if (GUIMessageBox.MessageBoxes.Any(mbox => (mbox as GUIMessageBox).Tag == containerDeleteTag))
|
||||
{
|
||||
for (int i = 0; i < GUIMessageBox.MessageBoxes.Count; i++)
|
||||
{
|
||||
GUIMessageBox box = GUIMessageBox.MessageBoxes[i] as GUIMessageBox;
|
||||
if (box.Tag != containerDeleteTag) continue;
|
||||
box.Close();
|
||||
i--; // Take into account the message boxes removing themselves from the list when closed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleContainerContentsDeletion(Item itemToDelete, Inventory itemInventory)
|
||||
{
|
||||
string itemNames = string.Empty;
|
||||
|
||||
foreach (Item item in itemInventory.Items)
|
||||
{
|
||||
if (item == null) continue;
|
||||
itemNames += item.Name + "\n";
|
||||
}
|
||||
|
||||
if (itemNames.Length > 0)
|
||||
{
|
||||
// Multiple prompts open
|
||||
if (GUIMessageBox.MessageBoxes.Any(mbox => (mbox as GUIMessageBox).Tag == containerDeleteTag))
|
||||
{
|
||||
var msgBox = new GUIMessageBox(itemToDelete.Name, TextManager.Get("DeletingContainerWithItems") + itemNames, new string[] { TextManager.Get("Yes"), TextManager.Get("No"), TextManager.Get("YesToAll"), TextManager.Get("NoToAll") }, tag: containerDeleteTag);
|
||||
|
||||
// Yes
|
||||
msgBox.Buttons[0].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
itemInventory.DeleteAllItems();
|
||||
msgBox.Close();
|
||||
return true;
|
||||
};
|
||||
|
||||
// No
|
||||
msgBox.Buttons[1].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (Selected == GameMain.SubEditorScreen)
|
||||
{
|
||||
foreach (Item item in itemInventory.Items)
|
||||
{
|
||||
if (item == null) continue;
|
||||
item.Drop();
|
||||
}
|
||||
}
|
||||
else // If current screen is not subeditor, delete anyway to avoid lingering objects
|
||||
{
|
||||
itemInventory.DeleteAllItems();
|
||||
}
|
||||
|
||||
msgBox.Close();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Yes to All
|
||||
msgBox.Buttons[2].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
for (int i = 0; i < GUIMessageBox.MessageBoxes.Count; i++)
|
||||
{
|
||||
GUIMessageBox box = GUIMessageBox.MessageBoxes[i] as GUIMessageBox;
|
||||
if (box.Tag != msgBox.Tag || box == msgBox) continue;
|
||||
GUIButton button = box.Buttons[0];
|
||||
button.OnClicked(button, button.UserData);
|
||||
i--; // Take into account the message boxes removing themselves from the list when closed
|
||||
}
|
||||
|
||||
itemInventory.DeleteAllItems();
|
||||
msgBox.Close();
|
||||
return true;
|
||||
};
|
||||
|
||||
// No to all
|
||||
msgBox.Buttons[3].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
for (int i = 0; i < GUIMessageBox.MessageBoxes.Count; i++)
|
||||
{
|
||||
GUIMessageBox box = GUIMessageBox.MessageBoxes[i] as GUIMessageBox;
|
||||
if (box.Tag != msgBox.Tag || box == msgBox) continue;
|
||||
GUIButton button = box.Buttons[1];
|
||||
button.OnClicked(button, button.UserData);
|
||||
i--; // Take into account the message boxes removing themselves from the list when closed
|
||||
}
|
||||
|
||||
if (Selected == GameMain.SubEditorScreen)
|
||||
{
|
||||
foreach (Item item in itemInventory.Items)
|
||||
{
|
||||
if (item == null) continue;
|
||||
item.Drop();
|
||||
}
|
||||
}
|
||||
else // If current screen is not subeditor, delete anyway to avoid lingering objects
|
||||
{
|
||||
itemInventory.DeleteAllItems();
|
||||
}
|
||||
|
||||
msgBox.Close();
|
||||
return true;
|
||||
};
|
||||
}
|
||||
else // Single prompt
|
||||
{
|
||||
var msgBox = new GUIMessageBox(itemToDelete.Name, TextManager.Get("DeletingContainerWithItems") + itemNames, new string[] { TextManager.Get("Yes"), TextManager.Get("No") }, tag: containerDeleteTag);
|
||||
|
||||
// Yes
|
||||
msgBox.Buttons[0].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
itemInventory.DeleteAllItems();
|
||||
msgBox.Close();
|
||||
return true;
|
||||
};
|
||||
|
||||
// No
|
||||
msgBox.Buttons[1].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (Selected == GameMain.SubEditorScreen)
|
||||
{
|
||||
foreach (Item item in itemInventory.Items)
|
||||
{
|
||||
if (item == null) continue;
|
||||
item.Drop();
|
||||
}
|
||||
}
|
||||
else // If current screen is not subeditor, delete anyway to avoid lingering objects
|
||||
{
|
||||
itemInventory.DeleteAllItems();
|
||||
}
|
||||
|
||||
msgBox.Close();
|
||||
return true;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateDummyCharacter()
|
||||
|
||||
@@ -225,6 +225,14 @@ namespace Barotrauma
|
||||
flowSoundChannels[i].Dispose();
|
||||
flowSoundChannels[i] = null;
|
||||
}
|
||||
for (int i = 0; i < fireSoundChannels.Length; i++)
|
||||
{
|
||||
if (fireSoundChannels[i] == null) continue;
|
||||
fireSoundChannels[i].Dispose();
|
||||
fireSoundChannels[i] = null;
|
||||
}
|
||||
fireVolumeLeft[0] = 0.0f; fireVolumeLeft[1] = 0.0f;
|
||||
fireVolumeRight[0] = 0.0f; fireVolumeRight[1] = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace Barotrauma
|
||||
{
|
||||
//if path is up-to-date and contains outdoors nodes, this path is unreachable
|
||||
var pathSteering = character.AIController.SteeringManager as IndoorsSteeringManager;
|
||||
if (pathSteering.CurrentPath != null &&
|
||||
if (pathSteering?.CurrentPath != null &&
|
||||
Vector2.Distance(pathSteering.CurrentTarget, currTargetPos) < 1.0f &&
|
||||
pathSteering.CurrentPath.HasOutdoorsNodes)
|
||||
{
|
||||
|
||||
@@ -130,6 +130,7 @@ namespace Barotrauma
|
||||
public override void UpdateAnim(float deltaTime)
|
||||
{
|
||||
if (Frozen) return;
|
||||
if (MainLimb == null) { return; }
|
||||
|
||||
if (character.IsDead || character.IsUnconscious || character.Stun > 0.0f)
|
||||
{
|
||||
|
||||
@@ -311,6 +311,7 @@ namespace Barotrauma
|
||||
public override void UpdateAnim(float deltaTime)
|
||||
{
|
||||
if (Frozen) return;
|
||||
if (MainLimb == null) { return; }
|
||||
|
||||
levitatingCollider = true;
|
||||
ColliderIndex = Crouching ? 1 : 0;
|
||||
@@ -335,8 +336,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
deathAnimTimer = 0.0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!character.AllowInput)
|
||||
{
|
||||
@@ -1834,6 +1834,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (!character.Enabled) { return; }
|
||||
|
||||
Vector2 handSimPos = ConvertUnits.ToSimUnits(handWorldPos);
|
||||
if (character.Submarine != null)
|
||||
{
|
||||
|
||||
@@ -382,6 +382,11 @@ namespace Barotrauma
|
||||
protected void CreateSnapshot<T>() where T : AnimationParams, new()
|
||||
{
|
||||
Serialize();
|
||||
if (doc == null)
|
||||
{
|
||||
DebugConsole.ThrowError("[AnimationParams] The source XML Document is null!");
|
||||
return;
|
||||
}
|
||||
var copy = new T
|
||||
{
|
||||
IsLoaded = true,
|
||||
|
||||
@@ -45,6 +45,11 @@ namespace Barotrauma
|
||||
protected virtual bool Serialize(XElement element = null)
|
||||
{
|
||||
element = element ?? MainElement;
|
||||
if (element == null)
|
||||
{
|
||||
DebugConsole.ThrowError("[EditableParams] The XML element is null!");
|
||||
return false;
|
||||
}
|
||||
SerializableProperty.SerializeProperties(this, element, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -311,6 +311,11 @@ namespace Barotrauma
|
||||
public override void CreateSnapshot()
|
||||
{
|
||||
Serialize();
|
||||
if (doc == null)
|
||||
{
|
||||
DebugConsole.ThrowError("[RagdollParams] The source XML Document is null!");
|
||||
return;
|
||||
}
|
||||
var copy = new RagdollParams
|
||||
{
|
||||
IsLoaded = true,
|
||||
@@ -328,13 +333,29 @@ namespace Barotrauma
|
||||
|
||||
private void RevertTo(RagdollParams source)
|
||||
{
|
||||
if (source.MainElement == null)
|
||||
{
|
||||
DebugConsole.ThrowError("[RagdollParams] The source XML Element of the given RagdollParams is null!");
|
||||
return;
|
||||
}
|
||||
Deserialize(source.MainElement, recursive: false);
|
||||
var sourceSubParams = source.GetAllSubParams().ToList();
|
||||
var subParams = GetAllSubParams().ToList();
|
||||
// TODO: cannot currently undo joint/limb deletion.
|
||||
if (sourceSubParams.Count != subParams.Count)
|
||||
{
|
||||
DebugConsole.ThrowError("[RagdollParams] The count of the sub params differs! Failed to revert to the previous snapshot! Please reset the ragdoll to undo the changes.");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < subParams.Count; i++)
|
||||
{
|
||||
subParams[i].Deserialize(sourceSubParams[i].Element, recursive: false);
|
||||
var subSubParams = subParams[i].SubParams;
|
||||
if (subSubParams.Count != sourceSubParams[i].SubParams.Count)
|
||||
{
|
||||
DebugConsole.ThrowError("[RagdollParams] The count of the sub sub params differs! Failed to revert to the previous snapshot! Please reset the ragdoll to undo the changes.");
|
||||
return;
|
||||
}
|
||||
subParams[i].Deserialize(sourceSubParams[i].Element, recursive: false);
|
||||
for (int j = 0; j < subSubParams.Count; j++)
|
||||
{
|
||||
subSubParams[j].Deserialize(sourceSubParams[i].SubParams[j].Element, recursive: false);
|
||||
|
||||
@@ -1355,6 +1355,7 @@ namespace Barotrauma
|
||||
"Attempted to move a ragdoll (" + character.Name + ") to an invalid position (" + simPosition + "). " + Environment.StackTrace);
|
||||
return;
|
||||
}
|
||||
if (MainLimb == null) { return; }
|
||||
|
||||
Vector2 limbMoveAmount = simPosition - MainLimb.SimPosition;
|
||||
|
||||
|
||||
@@ -525,7 +525,11 @@ namespace Barotrauma
|
||||
|
||||
public override Vector2 DrawPosition
|
||||
{
|
||||
get { return AnimController.MainLimb.body.DrawPosition; }
|
||||
get
|
||||
{
|
||||
if (AnimController.MainLimb == null) { return Vector2.Zero; }
|
||||
return AnimController.MainLimb.body.DrawPosition;
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void OnDeathHandler(Character character, CauseOfDeath causeOfDeath);
|
||||
|
||||
@@ -354,26 +354,26 @@ namespace Barotrauma
|
||||
|
||||
if (matchingAfflictions.Count == 0) return;
|
||||
|
||||
do
|
||||
float reduceAmount = amount / matchingAfflictions.Count;
|
||||
for (int i = matchingAfflictions.Count - 1; i >= 0; i--)
|
||||
{
|
||||
float reduceAmount = amount / matchingAfflictions.Count;
|
||||
for (int i = matchingAfflictions.Count - 1; i >= 0; i--)
|
||||
var matchingAffliction = matchingAfflictions[i];
|
||||
if (matchingAffliction.Strength < reduceAmount)
|
||||
{
|
||||
var matchingAffliction = matchingAfflictions[i];
|
||||
if (matchingAffliction.Strength < reduceAmount)
|
||||
{
|
||||
amount -= matchingAffliction.Strength;
|
||||
matchingAffliction.Strength = 0.0f;
|
||||
matchingAfflictions.RemoveAt(i);
|
||||
SteamAchievementManager.OnAfflictionRemoved(matchingAffliction, Character);
|
||||
}
|
||||
else
|
||||
{
|
||||
matchingAffliction.Strength -= reduceAmount;
|
||||
amount -= reduceAmount;
|
||||
}
|
||||
float surplus = reduceAmount - matchingAffliction.Strength;
|
||||
amount -= matchingAffliction.Strength;
|
||||
matchingAffliction.Strength = 0.0f;
|
||||
matchingAfflictions.RemoveAt(i);
|
||||
if (i == 0) i = matchingAfflictions.Count;
|
||||
if (i > 0) reduceAmount += surplus / i;
|
||||
SteamAchievementManager.OnAfflictionRemoved(matchingAffliction, Character);
|
||||
}
|
||||
} while (matchingAfflictions.Count > 0 && amount > 0.0f);
|
||||
else
|
||||
{
|
||||
matchingAffliction.Strength -= reduceAmount;
|
||||
amount -= reduceAmount;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3036,7 +3036,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
string fileName = "DebugConsoleLog_" + DateTime.Now.ToShortDateString() + "_" + DateTime.Now.ToShortTimeString() + ".txt";
|
||||
string fileName = "DebugConsoleLog_" + DateTime.Now.ToShortDateString() + "_" + DateTime.Now.ToShortTimeString();
|
||||
var invalidChars = Path.GetInvalidFileNameChars();
|
||||
foreach (char invalidChar in invalidChars)
|
||||
{
|
||||
@@ -3044,7 +3044,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
string filePath = Path.Combine(SavePath, fileName);
|
||||
if (File.Exists(filePath))
|
||||
if (File.Exists(filePath + ".txt"))
|
||||
{
|
||||
int fileNum = 2;
|
||||
while (File.Exists(filePath + " (" + fileNum + ")"))
|
||||
@@ -3056,7 +3056,7 @@ namespace Barotrauma
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllLines(filePath, unsavedMessages.Select(l => "[" + l.Time + "] " + l.Text));
|
||||
File.WriteAllLines(filePath + ".txt", unsavedMessages.Select(l => "[" + l.Time + "] " + l.Text));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -64,19 +64,14 @@ namespace Barotrauma
|
||||
item = new Item(itemPrefab, spawnPos, null);
|
||||
item.body.FarseerBody.IsKinematic = true;
|
||||
|
||||
//try to find a nearby artifact holder (or any alien itemcontainer) and place the artifact inside it
|
||||
//try to find an artifact holder and place the artifact inside it
|
||||
foreach (Item it in Item.ItemList)
|
||||
{
|
||||
if (it.Submarine != null || !it.HasTag("alien")) continue;
|
||||
|
||||
if (Math.Abs(item.WorldPosition.X - it.WorldPosition.X) > 2000.0f) continue;
|
||||
if (Math.Abs(item.WorldPosition.Y - it.WorldPosition.Y) > 2000.0f) continue;
|
||||
if (it.Submarine != null || !it.HasTag("artifactholder")) continue;
|
||||
|
||||
var itemContainer = it.GetComponent<Items.Components.ItemContainer>();
|
||||
if (itemContainer == null) continue;
|
||||
|
||||
itemContainer.Combine(item);
|
||||
break;
|
||||
if (itemContainer.Combine(item)) break; // Placement successful
|
||||
}
|
||||
|
||||
if (GameSettings.VerboseLogging)
|
||||
|
||||
@@ -64,19 +64,14 @@ namespace Barotrauma
|
||||
|
||||
if (item.HasTag("alien"))
|
||||
{
|
||||
//try to find a nearby artifact holder (or any alien itemcontainer) and place the artifact inside it
|
||||
//try to find an artifact holder and place the artifact inside it
|
||||
foreach (Item it in Item.ItemList)
|
||||
{
|
||||
if (it.Submarine != null || !it.HasTag("alien")) continue;
|
||||
|
||||
if (Math.Abs(item.WorldPosition.X - it.WorldPosition.X) > 2000.0f) continue;
|
||||
if (Math.Abs(item.WorldPosition.Y - it.WorldPosition.Y) > 2000.0f) continue;
|
||||
if (it.Submarine != null || !it.HasTag("artifactholder")) continue;
|
||||
|
||||
var itemContainer = it.GetComponent<Items.Components.ItemContainer>();
|
||||
if (itemContainer == null) continue;
|
||||
|
||||
itemContainer.Combine(item);
|
||||
break;
|
||||
if (itemContainer.Combine(item)) break; // Placement successful
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +146,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override bool Select(Character character)
|
||||
{
|
||||
if (item.Container != null) { return false; }
|
||||
|
||||
if (AutoInteractWithContained)
|
||||
{
|
||||
foreach (Item contained in Inventory.Items)
|
||||
@@ -262,35 +264,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (Screen.Selected == GameMain.SubEditorScreen && !Submarine.Unloading)
|
||||
{
|
||||
string itemNames = string.Empty;
|
||||
|
||||
foreach (Item item in Inventory.Items)
|
||||
{
|
||||
if (item == null) continue;
|
||||
itemNames += item.Name + "\n";
|
||||
}
|
||||
|
||||
if (itemNames.Length > 0)
|
||||
{
|
||||
var msgBox = new GUIMessageBox(Item.Name, TextManager.Get("DeletingContainerWithItems") + itemNames, new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
msgBox.Buttons[0].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
Inventory.DeleteAllItems();
|
||||
msgBox.Close();
|
||||
return true;
|
||||
};
|
||||
|
||||
msgBox.Buttons[1].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
foreach (Item item in Inventory.Items)
|
||||
{
|
||||
if (item == null) continue;
|
||||
item.Drop();
|
||||
}
|
||||
msgBox.Close();
|
||||
return true;
|
||||
};
|
||||
}
|
||||
GameMain.SubEditorScreen.HandleContainerContentsDeletion(Item, Inventory);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -219,6 +219,9 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
item.CreateServerEvent(this);
|
||||
RechargeSpeed = maxRechargeSpeed * 0.5f;
|
||||
#if CLIENT
|
||||
rechargeSpeedSlider.BarScroll = RechargeSpeed / Math.Max(maxRechargeSpeed, 1.0f);
|
||||
#endif
|
||||
character.Speak(TextManager.Get("DialogChargeBatteries")
|
||||
.Replace("[itemname]", item.Name)
|
||||
.Replace("[rate]", ((int)(rechargeSpeed / maxRechargeSpeed * 100.0f)).ToString()), null, 1.0f, "chargebattery", 10.0f);
|
||||
@@ -230,6 +233,9 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
item.CreateServerEvent(this);
|
||||
RechargeSpeed = 0.0f;
|
||||
#if CLIENT
|
||||
rechargeSpeedSlider.BarScroll = RechargeSpeed / Math.Max(maxRechargeSpeed, 1.0f);
|
||||
#endif
|
||||
character.Speak(TextManager.Get("DialogStopChargingBatteries")
|
||||
.Replace("[itemname]", item.Name)
|
||||
.Replace("[rate]", ((int)(rechargeSpeed / maxRechargeSpeed * 100.0f)).ToString()), null, 1.0f, "chargebattery", 10.0f);
|
||||
|
||||
@@ -262,6 +262,7 @@ namespace Barotrauma
|
||||
{
|
||||
ic.PlaySound(ActionType.OnBroken, WorldPosition);
|
||||
}
|
||||
if (Screen.Selected == GameMain.SubEditorScreen) return;
|
||||
#endif
|
||||
ApplyStatusEffects(ActionType.OnBroken, 1.0f, null);
|
||||
}
|
||||
@@ -2251,11 +2252,14 @@ namespace Barotrauma
|
||||
element.Add(new XAttribute("condition", condition.ToString("G", CultureInfo.InvariantCulture)));
|
||||
}
|
||||
|
||||
System.Diagnostics.Debug.Assert(Submarine != null);
|
||||
Item rootContainer = GetRootContainer() ?? this;
|
||||
System.Diagnostics.Debug.Assert(Submarine != null || rootContainer.ParentInventory?.Owner is Character);
|
||||
|
||||
Vector2 subPosition = Submarine == null ? Vector2.Zero : Submarine.HiddenSubPosition;
|
||||
|
||||
element.Add(new XAttribute("rect",
|
||||
(int)(rect.X - Submarine.HiddenSubPosition.X) + "," +
|
||||
(int)(rect.Y - Submarine.HiddenSubPosition.Y) + "," +
|
||||
(int)(rect.X - subPosition.X) + "," +
|
||||
(int)(rect.Y - subPosition.Y) + "," +
|
||||
rect.Width + "," + rect.Height));
|
||||
|
||||
if (linkedTo != null && linkedTo.Count > 0)
|
||||
@@ -2326,7 +2330,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (Removed)
|
||||
{
|
||||
DebugConsole.ThrowError("Attempting to remove an already removed item\n" + Environment.StackTrace);
|
||||
DebugConsole.ThrowError("Attempting to remove an already removed item (" + Name + ")\n" + Environment.StackTrace);
|
||||
return;
|
||||
}
|
||||
DebugConsole.Log("Removing item " + Name + " (ID: " + ID + ")");
|
||||
|
||||
@@ -225,6 +225,7 @@ namespace Barotrauma
|
||||
|
||||
dictionary.Clear();
|
||||
Hull.EntityGrids.Clear();
|
||||
Spawner?.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Barotrauma
|
||||
|
||||
private Entity Submarine;
|
||||
|
||||
private bool removed;
|
||||
|
||||
#if CLIENT
|
||||
private List<Decal> burnDecals = new List<Decal>();
|
||||
#endif
|
||||
@@ -150,7 +152,11 @@ namespace Barotrauma
|
||||
DamageCharacters(deltaTime);
|
||||
DamageItems(deltaTime);
|
||||
|
||||
if (hull.WaterVolume > 0.0f) HullWaterExtinguish(deltaTime);
|
||||
if (hull.WaterVolume > 0.0f)
|
||||
{
|
||||
HullWaterExtinguish(deltaTime);
|
||||
if (removed) { return; }
|
||||
}
|
||||
|
||||
hull.Oxygen -= size.X * deltaTime * OxygenConsumption;
|
||||
|
||||
@@ -319,15 +325,16 @@ namespace Barotrauma
|
||||
public void Remove()
|
||||
{
|
||||
#if CLIENT
|
||||
lightSource.Remove();
|
||||
lightSource?.Remove();
|
||||
lightSource = null;
|
||||
|
||||
foreach (Decal d in burnDecals)
|
||||
{
|
||||
d.StopFadeIn();
|
||||
}
|
||||
#endif
|
||||
|
||||
hull.RemoveFire(this);
|
||||
hull?.RemoveFire(this);
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -906,10 +906,14 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
while (FireSources.Count > fireSourceCount)
|
||||
for (int i = FireSources.Count - 1; i >= fireSourceCount; i--)
|
||||
{
|
||||
FireSources[FireSources.Count - 1].Remove();
|
||||
}
|
||||
FireSources[i].Remove();
|
||||
if (i < FireSources.Count)
|
||||
{
|
||||
FireSources.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Hull Load(XElement element, Submarine submarine)
|
||||
|
||||
@@ -176,6 +176,12 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
removeQueue.Clear();
|
||||
spawnQueue.Clear();
|
||||
}
|
||||
|
||||
public void ServerWrite(Lidgren.Network.NetBuffer message, Client client, object[] extraData = null)
|
||||
{
|
||||
if (GameMain.Server == null) return;
|
||||
|
||||
@@ -464,6 +464,11 @@ namespace Barotrauma
|
||||
if (item.HasTag(targetIdentifiers)) return true;
|
||||
if (targetIdentifiers.Any(id => id == item.Prefab.Identifier)) return true;
|
||||
}
|
||||
else if (entity is ItemComponent itemComponent)
|
||||
{
|
||||
if (itemComponent.Item.HasTag(targetIdentifiers)) return true;
|
||||
if (targetIdentifiers.Any(id => id == itemComponent.Item.Prefab.Identifier)) return true;
|
||||
}
|
||||
else if (entity is Structure structure)
|
||||
{
|
||||
if (targetIdentifiers.Any(id => id == structure.Prefab.Identifier)) return true;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user