(6e187d247) Fixed contained items' status effects being added twice to the list of an ItemContainer's active status effects when swapping items. For example, when swapping a fuel rod with another one, the status effect that increases AvailableFuel would be applied twice, causing the reactor to act as if there were 2 rods in it. Closes #1643 + merge fix
This commit is contained in:
@@ -442,7 +442,8 @@ namespace Barotrauma
|
|||||||
if (draggingItemToWorld)
|
if (draggingItemToWorld)
|
||||||
{
|
{
|
||||||
if (item.OwnInventory == null ||
|
if (item.OwnInventory == null ||
|
||||||
!item.OwnInventory.CanBePut(CharacterInventory.draggingItem))
|
!item.OwnInventory.CanBePut(CharacterInventory.draggingItem) ||
|
||||||
|
!CanAccessInventory(item.OwnInventory))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ namespace Barotrauma
|
|||||||
foreach (Item item in Item.ItemList)
|
foreach (Item item in Item.ItemList)
|
||||||
{
|
{
|
||||||
if (!item.Repairables.Any(r => item.Condition < r.ShowRepairUIThreshold)) { continue; }
|
if (!item.Repairables.Any(r => item.Condition < r.ShowRepairUIThreshold)) { continue; }
|
||||||
if (!Submarine.VisibleEntities.Contains(item)) { continue; }
|
if (Submarine.VisibleEntities != null && !Submarine.VisibleEntities.Contains(item)) { continue; }
|
||||||
|
|
||||||
Vector2 diff = item.WorldPosition - character.WorldPosition;
|
Vector2 diff = item.WorldPosition - character.WorldPosition;
|
||||||
if (Submarine.CheckVisibility(character.SimPosition, character.SimPosition + ConvertUnits.ToSimUnits(diff)) == null)
|
if (Submarine.CheckVisibility(character.SimPosition, character.SimPosition + ConvertUnits.ToSimUnits(diff)) == null)
|
||||||
@@ -216,7 +216,7 @@ namespace Barotrauma
|
|||||||
Color.LightGreen, Color.Black, 2, GUI.SmallFont);
|
Color.LightGreen, Color.Black, 2, GUI.SmallFont);
|
||||||
textPos.Y += offset.Y;
|
textPos.Y += offset.Y;
|
||||||
}
|
}
|
||||||
if (character.FocusedCharacter.CharacterHealth.UseHealthWindow)
|
if (character.FocusedCharacter.CharacterHealth.UseHealthWindow && character.CanInteractWith(character.FocusedCharacter, 160f, false))
|
||||||
{
|
{
|
||||||
GUI.DrawString(spriteBatch, textPos, GetCachedHudText("HealHint", GameMain.Config.KeyBind(InputType.Health).ToString()),
|
GUI.DrawString(spriteBatch, textPos, GetCachedHudText("HealHint", GameMain.Config.KeyBind(InputType.Health).ToString()),
|
||||||
Color.LightGreen, Color.Black, 2, GUI.SmallFont);
|
Color.LightGreen, Color.Black, 2, GUI.SmallFont);
|
||||||
|
|||||||
@@ -449,12 +449,11 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
float depth = ActiveSprite.Depth - 0.0000015f;
|
float depth = ActiveSprite.Depth - 0.0000015f;
|
||||||
|
|
||||||
// TODO: enable when the damage overlay textures have been remade.
|
DamagedSprite.Draw(spriteBatch,
|
||||||
//DamagedSprite.Draw(spriteBatch,
|
new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
|
||||||
// new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
|
color * Math.Min(damageOverlayStrength, 1.0f), ActiveSprite.Origin,
|
||||||
// color * Math.Min(damageOverlayStrength, 1.0f), ActiveSprite.Origin,
|
-body.DrawRotation,
|
||||||
// -body.DrawRotation,
|
1.0f, spriteEffect, depth);
|
||||||
// 1.0f, spriteEffect, depth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameMain.DebugDraw)
|
if (GameMain.DebugDraw)
|
||||||
|
|||||||
@@ -148,7 +148,14 @@ namespace Barotrauma
|
|||||||
//find the parent GUIListBox highest in the hierarchy
|
//find the parent GUIListBox highest in the hierarchy
|
||||||
for (int i = parentHierarchy.Count - 1; i >= 0; i--)
|
for (int i = parentHierarchy.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (parentHierarchy[i].GUIComponent is GUIListBox) return parentHierarchy[i];
|
if (parentHierarchy[i].GUIComponent is GUIListBox)
|
||||||
|
{
|
||||||
|
if (parentHierarchy[i].Parent != null && parentHierarchy[i].Parent.GUIComponent != null)
|
||||||
|
{
|
||||||
|
return parentHierarchy[i].Parent;
|
||||||
|
}
|
||||||
|
return parentHierarchy[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//or just go with the direct parent if there are no listboxes in the hierarchy
|
//or just go with the direct parent if there are no listboxes in the hierarchy
|
||||||
parentHierarchy.Clear();
|
parentHierarchy.Clear();
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
ToolBox.IsProperFilenameCase(file);
|
ToolBox.IsProperFilenameCase(file);
|
||||||
doc = XDocument.Load(file, LoadOptions.SetBaseUri);
|
doc = XDocument.Load(file, LoadOptions.SetBaseUri);
|
||||||
|
if (doc == null) { throw new Exception("doc is null"); }
|
||||||
|
if (doc.Root == null) { throw new Exception("doc.Root is null"); }
|
||||||
|
if (doc.Root.Elements() == null) { throw new Exception("doc.Root.Elements() is null"); }
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -113,26 +116,34 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private void RescaleFonts()
|
private void RescaleFonts()
|
||||||
{
|
{
|
||||||
|
if (configElement == null) { return; }
|
||||||
|
if (configElement.Elements() == null) { return; }
|
||||||
foreach (XElement subElement in configElement.Elements())
|
foreach (XElement subElement in configElement.Elements())
|
||||||
{
|
{
|
||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||||
{
|
{
|
||||||
case "font":
|
case "font":
|
||||||
|
if (Font == null) { continue; }
|
||||||
Font.Size = GetFontSize(subElement);
|
Font.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
case "smallfont":
|
case "smallfont":
|
||||||
|
if (SmallFont == null) { continue; }
|
||||||
SmallFont.Size = GetFontSize(subElement);
|
SmallFont.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
case "largefont":
|
case "largefont":
|
||||||
|
if (LargeFont == null) { continue; }
|
||||||
LargeFont.Size = GetFontSize(subElement);
|
LargeFont.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
case "objectivetitle":
|
case "objectivetitle":
|
||||||
|
if (ObjectiveTitleFont == null) { continue; }
|
||||||
ObjectiveTitleFont.Size = GetFontSize(subElement);
|
ObjectiveTitleFont.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
case "objectivename":
|
case "objectivename":
|
||||||
|
if (ObjectiveNameFont == null) { continue; }
|
||||||
ObjectiveNameFont.Size = GetFontSize(subElement);
|
ObjectiveNameFont.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
case "videotitle":
|
case "videotitle":
|
||||||
|
if (VideoTitleFont == null) { continue; }
|
||||||
VideoTitleFont.Size = GetFontSize(subElement);
|
VideoTitleFont.Size = GetFontSize(subElement);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace Barotrauma
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
const float CharacterWaitOnSwitch = 10.0f;
|
const float CharacterWaitOnSwitch = 10.0f;
|
||||||
|
|
||||||
private List<CharacterInfo> characterInfos = new List<CharacterInfo>();
|
private readonly List<CharacterInfo> characterInfos = new List<CharacterInfo>();
|
||||||
private List<Character> characters = new List<Character>();
|
private readonly List<Character> characters = new List<Character>();
|
||||||
|
|
||||||
private Point screenResolution;
|
private Point screenResolution;
|
||||||
|
|
||||||
|
|||||||
@@ -256,6 +256,18 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (c.Info == null || c.Inventory == null) { continue; }
|
if (c.Info == null || c.Inventory == null) { continue; }
|
||||||
var inventoryElement = new XElement("inventory");
|
var inventoryElement = new XElement("inventory");
|
||||||
|
|
||||||
|
// Recharge headset batteries
|
||||||
|
var headset = c.Inventory.FindItemByIdentifier("headset");
|
||||||
|
if (headset != null)
|
||||||
|
{
|
||||||
|
var battery = headset.OwnInventory.FindItemByTag("loadable");
|
||||||
|
if (battery != null)
|
||||||
|
{
|
||||||
|
battery.Condition = battery.MaxCondition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c.SaveInventory(c.Inventory, inventoryElement);
|
c.SaveInventory(c.Inventory, inventoryElement);
|
||||||
c.Info.InventoryData = inventoryElement;
|
c.Info.InventoryData = inventoryElement;
|
||||||
c.Inventory?.DeleteAllItems();
|
c.Inventory?.DeleteAllItems();
|
||||||
|
|||||||
@@ -620,6 +620,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (DraggingItemToWorld &&
|
if (DraggingItemToWorld &&
|
||||||
Character.Controlled.FocusedItem?.OwnInventory != null &&
|
Character.Controlled.FocusedItem?.OwnInventory != null &&
|
||||||
|
Character.Controlled.FocusedItem.OwnInventory.CanBePut(draggingItem) &&
|
||||||
Character.Controlled.FocusedItem.OwnInventory.TryPutItem(draggingItem, Character.Controlled))
|
Character.Controlled.FocusedItem.OwnInventory.TryPutItem(draggingItem, Character.Controlled))
|
||||||
{
|
{
|
||||||
GUI.PlayUISound(GUISoundType.PickItem);
|
GUI.PlayUISound(GUISoundType.PickItem);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace Barotrauma
|
|||||||
center.Y -= center.Y % Submarine.GridSize.Y;
|
center.Y -= center.Y % Submarine.GridSize.Y;
|
||||||
|
|
||||||
MapEntity.SelectedList.Clear();
|
MapEntity.SelectedList.Clear();
|
||||||
MapEntity.SelectedList.AddRange(assemblyEntities);
|
assemblyEntities.ForEach(e => MapEntity.AddSelection(e));
|
||||||
|
|
||||||
foreach (MapEntity mapEntity in assemblyEntities)
|
foreach (MapEntity mapEntity in assemblyEntities)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -142,24 +142,27 @@ namespace Barotrauma
|
|||||||
backgroundPos.Y = -backgroundPos.Y;
|
backgroundPos.Y = -backgroundPos.Y;
|
||||||
backgroundPos *= 0.05f;
|
backgroundPos *= 0.05f;
|
||||||
|
|
||||||
|
if (level.GenerationParams.BackgroundTopSprite != null)
|
||||||
if (backgroundPos.Y < 1024)
|
|
||||||
{
|
{
|
||||||
if (backgroundPos.Y < 0 && level.GenerationParams.BackgroundTopSprite != null)
|
int backgroundSize = (int)level.GenerationParams.BackgroundTopSprite.size.Y;
|
||||||
|
if (backgroundPos.Y < backgroundSize)
|
||||||
{
|
{
|
||||||
var backgroundTop = level.GenerationParams.BackgroundTopSprite;
|
if (backgroundPos.Y < 0)
|
||||||
backgroundTop.SourceRect = new Rectangle((int)backgroundPos.X, (int)backgroundPos.Y, 1024, (int)Math.Min(-backgroundPos.Y, 1024));
|
{
|
||||||
backgroundTop.DrawTiled(spriteBatch, Vector2.Zero, new Vector2(GameMain.GraphicsWidth, Math.Min(-backgroundPos.Y, GameMain.GraphicsHeight)),
|
var backgroundTop = level.GenerationParams.BackgroundTopSprite;
|
||||||
color: level.BackgroundTextureColor);
|
backgroundTop.SourceRect = new Rectangle((int)backgroundPos.X, (int)backgroundPos.Y, backgroundSize, (int)Math.Min(-backgroundPos.Y, backgroundSize));
|
||||||
}
|
backgroundTop.DrawTiled(spriteBatch, Vector2.Zero, new Vector2(GameMain.GraphicsWidth, Math.Min(-backgroundPos.Y, GameMain.GraphicsHeight)),
|
||||||
if (backgroundPos.Y > -1024 && level.GenerationParams.BackgroundSprite != null)
|
color: level.BackgroundTextureColor);
|
||||||
{
|
}
|
||||||
var background = level.GenerationParams.BackgroundSprite;
|
if (-backgroundPos.Y < GameMain.GraphicsHeight && level.GenerationParams.BackgroundSprite != null)
|
||||||
background.SourceRect = new Rectangle((int)backgroundPos.X, (int)Math.Max(backgroundPos.Y, 0), 1024, 1024);
|
{
|
||||||
background.DrawTiled(spriteBatch,
|
var background = level.GenerationParams.BackgroundSprite;
|
||||||
(backgroundPos.Y < 0) ? new Vector2(0.0f, (int)-backgroundPos.Y) : Vector2.Zero,
|
background.SourceRect = new Rectangle((int)backgroundPos.X, (int)Math.Max(backgroundPos.Y, 0), backgroundSize, backgroundSize);
|
||||||
new Vector2(GameMain.GraphicsWidth, (int)Math.Ceiling(1024 - backgroundPos.Y)),
|
background.DrawTiled(spriteBatch,
|
||||||
color: level.BackgroundTextureColor);
|
(backgroundPos.Y < 0) ? new Vector2(0.0f, (int)-backgroundPos.Y) : Vector2.Zero,
|
||||||
|
new Vector2(GameMain.GraphicsWidth, (int)Math.Min(Math.Ceiling(backgroundSize - backgroundPos.Y), backgroundSize)),
|
||||||
|
color: level.BackgroundTextureColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -482,6 +482,60 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void AddSelection(MapEntity entity)
|
||||||
|
{
|
||||||
|
if (selectedList.Contains(entity)) { return; }
|
||||||
|
selectedList.Add(entity);
|
||||||
|
HandleDoorGapLinks(entity,
|
||||||
|
onGapFound: (door, gap) =>
|
||||||
|
{
|
||||||
|
door.RefreshLinkedGap();
|
||||||
|
if (!selectedList.Contains(gap))
|
||||||
|
{
|
||||||
|
selectedList.Add(gap);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onDoorFound: (door, gap) =>
|
||||||
|
{
|
||||||
|
if (!selectedList.Contains(door.Item))
|
||||||
|
{
|
||||||
|
selectedList.Add(door.Item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void HandleDoorGapLinks(MapEntity entity, Action<Door, Gap> onGapFound, Action<Door, Gap> onDoorFound)
|
||||||
|
{
|
||||||
|
if (entity is Item i)
|
||||||
|
{
|
||||||
|
var door = i.GetComponent<Door>();
|
||||||
|
if (door != null)
|
||||||
|
{
|
||||||
|
var gap = door.LinkedGap;
|
||||||
|
if (gap != null)
|
||||||
|
{
|
||||||
|
onGapFound(door, gap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (entity is Gap gap)
|
||||||
|
{
|
||||||
|
var door = gap.ConnectedDoor;
|
||||||
|
if (door != null)
|
||||||
|
{
|
||||||
|
onDoorFound(door, gap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveSelection(MapEntity entity)
|
||||||
|
{
|
||||||
|
selectedList.Remove(entity);
|
||||||
|
HandleDoorGapLinks(entity,
|
||||||
|
onGapFound: (door, gap) => selectedList.Remove(gap),
|
||||||
|
onDoorFound: (door, gap) => selectedList.Remove(door.Item));
|
||||||
|
}
|
||||||
|
|
||||||
static partial void UpdateAllProjSpecific(float deltaTime)
|
static partial void UpdateAllProjSpecific(float deltaTime)
|
||||||
{
|
{
|
||||||
@@ -554,7 +608,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (editingHUD != null)
|
if (editingHUD != null)
|
||||||
{
|
{
|
||||||
if (selectedList.Count == 0 || editingHUD.UserData != selectedList[0])
|
if (FilteredSelectedList.Count == 0 || editingHUD.UserData != FilteredSelectedList[0])
|
||||||
{
|
{
|
||||||
foreach (GUIComponent component in editingHUD.Children)
|
foreach (GUIComponent component in editingHUD.Children)
|
||||||
{
|
{
|
||||||
@@ -565,59 +619,6 @@ namespace Barotrauma
|
|||||||
editingHUD = null;
|
editingHUD = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedList.Count == 0) return;
|
|
||||||
|
|
||||||
if (editingHUD != null)
|
|
||||||
{
|
|
||||||
selectedList[0].UpdateEditing(cam);
|
|
||||||
if (selectedList[0].ResizeHorizontal || selectedList[0].ResizeVertical)
|
|
||||||
{
|
|
||||||
foreach (GUIComponent component in editingHUD.Children)
|
|
||||||
{
|
|
||||||
var textBox = component as GUITextBox;
|
|
||||||
if (textBox == null) continue;
|
|
||||||
textBox.Deselect();
|
|
||||||
}
|
|
||||||
editingHUD = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((PlayerInput.KeyDown(Keys.LeftControl) || PlayerInput.KeyDown(Keys.RightControl)))
|
|
||||||
{
|
|
||||||
if (PlayerInput.KeyHit(Keys.N))
|
|
||||||
{
|
|
||||||
float minX = selectedList[0].WorldRect.X, maxX = selectedList[0].WorldRect.Right;
|
|
||||||
for (int i = 0; i < selectedList.Count; i++)
|
|
||||||
{
|
|
||||||
minX = Math.Min(minX, selectedList[i].WorldRect.X);
|
|
||||||
maxX = Math.Max(maxX, selectedList[i].WorldRect.Right);
|
|
||||||
}
|
|
||||||
|
|
||||||
float centerX = (minX + maxX) / 2.0f;
|
|
||||||
foreach (MapEntity me in selectedList)
|
|
||||||
{
|
|
||||||
me.FlipX(false);
|
|
||||||
me.Move(new Vector2((centerX - me.WorldPosition.X) * 2.0f, 0.0f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (PlayerInput.KeyHit(Keys.M))
|
|
||||||
{
|
|
||||||
float minY = selectedList[0].WorldRect.Y - selectedList[0].WorldRect.Height, maxY = selectedList[0].WorldRect.Y;
|
|
||||||
for (int i = 0; i < selectedList.Count; i++)
|
|
||||||
{
|
|
||||||
minY = Math.Min(minY, selectedList[i].WorldRect.Y - selectedList[i].WorldRect.Height);
|
|
||||||
maxY = Math.Max(maxY, selectedList[i].WorldRect.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
float centerY = (minY + maxY) / 2.0f;
|
|
||||||
foreach (MapEntity me in selectedList)
|
|
||||||
{
|
|
||||||
me.FlipY(false);
|
|
||||||
me.Move(new Vector2(0.0f, (centerY - me.WorldPosition.Y) * 2.0f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FilteredSelectedList.Clear();
|
FilteredSelectedList.Clear();
|
||||||
if (selectedList.Count == 0) return;
|
if (selectedList.Count == 0) return;
|
||||||
foreach (var e in selectedList)
|
foreach (var e in selectedList)
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
iconSize = (int)(iconSize * 1.5f);
|
iconSize = (int)(iconSize * 1.5f);
|
||||||
}
|
}
|
||||||
|
if (Stairs != null)
|
||||||
|
{
|
||||||
|
iconSize = (int)(iconSize * 1.5f);
|
||||||
|
}
|
||||||
|
|
||||||
spriteBatch.Draw(iconTexture,
|
spriteBatch.Draw(iconTexture,
|
||||||
new Rectangle((int)(drawPos.X - iconSize / 2), (int)(drawPos.Y - iconSize / 2), iconSize, iconSize),
|
new Rectangle((int)(drawPos.X - iconSize / 2), (int)(drawPos.Y - iconSize / 2), iconSize, iconSize),
|
||||||
@@ -93,7 +97,7 @@ namespace Barotrauma
|
|||||||
editingHUD = CreateEditingHUD();
|
editingHUD = CreateEditingHUD();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerInput.LeftButtonClicked())
|
if (IsSelected && PlayerInput.LeftButtonClicked())
|
||||||
{
|
{
|
||||||
Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition);
|
Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition);
|
||||||
|
|
||||||
@@ -149,6 +153,23 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateLinkedEntity<T>(Vector2 worldPos, IEnumerable<T> list, Action<T> match, Action<T> noMatch, int inflate = 0) where T : MapEntity
|
||||||
|
{
|
||||||
|
foreach (var entity in list)
|
||||||
|
{
|
||||||
|
var rect = entity.WorldRect;
|
||||||
|
rect.Inflate(inflate, inflate);
|
||||||
|
if (Submarine.RectContains(rect, worldPos))
|
||||||
|
{
|
||||||
|
match(entity);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
noMatch(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool ChangeSpawnType(GUIButton button, object obj)
|
private bool ChangeSpawnType(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
GUITextBlock spawnTypeText = button.Parent.GetChildByUserData("spawntypetext") as GUITextBlock;
|
GUITextBlock spawnTypeText = button.Parent.GetChildByUserData("spawntypetext") as GUITextBlock;
|
||||||
|
|||||||
@@ -2047,13 +2047,15 @@ namespace Barotrauma.Networking
|
|||||||
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
|
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetupNewCampaign(Submarine sub, string savePath, string mapSeed)
|
public void SetupNewCampaign(Submarine sub, string saveName, string mapSeed)
|
||||||
{
|
{
|
||||||
|
saveName = Path.GetFileNameWithoutExtension(saveName);
|
||||||
|
|
||||||
NetOutgoingMessage msg = client.CreateMessage();
|
NetOutgoingMessage msg = client.CreateMessage();
|
||||||
msg.Write((byte)ClientPacketHeader.CAMPAIGN_SETUP_INFO);
|
msg.Write((byte)ClientPacketHeader.CAMPAIGN_SETUP_INFO);
|
||||||
|
|
||||||
msg.Write(true); msg.WritePadBits();
|
msg.Write(true); msg.WritePadBits();
|
||||||
msg.Write(savePath);
|
msg.Write(saveName);
|
||||||
msg.Write(mapSeed);
|
msg.Write(mapSeed);
|
||||||
msg.Write(sub.Name);
|
msg.Write(sub.Name);
|
||||||
msg.Write(sub.MD5Hash.Hash);
|
msg.Write(sub.MD5Hash.Hash);
|
||||||
|
|||||||
@@ -590,12 +590,19 @@ namespace Barotrauma.Steam
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Publishing workshop item " + item.Title + " failed. " + item.Error);
|
DebugConsole.NewMessage("Publishing workshop item " + item.Title + " failed. " + item.Error, Microsoft.Xna.Framework.Color.Red);
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveUtil.ClearFolder(WorkshopItemStagingFolder);
|
SaveUtil.ClearFolder(WorkshopItemStagingFolder);
|
||||||
Directory.Delete(WorkshopItemStagingFolder);
|
|
||||||
File.Delete(PreviewImageName);
|
File.Delete(PreviewImageName);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.Delete(WorkshopItemStagingFolder);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Failed to delete Workshop item staging folder.", e);
|
||||||
|
}
|
||||||
|
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
}
|
}
|
||||||
@@ -927,28 +934,50 @@ namespace Barotrauma.Steam
|
|||||||
{
|
{
|
||||||
if (instance == null || !instance.isInitialized) { return false; }
|
if (instance == null || !instance.isInitialized) { return false; }
|
||||||
|
|
||||||
bool itemsUpdated = false;
|
bool? itemsUpdated = null;
|
||||||
foreach (ulong subscribedItemId in instance.client.Workshop.GetSubscribedItemIds())
|
bool timedOut = false;
|
||||||
|
var query = instance.client.Workshop.CreateQuery();
|
||||||
|
query.FileId = new List<ulong>(instance.client.Workshop.GetSubscribedItemIds());
|
||||||
|
query.UploaderAppId = AppID;
|
||||||
|
query.Run();
|
||||||
|
query.OnResult = (Workshop.Query q) =>
|
||||||
{
|
{
|
||||||
//TODO: fix this, GetItem doesn't query item.Modified
|
if (timedOut) { return; }
|
||||||
var item = instance.client.Workshop.GetItem(subscribedItemId);
|
itemsUpdated = false;
|
||||||
if (item.Installed && CheckWorkshopItemEnabled(item) && !CheckWorkshopItemUpToDate(item))
|
foreach (var item in q.Items)
|
||||||
{
|
{
|
||||||
if (!UpdateWorkshopItem(item, out string errorMsg))
|
if (item.Installed && CheckWorkshopItemEnabled(item) && !CheckWorkshopItemUpToDate(item))
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError(errorMsg);
|
if (!UpdateWorkshopItem(item, out string errorMsg))
|
||||||
new GUIMessageBox(
|
{
|
||||||
TextManager.Get("Error"),
|
DebugConsole.ThrowError(errorMsg);
|
||||||
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, errorMsg }));
|
new GUIMessageBox(
|
||||||
}
|
TextManager.Get("Error"),
|
||||||
else
|
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, errorMsg }));
|
||||||
{
|
}
|
||||||
new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", item.Title));
|
else
|
||||||
itemsUpdated = true;
|
{
|
||||||
|
new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", item.Title));
|
||||||
|
itemsUpdated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
DateTime timeOut = DateTime.Now + new TimeSpan(0, 0, 10);
|
||||||
|
while (!itemsUpdated.HasValue)
|
||||||
|
{
|
||||||
|
if (DateTime.Now > timeOut)
|
||||||
|
{
|
||||||
|
itemsUpdated = false;
|
||||||
|
timedOut = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
instance.client.Update();
|
||||||
|
System.Threading.Thread.Sleep(10);
|
||||||
}
|
}
|
||||||
return itemsUpdated;
|
|
||||||
|
return itemsUpdated.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool UpdateWorkshopItem(Workshop.Item item, out string errorMsg)
|
public static bool UpdateWorkshopItem(Workshop.Item item, out string errorMsg)
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
localEnabled = box.Selected;
|
localEnabled = box.Selected;
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -145,16 +146,12 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
if (obj is WhiteListedPlayer)
|
if (obj is WhiteListedPlayer)
|
||||||
{
|
{
|
||||||
WhiteListedPlayer wlp = obj as WhiteListedPlayer;
|
if (!(obj is WhiteListedPlayer wlp)) return false;
|
||||||
if (wlp == null) return false;
|
|
||||||
|
|
||||||
if (!localRemoved.Contains(wlp.UniqueIdentifier)) localRemoved.Add(wlp.UniqueIdentifier);
|
if (!localRemoved.Contains(wlp.UniqueIdentifier)) localRemoved.Add(wlp.UniqueIdentifier);
|
||||||
}
|
}
|
||||||
else if (obj is LocalAdded)
|
else if (obj is LocalAdded)
|
||||||
{
|
{
|
||||||
LocalAdded lad = obj as LocalAdded;
|
if (!(obj is LocalAdded lad)) return false;
|
||||||
if (lad == null) return false;
|
|
||||||
|
|
||||||
if (localAdded.Contains(lad)) localAdded.Remove(lad);
|
if (localAdded.Contains(lad)) localAdded.Remove(lad);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +207,6 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
ip = "IP concealed by host";
|
ip = "IP concealed by host";
|
||||||
}
|
}
|
||||||
DebugConsole.NewMessage("nerd: " + name, Color.Lime);
|
|
||||||
whitelistedPlayers.Add(new WhiteListedPlayer(name, uniqueIdentifier, ip));
|
whitelistedPlayers.Add(new WhiteListedPlayer(name, uniqueIdentifier, ip));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -441,38 +441,44 @@ namespace Barotrauma
|
|||||||
characterPreviewFrame = null;
|
characterPreviewFrame = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Campaign is SinglePlayerCampaign)
|
if (characterList != null)
|
||||||
{
|
{
|
||||||
var hireableCharacters = location.GetHireableCharacters();
|
if (Campaign is SinglePlayerCampaign)
|
||||||
foreach (GUIComponent child in characterList.Content.Children.ToList())
|
|
||||||
{
|
{
|
||||||
if (child.UserData is CharacterInfo character)
|
var hireableCharacters = location.GetHireableCharacters();
|
||||||
|
foreach (GUIComponent child in characterList.Content.Children.ToList())
|
||||||
{
|
{
|
||||||
if (GameMain.GameSession.CrewManager.GetCharacterInfos().Contains(character)) { continue; }
|
if (child.UserData is CharacterInfo character)
|
||||||
|
{
|
||||||
|
if (GameMain.GameSession.CrewManager != null)
|
||||||
|
{
|
||||||
|
if (GameMain.GameSession.CrewManager.GetCharacterInfos().Contains(character)) { continue; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (child.UserData as string == "mycrew" || child.UserData as string == "hire")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
characterList.RemoveChild(child);
|
||||||
}
|
}
|
||||||
else if (child.UserData as string == "mycrew" || child.UserData as string == "hire")
|
if (!hireableCharacters.Any())
|
||||||
{
|
{
|
||||||
continue;
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), characterList.Content.RectTransform), TextManager.Get("HireUnavailable"), textAlignment: Alignment.Center)
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
}
|
}
|
||||||
characterList.RemoveChild(child);
|
else
|
||||||
}
|
|
||||||
if (!hireableCharacters.Any())
|
|
||||||
{
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), characterList.Content.RectTransform), TextManager.Get("HireUnavailable"), textAlignment: Alignment.Center)
|
|
||||||
{
|
{
|
||||||
CanBeFocused = false
|
foreach (CharacterInfo c in hireableCharacters)
|
||||||
};
|
{
|
||||||
}
|
var frame = c.CreateCharacterFrame(characterList.Content, c.Name + " (" + c.Job.Name + ")", c);
|
||||||
else
|
new GUITextBlock(new RectTransform(Vector2.One, frame.RectTransform, Anchor.TopRight), c.Salary.ToString(), textAlignment: Alignment.CenterRight);
|
||||||
{
|
}
|
||||||
foreach (CharacterInfo c in hireableCharacters)
|
|
||||||
{
|
|
||||||
var frame = c.CreateCharacterFrame(characterList.Content, c.Name + " (" + c.Job.Name + ")", c);
|
|
||||||
new GUITextBlock(new RectTransform(Vector2.One, frame.RectTransform, Anchor.TopRight), c.Salary.ToString(), textAlignment: Alignment.CenterRight);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
characterList.UpdateScrollBarSize();
|
||||||
}
|
}
|
||||||
characterList.UpdateScrollBarSize();
|
|
||||||
|
|
||||||
RefreshMyItems();
|
RefreshMyItems();
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
class MainMenuScreen : Screen
|
class MainMenuScreen : Screen
|
||||||
{
|
{
|
||||||
public enum Tab { NewGame = 1, LoadGame = 2, HostServer = 3, Settings = 4, Tutorials = 5, JoinServer = 6, CharacterEditor = 7, SubmarineEditor = 8, QuickStartDev = 9, SteamWorkshop = 10, Credits = 11 }
|
public enum Tab { NewGame = 1, LoadGame = 2, HostServer = 3, Settings = 4, Tutorials = 5, JoinServer = 6, CharacterEditor = 7, SubmarineEditor = 8, QuickStartDev = 9, SteamWorkshop = 10, Credits = 11, Empty = 12 }
|
||||||
|
|
||||||
private GUIComponent buttonsParent;
|
private GUIComponent buttonsParent;
|
||||||
|
|
||||||
@@ -37,7 +37,11 @@ namespace Barotrauma
|
|||||||
private GUIComponent titleText;
|
private GUIComponent titleText;
|
||||||
|
|
||||||
private CreditsPlayer creditsPlayer;
|
private CreditsPlayer creditsPlayer;
|
||||||
|
|
||||||
|
#if OSX
|
||||||
|
private bool firstLoadOnMac = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
#region Creation
|
#region Creation
|
||||||
public MainMenuScreen(GameMain game)
|
public MainMenuScreen(GameMain game)
|
||||||
{
|
{
|
||||||
@@ -360,9 +364,9 @@ namespace Barotrauma
|
|||||||
OnClicked = SelectTab
|
OnClicked = SelectTab
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Selection
|
#region Selection
|
||||||
public override void Select()
|
public override void Select()
|
||||||
{
|
{
|
||||||
base.Select();
|
base.Select();
|
||||||
@@ -378,6 +382,25 @@ namespace Barotrauma
|
|||||||
ResetButtonStates(null);
|
ResetButtonStates(null);
|
||||||
|
|
||||||
GameAnalyticsManager.SetCustomDimension01("");
|
GameAnalyticsManager.SetCustomDimension01("");
|
||||||
|
|
||||||
|
#if OSX
|
||||||
|
// Hack for adjusting the viewport properly after splash screens on older Macs
|
||||||
|
if (firstLoadOnMac)
|
||||||
|
{
|
||||||
|
firstLoadOnMac = false;
|
||||||
|
|
||||||
|
menuTabs[(int)Tab.Empty] = new GUIFrame(new RectTransform(new Vector2(1f, 1f), GUI.Canvas), "", Color.Transparent)
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
var emptyList = new GUIListBox(new RectTransform(new Vector2(0.0f, 0.0f), menuTabs[(int)Tab.Empty].RectTransform))
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
|
||||||
|
SelectTab(null, Tab.Empty);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Deselect()
|
public override void Deselect()
|
||||||
@@ -701,7 +724,14 @@ namespace Barotrauma
|
|||||||
GameMain.NetLobbyScreen = new NetLobbyScreen();
|
GameMain.NetLobbyScreen = new NetLobbyScreen();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int ownerKey = Math.Max(CryptoRandom.Instance.Next(),1);
|
string exeName = ContentPackage.GetFilesOfType(GameMain.Config.SelectedContentPackages, ContentType.ServerExecutable)?.FirstOrDefault();
|
||||||
|
if (string.IsNullOrEmpty(exeName))
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("No server executable defined in the selected content packages. Attempting to use the default executable...");
|
||||||
|
exeName = "DedicatedServer.exe";
|
||||||
|
}
|
||||||
|
|
||||||
|
int ownerKey = Math.Max(CryptoRandom.Instance.Next(), 1);
|
||||||
|
|
||||||
string arguments = "-name \"" + name.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\"" +
|
string arguments = "-name \"" + name.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\"" +
|
||||||
" -port " + port.ToString() +
|
" -port " + port.ToString() +
|
||||||
@@ -711,16 +741,15 @@ namespace Barotrauma
|
|||||||
" -maxplayers " + maxPlayersBox.Text +
|
" -maxplayers " + maxPlayersBox.Text +
|
||||||
" -ownerkey " + ownerKey.ToString();
|
" -ownerkey " + ownerKey.ToString();
|
||||||
|
|
||||||
string filename = "DedicatedServer.exe";
|
string filename = exeName;
|
||||||
#if LINUX || OSX
|
#if LINUX || OSX
|
||||||
filename = "./DedicatedServer";
|
filename = "./" + Path.GetFileNameWithoutExtension(exeName);
|
||||||
#endif
|
#endif
|
||||||
var processInfo = new ProcessStartInfo
|
var processInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = filename,
|
FileName = filename,
|
||||||
Arguments = arguments
|
Arguments = arguments,
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
,
|
|
||||||
WindowStyle = ProcessWindowStyle.Hidden
|
WindowStyle = ProcessWindowStyle.Hidden
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -925,7 +954,11 @@ namespace Barotrauma
|
|||||||
new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("HostServerButton"), textAlignment: Alignment.Center, font: GUI.LargeFont) { ForceUpperCase = true };
|
new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("HostServerButton"), textAlignment: Alignment.Center, font: GUI.LargeFont) { ForceUpperCase = true };
|
||||||
|
|
||||||
var label = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("ServerName"), textAlignment: textAlignment);
|
var label = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("ServerName"), textAlignment: textAlignment);
|
||||||
serverNameBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment);
|
serverNameBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment)
|
||||||
|
{
|
||||||
|
MaxTextLength = NetConfig.ServerNameMaxLength,
|
||||||
|
OverflowClip = true
|
||||||
|
};
|
||||||
|
|
||||||
label = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("ServerPort"), textAlignment: textAlignment);
|
label = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("ServerPort"), textAlignment: textAlignment);
|
||||||
portBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment)
|
portBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment)
|
||||||
|
|||||||
@@ -335,8 +335,12 @@ namespace Barotrauma
|
|||||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.03f), rightInfoColumn.RectTransform), style: null);
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.03f), rightInfoColumn.RectTransform), style: null);
|
||||||
|
|
||||||
//server info ------------------------------------------------------------------
|
//server info ------------------------------------------------------------------
|
||||||
|
|
||||||
ServerName = new GUITextBox(new RectTransform(new Vector2(0.3f, 0.05f), infoFrameContent.RectTransform));
|
ServerName = new GUITextBox(new RectTransform(new Vector2(infoColumnContainer.RectTransform.RelativeSize.X, 0.05f), infoFrameContent.RectTransform))
|
||||||
|
{
|
||||||
|
MaxTextLength = NetConfig.ServerNameMaxLength,
|
||||||
|
OverflowClip = true
|
||||||
|
};
|
||||||
ServerName.OnDeselected += (textBox, key) =>
|
ServerName.OnDeselected += (textBox, key) =>
|
||||||
{
|
{
|
||||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Name);
|
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Name);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
tabs = new GUIFrame[Enum.GetValues(typeof(Tab)).Length];
|
tabs = new GUIFrame[Enum.GetValues(typeof(Tab)).Length];
|
||||||
|
|
||||||
menu = new GUIFrame(new RectTransform(new Vector2(0.6f, 0.8f), GUI.Canvas, Anchor.Center) { MinSize = new Point(GameMain.GraphicsHeight, 0) });
|
menu = new GUIFrame(new RectTransform(new Vector2(0.85f, 0.8f), GUI.Canvas, Anchor.Center) { MinSize = new Point(GameMain.GraphicsHeight, 0) });
|
||||||
|
|
||||||
var container = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.85f), menu.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, 0.05f) }) { Stretch = true };
|
var container = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.85f), menu.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, 0.05f) }) { Stretch = true };
|
||||||
|
|
||||||
@@ -394,6 +394,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
IsHorizontal = true,
|
IsHorizontal = true,
|
||||||
Stretch = true,
|
Stretch = true,
|
||||||
|
RelativeSpacing = 0.05f,
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -405,32 +406,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (item.Installed)
|
if (item.Installed)
|
||||||
{
|
{
|
||||||
if (listBox != publishedItemList && SteamManager.CheckWorkshopItemEnabled(item) && !SteamManager.CheckWorkshopItemUpToDate(item))
|
|
||||||
{
|
|
||||||
new GUIButton(new RectTransform(new Vector2(0.4f, 0.5f), rightColumn.RectTransform, Anchor.BottomLeft), text: "Update")
|
|
||||||
{
|
|
||||||
UserData = "updatebutton",
|
|
||||||
IgnoreLayoutGroups = true,
|
|
||||||
OnClicked = (btn, userdata) =>
|
|
||||||
{
|
|
||||||
if (SteamManager.UpdateWorkshopItem(item, out string errorMsg))
|
|
||||||
{
|
|
||||||
new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", TextManager.EnsureUTF8(item.Title)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError(errorMsg);
|
|
||||||
new GUIMessageBox(
|
|
||||||
TextManager.Get("Error"),
|
|
||||||
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { TextManager.EnsureUTF8(item.Title), errorMsg }));
|
|
||||||
}
|
|
||||||
btn.Enabled = false;
|
|
||||||
btn.Visible = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
GUITickBox enabledTickBox = null;
|
GUITickBox enabledTickBox = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -476,6 +451,33 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (listBox != publishedItemList && SteamManager.CheckWorkshopItemEnabled(item) && !SteamManager.CheckWorkshopItemUpToDate(item))
|
||||||
|
{
|
||||||
|
new GUIButton(new RectTransform(new Vector2(0.4f, 0.5f), rightColumn.RectTransform, Anchor.BottomLeft), text: TextManager.Get("WorkshopItemUpdate"))
|
||||||
|
{
|
||||||
|
UserData = "updatebutton",
|
||||||
|
Font = GUI.SmallFont,
|
||||||
|
OnClicked = (btn, userdata) =>
|
||||||
|
{
|
||||||
|
if (SteamManager.UpdateWorkshopItem(item, out string errorMsg))
|
||||||
|
{
|
||||||
|
new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", TextManager.EnsureUTF8(item.Title)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError(errorMsg);
|
||||||
|
new GUIMessageBox(
|
||||||
|
TextManager.Get("Error"),
|
||||||
|
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { TextManager.EnsureUTF8(item.Title), errorMsg }));
|
||||||
|
}
|
||||||
|
btn.Enabled = false;
|
||||||
|
btn.Visible = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (item.Downloading)
|
else if (item.Downloading)
|
||||||
{
|
{
|
||||||
@@ -746,7 +748,7 @@ namespace Barotrauma
|
|||||||
for (int i = 0; i < item.Tags.Length && i < 5; i++)
|
for (int i = 0; i < item.Tags.Length && i < 5; i++)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(item.Tags[i])) { continue; }
|
if (string.IsNullOrEmpty(item.Tags[i])) { continue; }
|
||||||
string tag = TextManager.Get("Workshop.ContentTag." + item.Tags[i], true);
|
string tag = TextManager.Get("Workshop.ContentTag." + item.Tags[i].Replace(" ", ""), true);
|
||||||
if (string.IsNullOrEmpty(tag)) { tag = item.Tags[i].CapitaliseFirstInvariant(); }
|
if (string.IsNullOrEmpty(tag)) { tag = item.Tags[i].CapitaliseFirstInvariant(); }
|
||||||
tags.Add(tag);
|
tags.Add(tag);
|
||||||
}
|
}
|
||||||
@@ -900,7 +902,7 @@ namespace Barotrauma
|
|||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), topRightColumn.RectTransform), TextManager.Get("WorkshopItemDescription"));
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), topRightColumn.RectTransform), TextManager.Get("WorkshopItemDescription"));
|
||||||
|
|
||||||
var descriptionContainer = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.4f), topRightColumn.RectTransform));
|
var descriptionContainer = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.4f), topRightColumn.RectTransform));
|
||||||
var descriptionBox = new GUITextBox(new RectTransform(Vector2.One, descriptionContainer.Content.RectTransform), itemEditor.Description, textAlignment: Alignment.TopLeft, wrap: true);
|
var descriptionBox = new GUITextBox(new RectTransform(Vector2.One, descriptionContainer.Content.RectTransform), itemEditor.Description, textAlignment: Alignment.TopLeft, font: GUI.SmallFont, wrap: true);
|
||||||
descriptionBox.OnTextChanged += (textBox, text) =>
|
descriptionBox.OnTextChanged += (textBox, text) =>
|
||||||
{
|
{
|
||||||
Vector2 textSize = textBox.Font.MeasureString(descriptionBox.WrappedText);
|
Vector2 textSize = textBox.Font.MeasureString(descriptionBox.WrappedText);
|
||||||
@@ -1081,6 +1083,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
InitialDirectory = Path.GetFullPath(SteamManager.WorkshopItemStagingFolder),
|
InitialDirectory = Path.GetFullPath(SteamManager.WorkshopItemStagingFolder),
|
||||||
Title = TextManager.Get("workshopitemaddfiles"),
|
Title = TextManager.Get("workshopitemaddfiles"),
|
||||||
|
Multiselect = true
|
||||||
};
|
};
|
||||||
if (ofd.ShowDialog() == DialogResult.OK)
|
if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
@@ -1228,7 +1231,7 @@ namespace Barotrauma
|
|||||||
private void OnAddFilesSelected(string[] fileNames)
|
private void OnAddFilesSelected(string[] fileNames)
|
||||||
{
|
{
|
||||||
if (fileNames == null) { return; }
|
if (fileNames == null) { return; }
|
||||||
for(int i = 0; i < fileNames.Length; i++)
|
for (int i = 0; i < fileNames.Length; i++)
|
||||||
{
|
{
|
||||||
string file = fileNames[i];
|
string file = fileNames[i];
|
||||||
if (string.IsNullOrEmpty(file)) { continue; }
|
if (string.IsNullOrEmpty(file)) { continue; }
|
||||||
@@ -1258,6 +1261,7 @@ namespace Barotrauma
|
|||||||
itemContentPackage.AddFile(filePathRelativeToStagingFolder, ContentType.None);
|
itemContentPackage.AddFile(filePathRelativeToStagingFolder, ContentType.None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
itemContentPackage.Save(itemContentPackage.Path);
|
||||||
RefreshCreateItemFileList();
|
RefreshCreateItemFileList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1331,6 +1335,7 @@ namespace Barotrauma
|
|||||||
OnClicked = (btn, userdata) =>
|
OnClicked = (btn, userdata) =>
|
||||||
{
|
{
|
||||||
itemContentPackage.RemoveFile(contentFile);
|
itemContentPackage.RemoveFile(contentFile);
|
||||||
|
itemContentPackage.Save(itemContentPackage.Path);
|
||||||
RefreshCreateItemFileList();
|
RefreshCreateItemFileList();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1346,7 +1351,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (itemContentPackage == null || itemEditor == null) return;
|
if (itemContentPackage == null || itemEditor == null) return;
|
||||||
|
|
||||||
SteamManager.StartPublishItem(itemContentPackage, itemEditor);
|
SteamManager.StartPublishItem(itemContentPackage, itemEditor);
|
||||||
CoroutineManager.StartCoroutine(WaitForPublish(itemEditor), "WaitForPublish");
|
CoroutineManager.StartCoroutine(WaitForPublish(itemEditor), "WaitForPublish");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1381,9 +1386,20 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new GUIMessageBox(
|
string errorMsg = item.ErrorCode.HasValue ?
|
||||||
TextManager.Get("Error"),
|
TextManager.Get("WorkshopPublishError." + item.ErrorCode.Value.ToString(), returnNull: true) :
|
||||||
TextManager.GetWithVariable("WorkshopItemPublishFailed", "[itemname]", TextManager.EnsureUTF8(item.Title)) + item.Error);
|
null;
|
||||||
|
|
||||||
|
if (errorMsg == null)
|
||||||
|
{
|
||||||
|
new GUIMessageBox(
|
||||||
|
TextManager.Get("Error"),
|
||||||
|
TextManager.GetWithVariable("WorkshopItemPublishFailed", "[itemname]", TextManager.EnsureUTF8(item.Title)) + item.Error);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new GUIMessageBox(TextManager.Get("Error"), errorMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createItemFrame.ClearChildren();
|
createItemFrame.ClearChildren();
|
||||||
|
|||||||
@@ -2109,10 +2109,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override void AddToGUIUpdateList()
|
public override void AddToGUIUpdateList()
|
||||||
{
|
{
|
||||||
if (MapEntity.SelectedList.Count == 1)
|
MapEntity.FilteredSelectedList.FirstOrDefault()?.AddToGUIUpdateList();
|
||||||
{
|
|
||||||
MapEntity.SelectedList[0].AddToGUIUpdateList();
|
|
||||||
}
|
|
||||||
if (MapEntity.HighlightedListBox != null)
|
if (MapEntity.HighlightedListBox != null)
|
||||||
{
|
{
|
||||||
MapEntity.HighlightedListBox.AddToGUIUpdateList();
|
MapEntity.HighlightedListBox.AddToGUIUpdateList();
|
||||||
@@ -2293,9 +2290,9 @@ namespace Barotrauma
|
|||||||
dummyCharacter.SelectedConstruction = null;
|
dummyCharacter.SelectedConstruction = null;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
else if (MapEntity.SelectedList.Count == 1)
|
else if (MapEntity.FilteredSelectedList.Count == 1)
|
||||||
{
|
{
|
||||||
(MapEntity.SelectedList[0] as Item)?.UpdateHUD(cam, dummyCharacter, (float)deltaTime);
|
(MapEntity.FilteredSelectedList[0] as Item)?.UpdateHUD(cam, dummyCharacter, (float)deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterHUD.Update((float)deltaTime, dummyCharacter, cam);
|
CharacterHUD.Update((float)deltaTime, dummyCharacter, cam);
|
||||||
|
|||||||
@@ -18,34 +18,33 @@ namespace Barotrauma
|
|||||||
public string FileName { get; private set; }
|
public string FileName { get; private set; }
|
||||||
public string[] FileNames { get; private set; }
|
public string[] FileNames { get; private set; }
|
||||||
|
|
||||||
public OpenFileDialog()
|
public OpenFileDialog() { }
|
||||||
{
|
|
||||||
ofd = new System.Windows.Forms.OpenFileDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
public System.Windows.Forms.DialogResult ShowDialog()
|
public System.Windows.Forms.DialogResult ShowDialog()
|
||||||
{
|
{
|
||||||
|
ofd = new System.Windows.Forms.OpenFileDialog();
|
||||||
ofd.Multiselect = Multiselect;
|
ofd.Multiselect = Multiselect;
|
||||||
ofd.InitialDirectory = InitialDirectory;
|
ofd.InitialDirectory = InitialDirectory;
|
||||||
ofd.Filter = Filter;
|
ofd.Filter = Filter;
|
||||||
ofd.Title = Title;
|
ofd.Title = Title;
|
||||||
|
|
||||||
#if LINUX
|
System.Windows.Forms.DialogResult result;
|
||||||
|
#if LINUX || OSX
|
||||||
var wrapperForm = new WrapperForm(ofd);
|
var wrapperForm = new WrapperForm(ofd);
|
||||||
System.Windows.Forms.Application.Run(wrapperForm);
|
System.Windows.Forms.Application.Run(wrapperForm);
|
||||||
System.Windows.Forms.Application.Exit();
|
|
||||||
FileName = wrapperForm.FileName;
|
FileName = wrapperForm.FileName;
|
||||||
FileNames = wrapperForm.FileNames;
|
FileNames = wrapperForm.FileNames;
|
||||||
return wrapperForm.Result;
|
result = wrapperForm.Result;
|
||||||
#else
|
#else
|
||||||
var result = ofd.ShowDialog();
|
result = ofd.ShowDialog();
|
||||||
FileName = ofd.FileName;
|
FileName = ofd.FileName;
|
||||||
FileNames = ofd.FileNames;
|
FileNames = ofd.FileNames;
|
||||||
return result;
|
|
||||||
#endif
|
#endif
|
||||||
|
ofd = null;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LINUX
|
#if LINUX || OSX
|
||||||
private class WrapperForm : System.Windows.Forms.Form
|
private class WrapperForm : System.Windows.Forms.Form
|
||||||
{
|
{
|
||||||
private System.Windows.Forms.OpenFileDialog ofd;
|
private System.Windows.Forms.OpenFileDialog ofd;
|
||||||
@@ -66,7 +65,7 @@ namespace Barotrauma
|
|||||||
FileName = ofd.FileName;
|
FileName = ofd.FileName;
|
||||||
FileNames = ofd.FileNames;
|
FileNames = ofd.FileNames;
|
||||||
System.Threading.Thread.Sleep(100);
|
System.Threading.Thread.Sleep(100);
|
||||||
this.Close();
|
System.Windows.Forms.Application.Exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -90,7 +90,16 @@ namespace Barotrauma
|
|||||||
while (queuedMessages.Count > 0)
|
while (queuedMessages.Count > 0)
|
||||||
{
|
{
|
||||||
ColoredText msg = queuedMessages.Dequeue();
|
ColoredText msg = queuedMessages.Dequeue();
|
||||||
|
if (GameSettings.SaveDebugConsoleLogs)
|
||||||
|
{
|
||||||
|
unsavedMessages.Add(msg);
|
||||||
|
if (unsavedMessages.Count >= messagesPerFile)
|
||||||
|
{
|
||||||
|
SaveLogs();
|
||||||
|
unsavedMessages.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string msgTxt = msg.Text;
|
string msgTxt = msg.Text;
|
||||||
|
|
||||||
if (msg.IsCommand) commandMemory.Add(msgTxt);
|
if (msg.IsCommand) commandMemory.Add(msgTxt);
|
||||||
@@ -167,7 +176,8 @@ namespace Barotrauma
|
|||||||
RewriteInputToCommandLine(input);
|
RewriteInputToCommandLine(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.Yield();
|
//TODO: be more clever about it
|
||||||
|
Thread.Sleep(10); //sleep for 10ms to not pin the CPU super hard
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ThreadAbortException)
|
catch (ThreadAbortException)
|
||||||
|
|||||||
@@ -184,7 +184,8 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
public void UnbanPlayer(string name)
|
public void UnbanPlayer(string name)
|
||||||
{
|
{
|
||||||
var player = bannedPlayers.Find(bp => bp.Name == name);
|
name = name.ToLower();
|
||||||
|
var player = bannedPlayers.Find(bp => bp.Name.ToLower() == name);
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
DebugConsole.Log("Could not unban player \"" + name + "\". Matching player not found.");
|
DebugConsole.Log("Could not unban player \"" + name + "\". Matching player not found.");
|
||||||
|
|||||||
@@ -93,6 +93,10 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
name = name.Replace(":", "");
|
name = name.Replace(":", "");
|
||||||
name = name.Replace(";", "");
|
name = name.Replace(";", "");
|
||||||
|
if (name.Length > NetConfig.ServerNameMaxLength)
|
||||||
|
{
|
||||||
|
name = name.Substring(0, NetConfig.ServerNameMaxLength);
|
||||||
|
}
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
@@ -724,7 +728,7 @@ namespace Barotrauma.Networking
|
|||||||
bool isNew = inc.ReadBoolean(); inc.ReadPadBits();
|
bool isNew = inc.ReadBoolean(); inc.ReadPadBits();
|
||||||
if (isNew)
|
if (isNew)
|
||||||
{
|
{
|
||||||
string savePath = inc.ReadString();
|
string saveName = inc.ReadString();
|
||||||
string seed = inc.ReadString();
|
string seed = inc.ReadString();
|
||||||
string subName = inc.ReadString();
|
string subName = inc.ReadString();
|
||||||
string subHash = inc.ReadString();
|
string subHash = inc.ReadString();
|
||||||
@@ -739,7 +743,11 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (connectedClient.HasPermission(ClientPermissions.SelectMode)) MultiPlayerCampaign.StartNewCampaign(savePath, matchingSub.FilePath, seed);
|
string localSavePath = SaveUtil.CreateSavePath(SaveUtil.SaveType.Multiplayer, saveName);
|
||||||
|
if (connectedClient.HasPermission(ClientPermissions.SelectMode))
|
||||||
|
{
|
||||||
|
MultiPlayerCampaign.StartNewCampaign(localSavePath, matchingSub.FilePath, seed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2182,7 +2190,6 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
public override void UnbanPlayer(string playerName, string playerIP)
|
public override void UnbanPlayer(string playerName, string playerIP)
|
||||||
{
|
{
|
||||||
playerName = playerName.ToLowerInvariant();
|
|
||||||
if (!string.IsNullOrEmpty(playerIP))
|
if (!string.IsNullOrEmpty(playerIP))
|
||||||
{
|
{
|
||||||
serverSettings.BanList.UnbanIP(playerIP);
|
serverSettings.BanList.UnbanIP(playerIP);
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ namespace Barotrauma.Steam
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var contentPackages = GameMain.Config.SelectedContentPackages.Where(cp => cp.HasMultiplayerIncompatibleContent);
|
||||||
|
|
||||||
// These server state variables may be changed at any time. Note that there is no longer a mechanism
|
// These server state variables may be changed at any time. Note that there is no longer a mechanism
|
||||||
// to send the player count. The player count is maintained by steam and you should use the player
|
// to send the player count. The player count is maintained by steam and you should use the player
|
||||||
// creation/authentication functions to maintain your player count.
|
// creation/authentication functions to maintain your player count.
|
||||||
@@ -51,9 +53,9 @@ namespace Barotrauma.Steam
|
|||||||
instance.server.MapName = GameMain.NetLobbyScreen?.SelectedSub?.DisplayName ?? "";
|
instance.server.MapName = GameMain.NetLobbyScreen?.SelectedSub?.DisplayName ?? "";
|
||||||
Instance.server.SetKey("message", GameMain.Server.ServerSettings.ServerMessageText);
|
Instance.server.SetKey("message", GameMain.Server.ServerSettings.ServerMessageText);
|
||||||
Instance.server.SetKey("version", GameMain.Version.ToString());
|
Instance.server.SetKey("version", GameMain.Version.ToString());
|
||||||
Instance.server.SetKey("contentpackage", string.Join(",", GameMain.Config.SelectedContentPackages.Select(cp => cp.Name)));
|
Instance.server.SetKey("contentpackage", string.Join(",", contentPackages.Select(cp => cp.Name)));
|
||||||
Instance.server.SetKey("contentpackagehash", string.Join(",", GameMain.Config.SelectedContentPackages.Select(cp => cp.MD5hash.Hash)));
|
Instance.server.SetKey("contentpackagehash", string.Join(",", contentPackages.Select(cp => cp.MD5hash.Hash)));
|
||||||
Instance.server.SetKey("contentpackageurl", string.Join(",", GameMain.Config.SelectedContentPackages.Select(cp => cp.SteamWorkshopUrl ?? "")));
|
Instance.server.SetKey("contentpackageurl", string.Join(",", contentPackages.Select(cp => cp.SteamWorkshopUrl ?? "")));
|
||||||
Instance.server.SetKey("usingwhitelist", (server.ServerSettings.Whitelist != null && server.ServerSettings.Whitelist.Enabled).ToString());
|
Instance.server.SetKey("usingwhitelist", (server.ServerSettings.Whitelist != null && server.ServerSettings.Whitelist.Enabled).ToString());
|
||||||
Instance.server.SetKey("modeselectionmode", server.ServerSettings.ModeSelectionMode.ToString());
|
Instance.server.SetKey("modeselectionmode", server.ServerSettings.ModeSelectionMode.ToString());
|
||||||
Instance.server.SetKey("subselectionmode", server.ServerSettings.SubSelectionMode.ToString());
|
Instance.server.SetKey("subselectionmode", server.ServerSettings.SubSelectionMode.ToString());
|
||||||
|
|||||||
@@ -25,47 +25,45 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
partial void InitProjSpecific()
|
partial void InitProjSpecific()
|
||||||
{
|
{
|
||||||
if (File.Exists(SavePath))
|
if (!File.Exists(SavePath)) { return; }
|
||||||
|
|
||||||
|
string[] lines;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
string[] lines;
|
lines = File.ReadAllLines(SavePath);
|
||||||
try
|
}
|
||||||
{
|
catch (Exception e)
|
||||||
lines = File.ReadAllLines(SavePath);
|
{
|
||||||
}
|
DebugConsole.ThrowError("Failed to open whitelist in " + SavePath, e);
|
||||||
catch (Exception e)
|
return;
|
||||||
{
|
}
|
||||||
DebugConsole.ThrowError("Failed to open whitelist in " + SavePath, e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (string line in lines)
|
foreach (string line in lines)
|
||||||
|
{
|
||||||
|
if (line[0] == '#')
|
||||||
{
|
{
|
||||||
if (line[0] == '#')
|
string lineval = line.Substring(1, line.Length - 1);
|
||||||
|
Int32.TryParse(lineval, out int intVal);
|
||||||
|
if (lineval.ToLower() == "true" || intVal != 0)
|
||||||
{
|
{
|
||||||
string lineval = line.Substring(1, line.Length - 1);
|
Enabled = true;
|
||||||
int intVal = 0;
|
|
||||||
Int32.TryParse(lineval, out intVal);
|
|
||||||
if (lineval.ToLower() == "true" || intVal != 0)
|
|
||||||
{
|
|
||||||
Enabled = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Enabled = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string[] separatedLine = line.Split(',');
|
Enabled = false;
|
||||||
if (separatedLine.Length < 2) continue;
|
|
||||||
|
|
||||||
string name = String.Join(",", separatedLine.Take(separatedLine.Length - 1));
|
|
||||||
string ip = separatedLine.Last();
|
|
||||||
|
|
||||||
whitelistedPlayers.Add(new WhiteListedPlayer(name, ip));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
string[] separatedLine = line.Split(',');
|
||||||
|
if (separatedLine.Length < 2) continue;
|
||||||
|
|
||||||
|
string name = string.Join(",", separatedLine.Take(separatedLine.Length - 1));
|
||||||
|
string ip = separatedLine.Last();
|
||||||
|
|
||||||
|
whitelistedPlayers.Add(new WhiteListedPlayer(name, ip));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
@@ -119,9 +117,7 @@ namespace Barotrauma.Networking
|
|||||||
private void RemoveFromWhiteList(WhiteListedPlayer wlp)
|
private void RemoveFromWhiteList(WhiteListedPlayer wlp)
|
||||||
{
|
{
|
||||||
GameServer.Log("Removing " + wlp.Name + " from whitelist", ServerLog.MessageType.ServerMessage);
|
GameServer.Log("Removing " + wlp.Name + " from whitelist", ServerLog.MessageType.ServerMessage);
|
||||||
|
|
||||||
whitelistedPlayers.Remove(wlp);
|
whitelistedPlayers.Remove(wlp);
|
||||||
Save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddToWhiteList(string name, string ip)
|
private void AddToWhiteList(string name, string ip)
|
||||||
@@ -129,7 +125,6 @@ namespace Barotrauma.Networking
|
|||||||
if (string.IsNullOrWhiteSpace(name)) return;
|
if (string.IsNullOrWhiteSpace(name)) return;
|
||||||
if (whitelistedPlayers.Any(x => x.Name.ToLower() == name.ToLower() && x.IP == ip)) return;
|
if (whitelistedPlayers.Any(x => x.Name.ToLower() == name.ToLower() && x.IP == ip)) return;
|
||||||
whitelistedPlayers.Add(new WhiteListedPlayer(name, ip));
|
whitelistedPlayers.Add(new WhiteListedPlayer(name, ip));
|
||||||
Save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ServerAdminWrite(NetBuffer outMsg, Client c)
|
public void ServerAdminWrite(NetBuffer outMsg, Client c)
|
||||||
@@ -201,8 +196,10 @@ namespace Barotrauma.Networking
|
|||||||
GameServer.Log(c.Name + " added " + name + " to whitelist (" + ip + ")", ServerLog.MessageType.ConsoleUsage);
|
GameServer.Log(c.Name + " added " + name + " to whitelist (" + ip + ")", ServerLog.MessageType.ConsoleUsage);
|
||||||
AddToWhiteList(name, ip);
|
AddToWhiteList(name, ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
return removeCount > 0 || addCount > 0 || prevEnabled!=enabled;
|
bool changed = removeCount > 0 || addCount > 0 || prevEnabled != enabled;
|
||||||
|
if (changed) { Save(); }
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1295,15 +1295,6 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Fractalguardian\fractalguardian.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Fractalguardian\fractalguardian.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Human\damagedhead.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Human\damagedlegs.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Human\damagedtorso.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Human\firstnames_female.txt">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Human\firstnames_female.txt">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|||||||
@@ -840,7 +840,15 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(humanConfigFile))
|
if (string.IsNullOrEmpty(humanConfigFile))
|
||||||
{
|
{
|
||||||
humanConfigFile = GetConfigFile("Human");
|
humanConfigFile = GameMain.Instance.GetFilesOfType(ContentType.Character)?
|
||||||
|
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == "human.xml");
|
||||||
|
|
||||||
|
if (humanConfigFile == null)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError($"Couldn't find a human config file from the selected content packages!");
|
||||||
|
DebugConsole.ThrowError($"(The config file must end with \"human.xml\")");
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return humanConfigFile;
|
return humanConfigFile;
|
||||||
}
|
}
|
||||||
@@ -859,12 +867,16 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Searches for a character config file from all currently selected content packages,
|
||||||
|
/// or from a specific package if the contentPackage parameter is given.
|
||||||
|
/// </summary>
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
||||||
{
|
{
|
||||||
string configFile = null;
|
string configFile = null;
|
||||||
if (contentPackage == null)
|
if (contentPackage == null)
|
||||||
{
|
{
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character, searchAllContentPackages: true)
|
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -887,7 +899,7 @@ namespace Barotrauma
|
|||||||
#if SERVER
|
#if SERVER
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
if (GameMain.Server != null && IsRemotePlayer)
|
||||||
{
|
{
|
||||||
if (characterConfigFiles == null)
|
switch (inputType)
|
||||||
{
|
{
|
||||||
case InputType.Left:
|
case InputType.Left:
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Left)) && (prevDequeuedInput.HasFlag(InputNetFlags.Left));
|
return !(dequeuedInput.HasFlag(InputNetFlags.Left)) && (prevDequeuedInput.HasFlag(InputNetFlags.Left));
|
||||||
@@ -918,672 +930,13 @@ namespace Barotrauma
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return keys[(int)inputType].Hit;
|
return keys[(int)inputType].Hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public bool IsKeyDown(InputType inputType)
|
||||||
/// Searches for a character config file from all currently selected content packages,
|
|
||||||
/// or from a specific package if the contentPackage parameter is given.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> characterConfigFiles;
|
|
||||||
private static IEnumerable<string> CharacterConfigFiles
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character);
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
string configFile = null;
|
|
||||||
if (contentPackage == null)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character, searchAllContentPackages: true)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsKeyHit(InputType inputType)
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
case InputType.Left:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Left)) && (prevDequeuedInput.HasFlag(InputNetFlags.Left));
|
|
||||||
case InputType.Right:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Right)) && (prevDequeuedInput.HasFlag(InputNetFlags.Right));
|
|
||||||
case InputType.Up:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Up)) && (prevDequeuedInput.HasFlag(InputNetFlags.Up));
|
|
||||||
case InputType.Down:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Down)) && (prevDequeuedInput.HasFlag(InputNetFlags.Down));
|
|
||||||
case InputType.Run:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Run)) && (prevDequeuedInput.HasFlag(InputNetFlags.Run));
|
|
||||||
case InputType.Crouch:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Crouch)) && (prevDequeuedInput.HasFlag(InputNetFlags.Crouch));
|
|
||||||
case InputType.Select:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Select); //TODO: clean up the way this input is registered
|
|
||||||
case InputType.Deselect:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Deselect);
|
|
||||||
case InputType.Health:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Health);
|
|
||||||
case InputType.Grab:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Grab);
|
|
||||||
case InputType.Use:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Use)) && (prevDequeuedInput.HasFlag(InputNetFlags.Use));
|
|
||||||
case InputType.Shoot:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Shoot)) && (prevDequeuedInput.HasFlag(InputNetFlags.Shoot));
|
|
||||||
case InputType.Ragdoll:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Ragdoll)) && (prevDequeuedInput.HasFlag(InputNetFlags.Ragdoll));
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> characterConfigFiles;
|
|
||||||
private static IEnumerable<string> CharacterConfigFiles
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character);
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Searches for a character config file from all currently selected content packages,
|
|
||||||
/// or from a specific package if the contentPackage parameter is given.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
string configFile = null;
|
|
||||||
if (contentPackage == null)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> characterConfigFiles;
|
|
||||||
private static IEnumerable<string> CharacterConfigFiles
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
case InputType.Left:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Left)) && (prevDequeuedInput.HasFlag(InputNetFlags.Left));
|
|
||||||
case InputType.Right:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Right)) && (prevDequeuedInput.HasFlag(InputNetFlags.Right));
|
|
||||||
case InputType.Up:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Up)) && (prevDequeuedInput.HasFlag(InputNetFlags.Up));
|
|
||||||
case InputType.Down:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Down)) && (prevDequeuedInput.HasFlag(InputNetFlags.Down));
|
|
||||||
case InputType.Run:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Run)) && (prevDequeuedInput.HasFlag(InputNetFlags.Run));
|
|
||||||
case InputType.Crouch:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Crouch)) && (prevDequeuedInput.HasFlag(InputNetFlags.Crouch));
|
|
||||||
case InputType.Select:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Select); //TODO: clean up the way this input is registered
|
|
||||||
case InputType.Deselect:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Deselect);
|
|
||||||
case InputType.Health:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Health);
|
|
||||||
case InputType.Grab:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Grab);
|
|
||||||
case InputType.Use:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Use)) && (prevDequeuedInput.HasFlag(InputNetFlags.Use));
|
|
||||||
case InputType.Shoot:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Shoot)) && (prevDequeuedInput.HasFlag(InputNetFlags.Shoot));
|
|
||||||
case InputType.Ragdoll:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Ragdoll)) && (prevDequeuedInput.HasFlag(InputNetFlags.Ragdoll));
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Searches for a character config file from all currently selected content packages,
|
|
||||||
/// or from a specific package if the contentPackage parameter is given.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
string configFile = null;
|
|
||||||
if (contentPackage == null)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> characterConfigFiles;
|
|
||||||
private static IEnumerable<string> CharacterConfigFiles
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character);
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Searches for a character config file from all currently selected content packages,
|
|
||||||
/// or from a specific package if the contentPackage parameter is given.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
string configFile = null;
|
|
||||||
if (contentPackage == null)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> characterConfigFiles;
|
|
||||||
private static IEnumerable<string> CharacterConfigFiles
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
case InputType.Left:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Left)) && (prevDequeuedInput.HasFlag(InputNetFlags.Left));
|
|
||||||
case InputType.Right:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Right)) && (prevDequeuedInput.HasFlag(InputNetFlags.Right));
|
|
||||||
case InputType.Up:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Up)) && (prevDequeuedInput.HasFlag(InputNetFlags.Up));
|
|
||||||
case InputType.Down:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Down)) && (prevDequeuedInput.HasFlag(InputNetFlags.Down));
|
|
||||||
case InputType.Run:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Run)) && (prevDequeuedInput.HasFlag(InputNetFlags.Run));
|
|
||||||
case InputType.Crouch:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Crouch)) && (prevDequeuedInput.HasFlag(InputNetFlags.Crouch));
|
|
||||||
case InputType.Select:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Select); //TODO: clean up the way this input is registered
|
|
||||||
case InputType.Deselect:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Deselect);
|
|
||||||
case InputType.Health:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Health);
|
|
||||||
case InputType.Grab:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Grab);
|
|
||||||
case InputType.Use:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Use)) && (prevDequeuedInput.HasFlag(InputNetFlags.Use));
|
|
||||||
case InputType.Shoot:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Shoot)) && (prevDequeuedInput.HasFlag(InputNetFlags.Shoot));
|
|
||||||
case InputType.Ragdoll:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Ragdoll)) && (prevDequeuedInput.HasFlag(InputNetFlags.Ragdoll));
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Searches for a character config file from all currently selected content packages,
|
|
||||||
/// or from a specific package if the contentPackage parameter is given.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
string configFile = null;
|
|
||||||
if (contentPackage == null)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> characterConfigFiles;
|
|
||||||
private static IEnumerable<string> CharacterConfigFiles
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character);
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Searches for a character config file from all currently selected content packages,
|
|
||||||
/// or from a specific package if the contentPackage parameter is given.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
string configFile = null;
|
|
||||||
if (contentPackage == null)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> characterConfigFiles;
|
|
||||||
private static IEnumerable<string> CharacterConfigFiles
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
case InputType.Left:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Left)) && (prevDequeuedInput.HasFlag(InputNetFlags.Left));
|
|
||||||
case InputType.Right:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Right)) && (prevDequeuedInput.HasFlag(InputNetFlags.Right));
|
|
||||||
case InputType.Up:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Up)) && (prevDequeuedInput.HasFlag(InputNetFlags.Up));
|
|
||||||
case InputType.Down:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Down)) && (prevDequeuedInput.HasFlag(InputNetFlags.Down));
|
|
||||||
case InputType.Run:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Run)) && (prevDequeuedInput.HasFlag(InputNetFlags.Run));
|
|
||||||
case InputType.Crouch:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Crouch)) && (prevDequeuedInput.HasFlag(InputNetFlags.Crouch));
|
|
||||||
case InputType.Select:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Select); //TODO: clean up the way this input is registered
|
|
||||||
case InputType.Deselect:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Deselect);
|
|
||||||
case InputType.Health:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Health);
|
|
||||||
case InputType.Grab:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Grab);
|
|
||||||
case InputType.Use:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Use)) && (prevDequeuedInput.HasFlag(InputNetFlags.Use));
|
|
||||||
case InputType.Shoot:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Shoot)) && (prevDequeuedInput.HasFlag(InputNetFlags.Shoot));
|
|
||||||
case InputType.Ragdoll:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Ragdoll)) && (prevDequeuedInput.HasFlag(InputNetFlags.Ragdoll));
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Searches for a character config file from all currently selected content packages,
|
|
||||||
/// or from a specific package if the contentPackage parameter is given.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
string configFile = null;
|
|
||||||
if (contentPackage == null)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> characterConfigFiles;
|
|
||||||
private static IEnumerable<string> CharacterConfigFiles
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character);
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Searches for a character config file from all currently selected content packages,
|
|
||||||
/// or from a specific package if the contentPackage parameter is given.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
string configFile = null;
|
|
||||||
if (contentPackage == null)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> characterConfigFiles;
|
|
||||||
private static IEnumerable<string> CharacterConfigFiles
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
case InputType.Left:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Left)) && (prevDequeuedInput.HasFlag(InputNetFlags.Left));
|
|
||||||
case InputType.Right:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Right)) && (prevDequeuedInput.HasFlag(InputNetFlags.Right));
|
|
||||||
case InputType.Up:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Up)) && (prevDequeuedInput.HasFlag(InputNetFlags.Up));
|
|
||||||
case InputType.Down:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Down)) && (prevDequeuedInput.HasFlag(InputNetFlags.Down));
|
|
||||||
case InputType.Run:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Run)) && (prevDequeuedInput.HasFlag(InputNetFlags.Run));
|
|
||||||
case InputType.Crouch:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Crouch)) && (prevDequeuedInput.HasFlag(InputNetFlags.Crouch));
|
|
||||||
case InputType.Select:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Select); //TODO: clean up the way this input is registered
|
|
||||||
case InputType.Deselect:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Deselect);
|
|
||||||
case InputType.Health:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Health);
|
|
||||||
case InputType.Grab:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Grab);
|
|
||||||
case InputType.Use:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Use)) && (prevDequeuedInput.HasFlag(InputNetFlags.Use));
|
|
||||||
case InputType.Shoot:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Shoot)) && (prevDequeuedInput.HasFlag(InputNetFlags.Shoot));
|
|
||||||
case InputType.Ragdoll:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Ragdoll)) && (prevDequeuedInput.HasFlag(InputNetFlags.Ragdoll));
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
string configFile = null;
|
|
||||||
if (contentPackage == null)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character, searchAllContentPackages: true)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsKeyHit(InputType inputType)
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character);
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Searches for a character config file from all currently selected content packages,
|
|
||||||
/// or from a specific package if the contentPackage parameter is given.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
string configFile = null;
|
|
||||||
if (contentPackage == null)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> characterConfigFiles;
|
|
||||||
private static IEnumerable<string> CharacterConfigFiles
|
|
||||||
{
|
|
||||||
#if SERVER
|
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
|
||||||
{
|
|
||||||
if (characterConfigFiles == null)
|
|
||||||
{
|
|
||||||
case InputType.Left:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Left)) && (prevDequeuedInput.HasFlag(InputNetFlags.Left));
|
|
||||||
case InputType.Right:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Right)) && (prevDequeuedInput.HasFlag(InputNetFlags.Right));
|
|
||||||
case InputType.Up:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Up)) && (prevDequeuedInput.HasFlag(InputNetFlags.Up));
|
|
||||||
case InputType.Down:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Down)) && (prevDequeuedInput.HasFlag(InputNetFlags.Down));
|
|
||||||
case InputType.Run:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Run)) && (prevDequeuedInput.HasFlag(InputNetFlags.Run));
|
|
||||||
case InputType.Crouch:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Crouch)) && (prevDequeuedInput.HasFlag(InputNetFlags.Crouch));
|
|
||||||
case InputType.Select:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Select); //TODO: clean up the way this input is registered
|
|
||||||
case InputType.Deselect:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Deselect);
|
|
||||||
case InputType.Health:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Health);
|
|
||||||
case InputType.Grab:
|
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Grab);
|
|
||||||
case InputType.Use:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Use)) && (prevDequeuedInput.HasFlag(InputNetFlags.Use));
|
|
||||||
case InputType.Shoot:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Shoot)) && (prevDequeuedInput.HasFlag(InputNetFlags.Shoot));
|
|
||||||
case InputType.Ragdoll:
|
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Ragdoll)) && (prevDequeuedInput.HasFlag(InputNetFlags.Ragdoll));
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return characterConfigFiles;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Searches for a character config file from all currently selected content packages,
|
|
||||||
/// or from a specific package if the contentPackage parameter is given.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
|
||||||
{
|
|
||||||
string configFile = null;
|
|
||||||
if (contentPackage == null)
|
|
||||||
{
|
|
||||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (configFile == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
|
||||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> characterConfigFiles;
|
|
||||||
private static IEnumerable<string> CharacterConfigFiles
|
|
||||||
{
|
{
|
||||||
#if SERVER
|
#if SERVER
|
||||||
if (GameMain.Server != null && IsRemotePlayer)
|
if (GameMain.Server != null && IsRemotePlayer)
|
||||||
@@ -1719,7 +1072,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
ResetSpeedMultiplier(); // Reset, items will set the value before the next update
|
ResetSpeedMultiplier(); // Reset, items will set the value before the next update
|
||||||
|
|
||||||
return speed;
|
return targetMovement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -2449,7 +1802,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
SelectCharacter(focusedCharacter);
|
SelectCharacter(focusedCharacter);
|
||||||
}
|
}
|
||||||
else if (focusedCharacter != null && IsKeyHit(InputType.Health) && focusedCharacter.CharacterHealth.UseHealthWindow)
|
else if (focusedCharacter != null && IsKeyHit(InputType.Health) && focusedCharacter.CharacterHealth.UseHealthWindow && CanInteractWith(focusedCharacter, 160f, false))
|
||||||
{
|
{
|
||||||
if (focusedCharacter == SelectedCharacter)
|
if (focusedCharacter == SelectedCharacter)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -380,7 +380,7 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
commands.Add(new Command("banid", "banid [id]: Kick and ban the player with the specified client ID from the server.", (string[] args) =>
|
commands.Add(new Command("banid", "banid [id]: Kick and ban the player with the specified client ID from the server. You can see the IDs of the clients using the command \"clientlist\".", (string[] args) =>
|
||||||
{
|
{
|
||||||
if (GameMain.NetworkMember == null || args.Length == 0) return;
|
if (GameMain.NetworkMember == null || args.Length == 0) return;
|
||||||
|
|
||||||
@@ -648,6 +648,20 @@ namespace Barotrauma
|
|||||||
},null));
|
},null));
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
commands.Add(new Command("teleportsub", "teleportsub [start/end]: Teleport the submarine to the start or end of the level. WARNING: does not take outposts into account, so often leads to physics glitches. Only use for debugging.", (string[] args) =>
|
||||||
|
{
|
||||||
|
if (Submarine.MainSub == null || Level.Loaded == null) return;
|
||||||
|
|
||||||
|
if (args.Length > 0 && args[0].ToLowerInvariant() == "start")
|
||||||
|
{
|
||||||
|
Submarine.MainSub.SetPosition(Level.Loaded.StartPosition);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Submarine.MainSub.SetPosition(Level.Loaded.EndPosition);
|
||||||
|
}
|
||||||
|
}, isCheat: true));
|
||||||
|
|
||||||
commands.Add(new Command("waterphysicsparams", "waterphysicsparams [stiffness] [spread] [damping]: defaults 0.02, 0.05, 0.05", (string[] args) =>
|
commands.Add(new Command("waterphysicsparams", "waterphysicsparams [stiffness] [spread] [damping]: defaults 0.02, 0.05, 0.05", (string[] args) =>
|
||||||
{
|
{
|
||||||
Vector2 explosionPos = GameMain.GameScreen.Cam.ScreenToWorld(PlayerInput.MousePosition);
|
Vector2 explosionPos = GameMain.GameScreen.Cam.ScreenToWorld(PlayerInput.MousePosition);
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public GameSettings()
|
public GameSettings()
|
||||||
{
|
{
|
||||||
SelectedContentPackages = new HashSet<ContentPackage>();
|
|
||||||
ContentPackage.LoadAll(ContentPackage.Folder);
|
ContentPackage.LoadAll(ContentPackage.Folder);
|
||||||
CompletedTutorialNames = new List<string>();
|
CompletedTutorialNames = new List<string>();
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ namespace Barotrauma.Items.Components
|
|||||||
private float openState;
|
private float openState;
|
||||||
private Sprite doorSprite, weldedSprite, brokenSprite;
|
private Sprite doorSprite, weldedSprite, brokenSprite;
|
||||||
private bool scaleBrokenSprite, fadeBrokenSprite;
|
private bool scaleBrokenSprite, fadeBrokenSprite;
|
||||||
private bool createdNewGap;
|
|
||||||
private bool autoOrientGap;
|
private bool autoOrientGap;
|
||||||
|
|
||||||
private bool isStuck;
|
private bool isStuck;
|
||||||
@@ -89,12 +88,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (linkedGap == null)
|
if (linkedGap == null)
|
||||||
{
|
{
|
||||||
linkedGap = e as Gap;
|
GetLinkedGap();
|
||||||
if (linkedGap != null)
|
|
||||||
{
|
|
||||||
linkedGap.PassAmbientLight = Window != Rectangle.Empty;
|
|
||||||
return linkedGap;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return linkedGap;
|
return linkedGap;
|
||||||
}
|
}
|
||||||
@@ -116,16 +110,11 @@ namespace Barotrauma.Items.Components
|
|||||||
rect.X -= 5;
|
rect.X -= 5;
|
||||||
rect.Width += 10;
|
rect.Width += 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
linkedGap = new Gap(rect, !IsHorizontal, Item.Submarine)
|
linkedGap = new Gap(rect, !IsHorizontal, Item.Submarine)
|
||||||
{
|
{
|
||||||
Submarine = item.Submarine,
|
Submarine = item.Submarine
|
||||||
PassAmbientLight = Window != Rectangle.Empty,
|
|
||||||
Open = openState
|
|
||||||
};
|
};
|
||||||
item.linkedTo.Add(linkedGap);
|
item.linkedTo.Add(linkedGap);
|
||||||
createdNewGap = true;
|
|
||||||
return linkedGap;
|
|
||||||
}
|
}
|
||||||
RefreshLinkedGap();
|
RefreshLinkedGap();
|
||||||
}
|
}
|
||||||
@@ -386,7 +375,8 @@ namespace Barotrauma.Items.Components
|
|||||||
LinkedGap.AutoOrient();
|
LinkedGap.AutoOrient();
|
||||||
}
|
}
|
||||||
LinkedGap.Open = openState;
|
LinkedGap.Open = openState;
|
||||||
if (createdNewGap && autoOrientGap) linkedGap.AutoOrient();
|
LinkedGap.PassAmbientLight = Window != Rectangle.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnMapLoaded()
|
public override void OnMapLoaded()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,12 +53,6 @@ namespace Barotrauma.Items.Components
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How useful the weapon is in combat? Used by AI to sort the used weapon. For the sake of clarity, use a value between 0 and 100 (not enforced).
|
|
||||||
/// </summary>
|
|
||||||
[Serialize(0f, false)]
|
|
||||||
public float CombatPriority { get; private set; }
|
|
||||||
|
|
||||||
public MeleeWeapon(Item item, XElement element)
|
public MeleeWeapon(Item item, XElement element)
|
||||||
: base(item, element)
|
: base(item, element)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,12 +43,6 @@ namespace Barotrauma.Items.Components
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How useful the weapon is in combat? Used by AI to sort the used weapon. For the sake of clarity, use a value between 0 and 100 (not enforced).
|
|
||||||
/// </summary>
|
|
||||||
[Serialize(0f, false)]
|
|
||||||
public float CombatPriority { get; private set; }
|
|
||||||
|
|
||||||
public Vector2 TransformedBarrelPos
|
public Vector2 TransformedBarrelPos
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -170,6 +164,7 @@ namespace Barotrauma.Items.Components
|
|||||||
projectile.Item.SetTransform(projectilePos, rotation);
|
projectile.Item.SetTransform(projectilePos, rotation);
|
||||||
|
|
||||||
projectile.Use(deltaTime);
|
projectile.Use(deltaTime);
|
||||||
|
if (projectile.Item.Removed) { return true; }
|
||||||
projectile.User = character;
|
projectile.User = character;
|
||||||
|
|
||||||
projectile.Item.body.ApplyTorque(projectile.Item.body.Mass * degreeOfFailure * Rand.Range(-10.0f, 10.0f));
|
projectile.Item.body.ApplyTorque(projectile.Item.body.Mass * degreeOfFailure * Rand.Range(-10.0f, 10.0f));
|
||||||
|
|||||||
@@ -545,7 +545,6 @@ namespace Barotrauma.Items.Components
|
|||||||
GameAnalyticsManager.AddErrorEventOnce("ItemComponent.DegreeOfSuccess:CharacterNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
GameAnalyticsManager.AddErrorEventOnce("ItemComponent.DegreeOfSuccess:CharacterNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
float average = skillSuccessSum / requiredSkills.Count;
|
|
||||||
|
|
||||||
float skillSuccessSum = 0.0f;
|
float skillSuccessSum = 0.0f;
|
||||||
for (int i = 0; i < requiredSkills.Count; i++)
|
for (int i = 0; i < requiredSkills.Count; i++)
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ namespace Barotrauma.Items.Components
|
|||||||
RelatedItem ri = containableItems.Find(x => x.MatchesItem(containedItem));
|
RelatedItem ri = containableItems.Find(x => x.MatchesItem(containedItem));
|
||||||
if (ri != null)
|
if (ri != null)
|
||||||
{
|
{
|
||||||
|
itemsWithStatusEffects.RemoveAll(i => i.First == containedItem);
|
||||||
foreach (StatusEffect effect in ri.statusEffects)
|
foreach (StatusEffect effect in ri.statusEffects)
|
||||||
{
|
{
|
||||||
itemsWithStatusEffects.Add(new Pair<Item, StatusEffect>(containedItem, effect));
|
itemsWithStatusEffects.Add(new Pair<Item, StatusEffect>(containedItem, effect));
|
||||||
@@ -107,12 +108,12 @@ namespace Barotrauma.Items.Components
|
|||||||
IsActive = itemsWithStatusEffects.Count > 0 || containedItem.body != null;
|
IsActive = itemsWithStatusEffects.Count > 0 || containedItem.body != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnItemRemoved(Item item)
|
public void OnItemRemoved(Item containedItem)
|
||||||
{
|
{
|
||||||
itemsWithStatusEffects.RemoveAll(i => i.First == item);
|
itemsWithStatusEffects.RemoveAll(i => i.First == containedItem);
|
||||||
|
|
||||||
//deactivate if the inventory is empty
|
//deactivate if the inventory is empty
|
||||||
IsActive = itemsWithStatusEffects.Count > 0 || item.body != null;
|
IsActive = itemsWithStatusEffects.Count > 0 || containedItem.body != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanBeContained(Item item)
|
public bool CanBeContained(Item item)
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ namespace Barotrauma
|
|||||||
get { return spriteColor; }
|
get { return spriteColor; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsFullCondition => Condition >= MaxCondition;
|
public bool IsFullCondition => MathUtils.NearlyEqual(Condition, MaxCondition);
|
||||||
public float MaxCondition => Prefab.Health;
|
public float MaxCondition => Prefab.Health;
|
||||||
public float ConditionPercentage => MathUtils.Percentage(Condition, MaxCondition);
|
public float ConditionPercentage => MathUtils.Percentage(Condition, MaxCondition);
|
||||||
|
|
||||||
@@ -334,6 +334,7 @@ namespace Barotrauma
|
|||||||
if (Indestructible) return;
|
if (Indestructible) return;
|
||||||
|
|
||||||
float prev = condition;
|
float prev = condition;
|
||||||
|
|
||||||
condition = MathHelper.Clamp(value, 0.0f, Prefab.Health);
|
condition = MathHelper.Clamp(value, 0.0f, Prefab.Health);
|
||||||
if (condition == 0.0f && prev > 0.0f)
|
if (condition == 0.0f && prev > 0.0f)
|
||||||
{
|
{
|
||||||
@@ -1588,7 +1589,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Use(float deltaTime, Character character = null, Limb targetLimb = null)
|
public void Use(float deltaTime, Character character = null, Limb targetLimb = null)
|
||||||
{
|
{
|
||||||
if (RequireAimToUse && !character.IsKeyDown(InputType.Aim))
|
if (RequireAimToUse && (character == null || !character.IsKeyDown(InputType.Aim)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool IsOptional { get; set; }
|
public bool IsOptional { get; set; }
|
||||||
|
public bool MatchOnEmpty { get; set; }
|
||||||
|
|
||||||
public bool IgnoreInEditor { get; set; }
|
public bool IgnoreInEditor { get; set; }
|
||||||
|
|
||||||
private string[] excludedIdentifiers;
|
private string[] excludedIdentifiers;
|
||||||
@@ -227,6 +228,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
ri.IsOptional = element.GetAttributeBool("optional", false);
|
ri.IsOptional = element.GetAttributeBool("optional", false);
|
||||||
ri.IgnoreInEditor = element.GetAttributeBool("ignoreineditor", false);
|
ri.IgnoreInEditor = element.GetAttributeBool("ignoreineditor", false);
|
||||||
|
ri.MatchOnEmpty = element.GetAttributeBool("matchonempty", false);
|
||||||
return ri;
|
return ri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace Barotrauma
|
|||||||
class Entity : ISpatialEntity
|
class Entity : ISpatialEntity
|
||||||
{
|
{
|
||||||
public const ushort NullEntityID = 0;
|
public const ushort NullEntityID = 0;
|
||||||
|
public const ushort EntitySpawnerID = ushort.MaxValue;
|
||||||
|
|
||||||
private static Dictionary<ushort, Entity> dictionary = new Dictionary<ushort, Entity>();
|
private static Dictionary<ushort, Entity> dictionary = new Dictionary<ushort, Entity>();
|
||||||
public static List<Entity> GetEntityList()
|
public static List<Entity> GetEntityList()
|
||||||
@@ -43,12 +44,19 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (this is EntitySpawner) { return; }
|
||||||
if (value == NullEntityID)
|
if (value == NullEntityID)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Cannot set the ID of an entity to " + NullEntityID +
|
DebugConsole.ThrowError("Cannot set the ID of an entity to " + NullEntityID +
|
||||||
"! The value is reserved for entity events referring to a non-existent (e.g. removed) entity.\n" + Environment.StackTrace);
|
"! The value is reserved for entity events referring to a non-existent (e.g. removed) entity.\n" + Environment.StackTrace);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (value == EntitySpawnerID)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Cannot set the ID of an entity to " + EntitySpawnerID +
|
||||||
|
"! The value is reserved for EntitySpawner.\n" + Environment.StackTrace);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (dictionary.TryGetValue(id, out Entity thisEntity) && thisEntity == this)
|
if (dictionary.TryGetValue(id, out Entity thisEntity) && thisEntity == this)
|
||||||
{
|
{
|
||||||
@@ -107,15 +115,17 @@ namespace Barotrauma
|
|||||||
this.Submarine = submarine;
|
this.Submarine = submarine;
|
||||||
|
|
||||||
//give a unique ID
|
//give a unique ID
|
||||||
id = FindFreeID(submarine == null ? (ushort)1 : submarine.IdOffset);
|
id = this is EntitySpawner ?
|
||||||
|
EntitySpawnerID :
|
||||||
|
FindFreeID(submarine == null ? (ushort)1 : submarine.IdOffset);
|
||||||
|
|
||||||
dictionary.Add(id, this);
|
dictionary.Add(id, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ushort FindFreeID(ushort idOffset = 0)
|
public static ushort FindFreeID(ushort idOffset = 0)
|
||||||
{
|
{
|
||||||
//ushort.MaxValue - 1 because 0 is a reserved value
|
//ushort.MaxValue - 2 because 0 and ushort.MaxValue are reserved values
|
||||||
if (dictionary.Count >= ushort.MaxValue - 1)
|
if (dictionary.Count >= ushort.MaxValue - 2)
|
||||||
{
|
{
|
||||||
throw new Exception("Maximum amount of entities (" + (ushort.MaxValue - 1) + ") reached!");
|
throw new Exception("Maximum amount of entities (" + (ushort.MaxValue - 1) + ") reached!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace Barotrauma
|
|||||||
if (Screen.Selected == GameMain.SubEditorScreen)
|
if (Screen.Selected == GameMain.SubEditorScreen)
|
||||||
{
|
{
|
||||||
MapEntity.SelectedList.Clear();
|
MapEntity.SelectedList.Clear();
|
||||||
MapEntity.SelectedList.AddRange(entities);
|
entities.ForEach(e => MapEntity.AddSelection(e));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return entities;
|
return entities;
|
||||||
|
|||||||
@@ -1274,6 +1274,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugConsole.Log("Generating level resources...");
|
||||||
|
|
||||||
for (int i = 0; i < generationParams.ItemCount; i++)
|
for (int i = 0; i < generationParams.ItemCount; i++)
|
||||||
{
|
{
|
||||||
var selectedPrefab = ToolBox.SelectWeightedRandom(
|
var selectedPrefab = ToolBox.SelectWeightedRandom(
|
||||||
@@ -1286,6 +1288,7 @@ namespace Barotrauma
|
|||||||
var selectedEdge = selectedCell.Edges.GetRandom(e => e.IsSolid && !e.OutsideLevel, Rand.RandSync.Server);
|
var selectedEdge = selectedCell.Edges.GetRandom(e => e.IsSolid && !e.OutsideLevel, Rand.RandSync.Server);
|
||||||
if (selectedEdge == null) continue;
|
if (selectedEdge == null) continue;
|
||||||
|
|
||||||
|
|
||||||
float edgePos = Rand.Range(0.0f, 1.0f, Rand.RandSync.Server);
|
float edgePos = Rand.Range(0.0f, 1.0f, Rand.RandSync.Server);
|
||||||
Vector2 selectedPos = Vector2.Lerp(selectedEdge.Point1, selectedEdge.Point2, edgePos);
|
Vector2 selectedPos = Vector2.Lerp(selectedEdge.Point1, selectedEdge.Point2, edgePos);
|
||||||
Vector2 edgeNormal = selectedEdge.GetNormal(selectedCell);
|
Vector2 edgeNormal = selectedEdge.GetNormal(selectedCell);
|
||||||
@@ -1306,6 +1309,8 @@ namespace Barotrauma
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugConsole.Log("Level resources generated");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 GetRandomItemPos(PositionType spawnPosType, float randomSpread, float minDistFromSubs, float offsetFromWall = 10.0f)
|
public Vector2 GetRandomItemPos(PositionType spawnPosType, float randomSpread, float minDistFromSubs, float offsetFromWall = 10.0f)
|
||||||
|
|||||||
@@ -1022,12 +1022,12 @@ namespace Barotrauma.RuinGeneration
|
|||||||
{
|
{
|
||||||
targetEntity = ruinEntities.GetRandom(e =>
|
targetEntity = ruinEntities.GetRandom(e =>
|
||||||
e.Room == targetRoom &&
|
e.Room == targetRoom &&
|
||||||
e.Entity.prefab?.Identifier == connection.TargetEntityIdentifier)?.Entity;
|
e.Entity.prefab?.Identifier == connection.TargetEntityIdentifier, Rand.RandSync.Server)?.Entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
targetEntity = ruinEntities.GetRandom(e => e.Entity.prefab?.Identifier == connection.TargetEntityIdentifier)?.Entity;
|
targetEntity = ruinEntities.GetRandom(e => e.Entity.prefab?.Identifier == connection.TargetEntityIdentifier, Rand.RandSync.Server)?.Entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetEntity == null) continue;
|
if (targetEntity == null) continue;
|
||||||
|
|||||||
@@ -388,20 +388,6 @@ namespace Barotrauma
|
|||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void InitProjSpecific();
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void InitProjSpecific();
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override MapEntity Clone()
|
public override MapEntity Clone()
|
||||||
{
|
{
|
||||||
var clone = new Structure(rect, Prefab, Submarine)
|
var clone = new Structure(rect, Prefab, Submarine)
|
||||||
|
|||||||
@@ -1404,7 +1404,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ID = (ushort)(ushort.MaxValue - 1 - Submarine.loaded.IndexOf(this));
|
ID = (ushort)(ushort.MaxValue - 1 - Submarine.loaded.IndexOf(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ namespace Barotrauma.Steam
|
|||||||
{ "monster", 8 },
|
{ "monster", 8 },
|
||||||
{ "art", 8 },
|
{ "art", 8 },
|
||||||
{ "mission", 8 },
|
{ "mission", 8 },
|
||||||
{ "environment", 5 }
|
{ "event set", 8 },
|
||||||
|
{ "total conversion", 5 },
|
||||||
|
{ "environment", 5 },
|
||||||
|
{ "item assembly", 5 },
|
||||||
|
{ "language", 5 }
|
||||||
};
|
};
|
||||||
|
|
||||||
private List<string> popularTags = new List<string>();
|
private List<string> popularTags = new List<string>();
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ namespace Barotrauma
|
|||||||
//Enum.TryParse(element.GetAttributeString("bodytype", "Dynamic"), out BodyType bodyType);
|
//Enum.TryParse(element.GetAttributeString("bodytype", "Dynamic"), out BodyType bodyType);
|
||||||
body.BodyType = BodyType.Dynamic;
|
body.BodyType = BodyType.Dynamic;
|
||||||
body.CollisionCategories = Physics.CollisionItem;
|
body.CollisionCategories = Physics.CollisionItem;
|
||||||
body.CollidesWith = Physics.CollisionWall | Physics.CollisionLevel;
|
body.CollidesWith = Physics.CollisionWall | Physics.CollisionLevel | Physics.CollisionPlatform;
|
||||||
body.Friction = element.GetAttributeFloat("friction", 0.3f);
|
body.Friction = element.GetAttributeFloat("friction", 0.3f);
|
||||||
body.Restitution = element.GetAttributeFloat("restitution", 0.05f);
|
body.Restitution = element.GetAttributeFloat("restitution", 0.05f);
|
||||||
body.UserData = this;
|
body.UserData = this;
|
||||||
|
|||||||
@@ -424,6 +424,7 @@ namespace Barotrauma
|
|||||||
public virtual bool HasRequiredConditions(List<ISerializableEntity> targets)
|
public virtual bool HasRequiredConditions(List<ISerializableEntity> targets)
|
||||||
{
|
{
|
||||||
if (!propertyConditionals.Any()) return true;
|
if (!propertyConditionals.Any()) return true;
|
||||||
|
if (requiredItems.All(ri => ri.MatchOnEmpty) && targets.Count == 0) return true;
|
||||||
switch (conditionalComparison)
|
switch (conditionalComparison)
|
||||||
{
|
{
|
||||||
case PropertyConditional.Comparison.Or:
|
case PropertyConditional.Comparison.Or:
|
||||||
@@ -640,14 +641,14 @@ namespace Barotrauma
|
|||||||
character.LastDamageSource = entity;
|
character.LastDamageSource = entity;
|
||||||
foreach (Limb limb in character.AnimController.Limbs)
|
foreach (Limb limb in character.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
limb.character.DamageLimb(entity.WorldPosition, limb, new List<Affliction>() { multipliedAffliction }, stun: 0.0f, playSound: false, attackImpulse: 0.0f);
|
limb.character.DamageLimb(entity.WorldPosition, limb, new List<Affliction>() { multipliedAffliction }, stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: affliction.Source);
|
||||||
//only apply non-limb-specific afflictions to the first limb
|
//only apply non-limb-specific afflictions to the first limb
|
||||||
if (!affliction.Prefab.LimbSpecific) { break; }
|
if (!affliction.Prefab.LimbSpecific) { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (target is Limb limb)
|
else if (target is Limb limb)
|
||||||
{
|
{
|
||||||
limb.character.DamageLimb(entity.WorldPosition, limb, new List<Affliction>() { multipliedAffliction }, stun: 0.0f, playSound: false, attackImpulse: 0.0f);
|
limb.character.DamageLimb(entity.WorldPosition, limb, new List<Affliction>() { multipliedAffliction }, stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: affliction.Source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -311,11 +311,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (gameSession.Mission is CombatMission combatMission)
|
if (gameSession.Mission is CombatMission combatMission)
|
||||||
{
|
{
|
||||||
#if CLIENT
|
|
||||||
//all characters that are alive and in the winning team get an achievement
|
//all characters that are alive and in the winning team get an achievement
|
||||||
UnlockAchievement(gameSession.Mission.Prefab.AchievementIdentifier + (int)GameMain.GameSession.WinningTeam, true,
|
UnlockAchievement(gameSession.Mission.Prefab.AchievementIdentifier + (int)GameMain.GameSession.WinningTeam, true,
|
||||||
c => c != null && !c.IsDead && !c.IsUnconscious && combatMission.IsInWinningTeam(c));
|
c => c != null && !c.IsDead && !c.IsUnconscious && combatMission.IsInWinningTeam(c));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (gameSession.Mission.Completed)
|
else if (gameSession.Mission.Completed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -378,8 +378,6 @@ namespace Barotrauma
|
|||||||
Thread.Sleep(250);
|
Thread.Sleep(250);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,7 +468,20 @@ namespace Barotrauma
|
|||||||
foreach (DirectoryInfo di in dir.GetDirectories())
|
foreach (DirectoryInfo di in dir.GetDirectories())
|
||||||
{
|
{
|
||||||
ClearFolder(di.FullName, ignoredFileNames);
|
ClearFolder(di.FullName, ignoredFileNames);
|
||||||
di.Delete();
|
int maxRetries = 4;
|
||||||
|
for (int i = 0; i <= maxRetries; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
di.Delete();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch (IOException)
|
||||||
|
{
|
||||||
|
if (i >= maxRetries) { throw; }
|
||||||
|
Thread.Sleep(250);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -338,6 +338,7 @@ Global
|
|||||||
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x86.ActiveCfg = ReleaseWindows|x86
|
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x86.ActiveCfg = ReleaseWindows|x86
|
||||||
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x86.Build.0 = ReleaseWindows|x86
|
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x86.Build.0 = ReleaseWindows|x86
|
||||||
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseMac|Any CPU.Build.0 = ReleaseMac|x64
|
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseMac|Any CPU.Build.0 = ReleaseMac|x64
|
||||||
|
{85232B20-074D-4723-B0C6-91495391E448}.DebugMac|Any CPU.Build.0 = DebugMac|x64
|
||||||
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace Facepunch.Steamworks
|
|||||||
public bool Publishing { get; internal set; }
|
public bool Publishing { get; internal set; }
|
||||||
public ItemType? Type { get; set; }
|
public ItemType? Type { get; set; }
|
||||||
public string Error { get; internal set; } = null;
|
public string Error { get; internal set; } = null;
|
||||||
|
public SteamNative.Result? ErrorCode { get; internal set; } = null;
|
||||||
public string ChangeNote { get; set; } = "";
|
public string ChangeNote { get; set; } = "";
|
||||||
public uint WorkshopUploadAppId { get; set; }
|
public uint WorkshopUploadAppId { get; set; }
|
||||||
public string MetaData { get; set; } = null;
|
public string MetaData { get; set; } = null;
|
||||||
@@ -99,6 +100,7 @@ namespace Facepunch.Steamworks
|
|||||||
|
|
||||||
Publishing = true;
|
Publishing = true;
|
||||||
Error = null;
|
Error = null;
|
||||||
|
ErrorCode = null;
|
||||||
|
|
||||||
if ( Id == 0 )
|
if ( Id == 0 )
|
||||||
{
|
{
|
||||||
@@ -129,12 +131,14 @@ namespace Facepunch.Steamworks
|
|||||||
if ( obj.Result == SteamNative.Result.OK && !Failed )
|
if ( obj.Result == SteamNative.Result.OK && !Failed )
|
||||||
{
|
{
|
||||||
Error = null;
|
Error = null;
|
||||||
|
ErrorCode = null;
|
||||||
Id = obj.PublishedFileId;
|
Id = obj.PublishedFileId;
|
||||||
PublishChanges();
|
PublishChanges();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error = $"Error creating new file: {obj.Result} ({obj.PublishedFileId})";
|
Error = $"Error creating new file: {obj.Result} ({obj.PublishedFileId})";
|
||||||
|
ErrorCode = obj.Result;
|
||||||
Publishing = false;
|
Publishing = false;
|
||||||
|
|
||||||
OnChangesSubmitted?.Invoke( (Result) obj.Result );
|
OnChangesSubmitted?.Invoke( (Result) obj.Result );
|
||||||
@@ -221,6 +225,7 @@ namespace Facepunch.Steamworks
|
|||||||
NeedToAgreeToWorkshopLegal = obj.UserNeedsToAcceptWorkshopLegalAgreement;
|
NeedToAgreeToWorkshopLegal = obj.UserNeedsToAcceptWorkshopLegalAgreement;
|
||||||
Publishing = false;
|
Publishing = false;
|
||||||
|
|
||||||
|
ErrorCode = obj.Result;
|
||||||
Error = obj.Result != SteamNative.Result.OK
|
Error = obj.Result != SteamNative.Result.OK
|
||||||
? $"Error publishing changes: {obj.Result} ({NeedToAgreeToWorkshopLegal})"
|
? $"Error publishing changes: {obj.Result} ({NeedToAgreeToWorkshopLegal})"
|
||||||
: null;
|
: null;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace SteamNative
|
|||||||
//
|
//
|
||||||
// EResult
|
// EResult
|
||||||
//
|
//
|
||||||
internal enum Result : int
|
public enum Result : int
|
||||||
{
|
{
|
||||||
OK = 1,
|
OK = 1,
|
||||||
Fail = 2,
|
Fail = 2,
|
||||||
|
|||||||
Reference in New Issue
Block a user