Displaying the condition of contained items in the inventory slot of the parent item (i.e. the amount of oxygen left in a diving suit is visible without highlighting the suit), some debug logging, colored speech bubbles
This commit is contained in:
@@ -65,9 +65,9 @@ namespace Barotrauma
|
||||
{
|
||||
var pickable = targetItem.GetComponent<Pickable>();
|
||||
//check if all the slots required by the item are free
|
||||
foreach (LimbSlot slots in pickable.AllowedSlots)
|
||||
foreach (InvSlotType slots in pickable.AllowedSlots)
|
||||
{
|
||||
if (slots.HasFlag(LimbSlot.Any)) continue;
|
||||
if (slots.HasFlag(InvSlotType.Any)) continue;
|
||||
|
||||
for (int i = 0; i<character.Inventory.Items.Length; i++)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ namespace Barotrauma
|
||||
if (character.Inventory.Items[i] == null) continue;
|
||||
|
||||
//try to move the existing item to LimbSlot.Any and continue if successful
|
||||
if (character.Inventory.TryPutItem(character.Inventory.Items[i], new List<LimbSlot>() { LimbSlot.Any }, false)) continue;
|
||||
if (character.Inventory.TryPutItem(character.Inventory.Items[i], new List<InvSlotType>() { InvSlotType.Any }, false)) continue;
|
||||
|
||||
//if everything else fails, simply drop the existing item
|
||||
character.Inventory.Items[i].Drop();
|
||||
@@ -90,7 +90,7 @@ namespace Barotrauma
|
||||
|
||||
targetItem.Pick(character, false, true);
|
||||
|
||||
if (targetSlot > -1 && character.Inventory.IsInLimbSlot(targetItem, LimbSlot.Any))
|
||||
if (targetSlot > -1 && character.Inventory.IsInLimbSlot(targetItem, InvSlotType.Any))
|
||||
{
|
||||
character.Inventory.TryPutItem(targetItem, targetSlot, true, false);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,8 @@ namespace Barotrauma
|
||||
get { return inventory; }
|
||||
}
|
||||
|
||||
public float SpeechBubbleTimer;
|
||||
private Color speechBubbleColor;
|
||||
private float speechBubbleTimer;
|
||||
|
||||
private float lockHandsTimer;
|
||||
public bool LockHands
|
||||
@@ -694,6 +695,11 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasEquippedItem(Item item)
|
||||
{
|
||||
return !inventory.IsInLimbSlot(item, InvSlotType.Any);
|
||||
}
|
||||
|
||||
public bool HasSelectedItem(Item item)
|
||||
{
|
||||
return selectedItems.Contains(item);
|
||||
@@ -701,8 +707,8 @@ namespace Barotrauma
|
||||
|
||||
public bool TrySelectItem(Item item)
|
||||
{
|
||||
bool rightHand = ((CharacterInventory)inventory).IsInLimbSlot(item, LimbSlot.RightHand);
|
||||
bool leftHand = ((CharacterInventory)inventory).IsInLimbSlot(item, LimbSlot.LeftHand);
|
||||
bool rightHand = inventory.IsInLimbSlot(item, InvSlotType.RightHand);
|
||||
bool leftHand = inventory.IsInLimbSlot(item, InvSlotType.LeftHand);
|
||||
|
||||
bool selected = false;
|
||||
if (rightHand && SelectedItems[0] == null)
|
||||
@@ -956,7 +962,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (!Enabled) return;
|
||||
|
||||
SpeechBubbleTimer = Math.Max(0.0f, SpeechBubbleTimer - deltaTime);
|
||||
speechBubbleTimer = Math.Max(0.0f, speechBubbleTimer - deltaTime);
|
||||
|
||||
obstructVisionAmount = Math.Max(obstructVisionAmount - deltaTime, 0.0f);
|
||||
|
||||
@@ -1086,6 +1092,12 @@ namespace Barotrauma
|
||||
aiTarget.SightRange = Mass*10.0f + AnimController.RefLimb.LinearVelocity.Length()*500.0f;
|
||||
}
|
||||
|
||||
public void ShowSpeechBubble(float duration, Color color)
|
||||
{
|
||||
speechBubbleTimer = Math.Max(speechBubbleTimer, duration);
|
||||
speechBubbleColor = color;
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (!Enabled) return;
|
||||
@@ -1136,9 +1148,11 @@ namespace Barotrauma
|
||||
|
||||
GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), health / maxHealth, Color.Lerp(Color.Red, Color.Green, health / maxHealth) * 0.8f);
|
||||
|
||||
if (SpeechBubbleTimer > 0.0f)
|
||||
if (speechBubbleTimer > 0.0f)
|
||||
{
|
||||
GUI.SpeechBubbleIcon.Draw(spriteBatch, pos - Vector2.UnitY * 100.0f, Color.White * Math.Min(SpeechBubbleTimer, 1.0f));
|
||||
GUI.SpeechBubbleIcon.Draw(spriteBatch, pos - Vector2.UnitY * 100.0f,
|
||||
speechBubbleColor * Math.Min(speechBubbleTimer, 1.0f), 0.0f,
|
||||
Math.Min((float)speechBubbleTimer, 1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Barotrauma
|
||||
for (int i = 0; i< character.Inventory.Items.Length-1; i++)
|
||||
{
|
||||
var item = character.Inventory.Items[i];
|
||||
if (item == null || CharacterInventory.limbSlots[i]==LimbSlot.Any) continue;
|
||||
if (item == null || CharacterInventory.limbSlots[i]==InvSlotType.Any) continue;
|
||||
//var statusHUD = item.GetComponent<StatusHUD>();
|
||||
//if (statusHUD == null) continue;
|
||||
foreach (ItemComponent ic in item.components)
|
||||
|
||||
@@ -89,7 +89,6 @@ namespace Barotrauma
|
||||
foreach (XElement itemElement in SpawnItems.Elements())
|
||||
{
|
||||
InitializeJobItem(character, spawnPoint, itemElement);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +107,8 @@ namespace Barotrauma
|
||||
|
||||
if (ToolBox.GetAttributeBool(itemElement, "equip", false))
|
||||
{
|
||||
List<LimbSlot> allowedSlots = new List<LimbSlot>(item.AllowedSlots);
|
||||
allowedSlots.Remove(LimbSlot.Any);
|
||||
List<InvSlotType> allowedSlots = new List<InvSlotType>(item.AllowedSlots);
|
||||
allowedSlots.Remove(InvSlotType.Any);
|
||||
|
||||
character.Inventory.TryPutItem(item, allowedSlots, false);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace Barotrauma
|
||||
|
||||
static class DebugConsole
|
||||
{
|
||||
const int MaxMessages = 100;
|
||||
|
||||
public static List<ColoredText> Messages = new List<ColoredText>();
|
||||
|
||||
static bool isOpen;
|
||||
@@ -600,11 +602,21 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
if (Messages.Count > MaxMessages)
|
||||
{
|
||||
Messages.RemoveRange(0, Messages.Count - MaxMessages);
|
||||
}
|
||||
|
||||
//messages.Add(new ColoredText(msg, color));
|
||||
|
||||
selectedIndex = listBox.children.Count;
|
||||
}
|
||||
|
||||
public static void Log(string message)
|
||||
{
|
||||
if (GameSettings.VerboseLogging) NewMessage(message, Color.Gray);
|
||||
}
|
||||
|
||||
public static void ThrowError(string error, Exception e = null)
|
||||
{
|
||||
if (e != null) error += " {" + e.Message + "}";
|
||||
|
||||
@@ -189,12 +189,11 @@ namespace Barotrauma
|
||||
|
||||
GUIComponent.Init(Window);
|
||||
DebugConsole.Init(Window);
|
||||
yield return CoroutineStatus.Running;
|
||||
DebugConsole.Log(SelectedPackage == null ? "No content package selected" : "Content package ''" + SelectedPackage.Name + "'' selected");
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
LightManager = new Lights.LightManager(GraphicsDevice);
|
||||
|
||||
|
||||
|
||||
Hull.renderer = new WaterRenderer(GraphicsDevice, Content);
|
||||
TitleScreen.LoadState = 1.0f;
|
||||
yield return CoroutineStatus.Running;
|
||||
@@ -223,7 +222,7 @@ namespace Barotrauma
|
||||
while (!SoundPlayer.Initialized)
|
||||
{
|
||||
i++;
|
||||
TitleScreen.LoadState = Math.Min((float)TitleScreen.LoadState + 40.0f/41, 70.0f);
|
||||
TitleScreen.LoadState = Math.Min((float)TitleScreen.LoadState + 40.0f / 41, 70.0f);
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,11 @@ namespace Barotrauma.Tutorials
|
||||
character.GiveJobItems(null);
|
||||
|
||||
var idCard = character.Inventory.FindItem("ID Card");
|
||||
if (idCard == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Item prefab ''ID Card'' not found!");
|
||||
return;
|
||||
}
|
||||
idCard.AddTag("com");
|
||||
idCard.AddTag("eng");
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ namespace Barotrauma
|
||||
public bool AutoCheckUpdates { get; set; }
|
||||
public bool WasGameUpdated { get; set; }
|
||||
|
||||
public static bool VerboseLogging { get; set; }
|
||||
|
||||
public bool UnsavedSettings
|
||||
{
|
||||
get
|
||||
@@ -130,6 +132,8 @@ namespace Barotrauma
|
||||
SoundVolume = ToolBox.GetAttributeFloat(doc.Root, "soundvolume", 1.0f);
|
||||
MusicVolume = ToolBox.GetAttributeFloat(doc.Root, "musicvolume", 0.3f);
|
||||
|
||||
VerboseLogging = ToolBox.GetAttributeBool(doc.Root, "verboselogging", false);
|
||||
|
||||
keyMapping = new KeyOrMouse[Enum.GetNames(typeof(InputType)).Length];
|
||||
keyMapping[(int)InputType.Up] = new KeyOrMouse(Keys.W);
|
||||
keyMapping[(int)InputType.Down] = new KeyOrMouse(Keys.S);
|
||||
@@ -145,13 +149,15 @@ namespace Barotrauma
|
||||
|
||||
keyMapping[(int)InputType.Use] = new KeyOrMouse(0);
|
||||
keyMapping[(int)InputType.Aim] = new KeyOrMouse(1);
|
||||
|
||||
|
||||
foreach (XElement subElement in doc.Root.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLower())
|
||||
{
|
||||
case "contentpackage":
|
||||
string path = ToolBox.GetAttributeString(subElement, "path", "");
|
||||
|
||||
|
||||
SelectedContentPackage = ContentPackage.list.Find(cp => cp.Path == path);
|
||||
|
||||
if (SelectedContentPackage == null) SelectedContentPackage = new ContentPackage(path);
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Collections.Generic;
|
||||
namespace Barotrauma
|
||||
{
|
||||
[Flags]
|
||||
public enum LimbSlot
|
||||
public enum InvSlotType
|
||||
{
|
||||
None = 0, Any = 1, RightHand = 2, LeftHand = 4, Head = 8, Torso = 16, Legs = 32, Face=64
|
||||
};
|
||||
@@ -20,10 +20,10 @@ namespace Barotrauma
|
||||
|
||||
private Character character;
|
||||
|
||||
public static LimbSlot[] limbSlots = new LimbSlot[] {
|
||||
LimbSlot.Head, LimbSlot.Torso, LimbSlot.Legs, LimbSlot.LeftHand, LimbSlot.RightHand, LimbSlot.Face,
|
||||
LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any,
|
||||
LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any};
|
||||
public static InvSlotType[] limbSlots = new InvSlotType[] {
|
||||
InvSlotType.Head, InvSlotType.Torso, InvSlotType.Legs, InvSlotType.LeftHand, InvSlotType.RightHand, InvSlotType.Face,
|
||||
InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any,
|
||||
InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any, InvSlotType.Any};
|
||||
|
||||
public Vector2[] SlotPositions;
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public int FindLimbSlot(LimbSlot limbSlot)
|
||||
public int FindLimbSlot(InvSlotType limbSlot)
|
||||
{
|
||||
for (int i = 0; i < Items.Length; i++)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ namespace Barotrauma
|
||||
return -1;
|
||||
}
|
||||
|
||||
public bool IsInLimbSlot(Item item, LimbSlot limbSlot)
|
||||
public bool IsInLimbSlot(Item item, InvSlotType limbSlot)
|
||||
{
|
||||
for (int i = 0; i<Items.Length; i++)
|
||||
{
|
||||
@@ -132,16 +132,16 @@ namespace Barotrauma
|
||||
/// <summary>
|
||||
/// If there is room, puts the item in the inventory and returns true, otherwise returns false
|
||||
/// </summary>
|
||||
public override bool TryPutItem(Item item, List<LimbSlot> allowedSlots = null, bool createNetworkEvent = true)
|
||||
public override bool TryPutItem(Item item, List<InvSlotType> allowedSlots = null, bool createNetworkEvent = true)
|
||||
{
|
||||
if (allowedSlots == null) return false;
|
||||
|
||||
//try to place the item in LimBlot.Any slot if that's allowed
|
||||
if (allowedSlots.Contains(LimbSlot.Any))
|
||||
if (allowedSlots.Contains(InvSlotType.Any))
|
||||
{
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
if (Items[i] != null || limbSlots[i] != LimbSlot.Any) continue;
|
||||
if (Items[i] != null || limbSlots[i] != InvSlotType.Any) continue;
|
||||
|
||||
PutItem(item, i, createNetworkEvent);
|
||||
item.Unequip(character);
|
||||
@@ -150,7 +150,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
bool placed = false;
|
||||
foreach (LimbSlot allowedSlot in allowedSlots)
|
||||
foreach (InvSlotType allowedSlot in allowedSlots)
|
||||
{
|
||||
//check if all the required slots are free
|
||||
bool free = true;
|
||||
@@ -235,20 +235,20 @@ namespace Barotrauma
|
||||
return combined;
|
||||
}
|
||||
|
||||
if (limbSlots[index] == LimbSlot.Any)
|
||||
if (limbSlots[index] == InvSlotType.Any)
|
||||
{
|
||||
if (!item.AllowedSlots.Contains(LimbSlot.Any)) return false;
|
||||
if (!item.AllowedSlots.Contains(InvSlotType.Any)) return false;
|
||||
if (Items[index] != null) return Items[index] == item;
|
||||
|
||||
PutItem(item, index, createNetworkEvent, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
LimbSlot placeToSlots = LimbSlot.None;
|
||||
InvSlotType placeToSlots = InvSlotType.None;
|
||||
|
||||
bool slotsFree = true;
|
||||
List<LimbSlot> allowedSlots = item.AllowedSlots;
|
||||
foreach (LimbSlot allowedSlot in allowedSlots)
|
||||
List<InvSlotType> allowedSlots = item.AllowedSlots;
|
||||
foreach (InvSlotType allowedSlot in allowedSlots)
|
||||
{
|
||||
if (!allowedSlot.HasFlag(limbSlots[index])) continue;
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace Barotrauma
|
||||
|
||||
if (!slotsFree) return false;
|
||||
|
||||
return TryPutItem(item, new List<LimbSlot>() {placeToSlots}, createNetworkEvent);
|
||||
return TryPutItem(item, new List<InvSlotType>() {placeToSlots}, createNetworkEvent);
|
||||
}
|
||||
|
||||
public void DrawOwn(SpriteBatch spriteBatch, Vector2 offset)
|
||||
|
||||
@@ -11,12 +11,12 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
protected Character picker;
|
||||
|
||||
protected List<LimbSlot> allowedSlots;
|
||||
protected List<InvSlotType> allowedSlots;
|
||||
|
||||
private float pickTimer;
|
||||
|
||||
|
||||
public List<LimbSlot> AllowedSlots
|
||||
public List<InvSlotType> AllowedSlots
|
||||
{
|
||||
get { return allowedSlots; }
|
||||
}
|
||||
@@ -29,23 +29,23 @@ namespace Barotrauma.Items.Components
|
||||
public Pickable(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
allowedSlots = new List<LimbSlot>();
|
||||
allowedSlots = new List<InvSlotType>();
|
||||
|
||||
string slotString = ToolBox.GetAttributeString(element, "slots", "Any");
|
||||
string[] slotCombinations = slotString.Split(',');
|
||||
foreach (string slotCombination in slotCombinations)
|
||||
{
|
||||
string[] slots = slotCombination.Split('+');
|
||||
LimbSlot allowedSlot = LimbSlot.None;
|
||||
InvSlotType allowedSlot = InvSlotType.None;
|
||||
foreach (string slot in slots)
|
||||
{
|
||||
if (slot.ToLower()=="bothhands")
|
||||
{
|
||||
allowedSlot = LimbSlot.LeftHand | LimbSlot.RightHand;
|
||||
allowedSlot = InvSlotType.LeftHand | InvSlotType.RightHand;
|
||||
}
|
||||
else
|
||||
{
|
||||
allowedSlot = allowedSlot | (LimbSlot)Enum.Parse(typeof(LimbSlot), slot.Trim());
|
||||
allowedSlot = allowedSlot | (InvSlotType)Enum.Parse(typeof(InvSlotType), slot.Trim());
|
||||
}
|
||||
}
|
||||
allowedSlots.Add(allowedSlot);
|
||||
|
||||
@@ -27,8 +27,6 @@ namespace Barotrauma
|
||||
|
||||
protected int capacity;
|
||||
|
||||
|
||||
|
||||
private Vector2 centerPos;
|
||||
|
||||
protected int selectedSlot;
|
||||
@@ -95,7 +93,7 @@ namespace Barotrauma
|
||||
/// <summary>
|
||||
/// If there is room, puts the item in the inventory and returns true, otherwise returns false
|
||||
/// </summary>
|
||||
public virtual bool TryPutItem(Item item, List<LimbSlot> allowedSlots = null, bool createNetworkEvent = true)
|
||||
public virtual bool TryPutItem(Item item, List<InvSlotType> allowedSlots = null, bool createNetworkEvent = true)
|
||||
{
|
||||
int slot = FindAllowedSlot(item);
|
||||
if (slot < 0) return false;
|
||||
@@ -334,14 +332,30 @@ namespace Barotrauma
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, rect, (isHighLighted ? Color.Red : Color.White) * alpha*0.75f, true);
|
||||
|
||||
if (item != null && item.Condition < 100.0f)
|
||||
if (item != null)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, rect.Bottom - 4, rect.Width, 4), Color.Black, true);
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
new Rectangle(rect.X, rect.Bottom - 4, (int)(rect.Width * item.Condition / 100.0f), 4),
|
||||
Color.Lerp(Color.Red, Color.Green, item.Condition / 100.0f), true);
|
||||
if (item.Condition < 100.0f)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, rect.Bottom - 8, rect.Width, 8), Color.Black*0.8f, true);
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
new Rectangle(rect.X, rect.Bottom - 8, (int)(rect.Width * item.Condition / 100.0f), 8),
|
||||
Color.Lerp(Color.Red, Color.Green, item.Condition / 100.0f)*0.8f, true);
|
||||
}
|
||||
|
||||
if (!isHighLighted)
|
||||
{
|
||||
var containedItems = item.ContainedItems;
|
||||
if (containedItems != null && containedItems.Length == 1 && containedItems[0].Condition < 100.0f)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, rect.Y, rect.Width, 8), Color.Black*0.8f, true);
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
new Rectangle(rect.X, rect.Y, (int)(rect.Width * containedItems[0].Condition / 100.0f), 8),
|
||||
Color.Lerp(Color.Red, Color.Green, containedItems[0].Condition / 100.0f)*0.8f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GUI.DrawRectangle(spriteBatch, rect, (isHighLighted ? Color.Red : Color.White) * alpha, false);
|
||||
|
||||
if (item == null || !drawItem) return;
|
||||
|
||||
@@ -236,12 +236,12 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
//which type of inventory slots (head, torso, any, etc) the item can be placed in
|
||||
public List<LimbSlot> AllowedSlots
|
||||
public List<InvSlotType> AllowedSlots
|
||||
{
|
||||
get
|
||||
{
|
||||
Pickable p = GetComponent<Pickable>();
|
||||
return (p==null) ? new List<LimbSlot>() { LimbSlot.Any } : p.AllowedSlots;
|
||||
return (p==null) ? new List<InvSlotType>() { InvSlotType.Any } : p.AllowedSlots;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -175,10 +175,12 @@ namespace Barotrauma
|
||||
|
||||
public static void LoadAll(List<string> filePaths)
|
||||
{
|
||||
//string[] files = Directory.GetFiles(contentFolder, "*.xml", SearchOption.AllDirectories);
|
||||
DebugConsole.Log("Loading item prefabs: ");
|
||||
|
||||
foreach (string filePath in filePaths)
|
||||
{
|
||||
DebugConsole.Log("*** "+filePath+" ***");
|
||||
|
||||
XDocument doc = ToolBox.TryLoadXml(filePath);
|
||||
if (doc == null) return;
|
||||
|
||||
@@ -200,12 +202,13 @@ namespace Barotrauma
|
||||
|
||||
public ItemPrefab (XElement element, string filePath)
|
||||
{
|
||||
|
||||
configFile = filePath;
|
||||
|
||||
name = ToolBox.GetAttributeString(element, "name", "");
|
||||
if (name == "") DebugConsole.ThrowError("Unnamed item in "+filePath+"!");
|
||||
|
||||
DebugConsole.Log(" "+name);
|
||||
|
||||
Description = ToolBox.GetAttributeString(element, "description", "");
|
||||
|
||||
pickThroughWalls = ToolBox.GetAttributeBool(element, "pickthroughwalls", false);
|
||||
@@ -226,13 +229,11 @@ namespace Barotrauma
|
||||
|
||||
ImpactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 0.0f);
|
||||
|
||||
|
||||
string categoriesStr = ToolBox.GetAttributeString(element, "category", "Misc");
|
||||
string[] categories = categoriesStr.Split(',');
|
||||
|
||||
for (int i = 0; i<categories.Length; i++)
|
||||
for (int i = 0; i < categories.Length; i++)
|
||||
{
|
||||
|
||||
MapEntityCategory category;
|
||||
if (Enum.TryParse(ToolBox.GetAttributeString(element, "category", "Misc"), out category))
|
||||
{
|
||||
|
||||
@@ -205,8 +205,8 @@ namespace Barotrauma.Networking
|
||||
if (sender == null) return false;
|
||||
|
||||
var radio = sender.Inventory.Items.First(i => i != null && i.GetComponent<WifiComponent>() != null);
|
||||
if (radio == null) return false;
|
||||
|
||||
if (radio == null || !sender.HasEquippedItem(radio)) return false;
|
||||
|
||||
var radioComponent = radio.GetComponent<WifiComponent>();
|
||||
return radioComponent.HasRequiredContainedItems(false);
|
||||
}
|
||||
@@ -236,6 +236,8 @@ namespace Barotrauma.Networking
|
||||
var radio = message.Sender.Inventory.Items.First(i => i != null && i.GetComponent<WifiComponent>() != null);
|
||||
if (radio == null) return;
|
||||
|
||||
message.Sender.ShowSpeechBubble(2.0f, ChatMessage.MessageColor[(int)ChatMessageType.Radio]);
|
||||
|
||||
var radioComponent = radio.GetComponent<WifiComponent>();
|
||||
radioComponent.Transmit(message.TextWithSender);
|
||||
return;
|
||||
@@ -251,7 +253,7 @@ namespace Barotrauma.Networking
|
||||
if (string.IsNullOrWhiteSpace(displayedText)) return;
|
||||
}
|
||||
|
||||
message.Sender.SpeechBubbleTimer = Math.Max(message.Sender.SpeechBubbleTimer, 2.0f);
|
||||
message.Sender.ShowSpeechBubble(2.0f, ChatMessage.MessageColor[(int)ChatMessageType.Default]);
|
||||
}
|
||||
|
||||
GameMain.NetLobbyScreen.NewChatMessage(message);
|
||||
|
||||
@@ -469,7 +469,7 @@ namespace Barotrauma
|
||||
|
||||
var item = new Item(screwdriverPrefab, Vector2.Zero, null);
|
||||
|
||||
dummyCharacter.Inventory.TryPutItem(item, new List<LimbSlot>() {LimbSlot.RightHand}, false);
|
||||
dummyCharacter.Inventory.TryPutItem(item, new List<InvSlotType>() {InvSlotType.RightHand}, false);
|
||||
|
||||
wiringToolPanel = CreateWiringPanel();
|
||||
}
|
||||
@@ -537,7 +537,7 @@ namespace Barotrauma
|
||||
|
||||
var wire = new Item(userData as ItemPrefab, Vector2.Zero, null);
|
||||
|
||||
int slotIndex = dummyCharacter.Inventory.FindLimbSlot(LimbSlot.LeftHand);
|
||||
int slotIndex = dummyCharacter.Inventory.FindLimbSlot(InvSlotType.LeftHand);
|
||||
|
||||
//if there's some other type of wire in the inventory, remove it
|
||||
existingWire = dummyCharacter.Inventory.Items[slotIndex];
|
||||
|
||||
Reference in New Issue
Block a user