- changes to the logic for distributing oxygen through vents: the oxygen generator pushes more oxygen to larger rooms

- bugfixes in HumanoidAnimController.Flip()
- item/itemcomponent statuseffects are stored in a dictionary with the actiontype as a key, so the item doesn't have to iterate over all the components and all their statuseffects
- gap bubble particle tweaking
This commit is contained in:
Regalis
2016-03-29 17:57:05 +03:00
parent 23f1623562
commit 3ac8139fc7
10 changed files with 129 additions and 62 deletions
@@ -115,15 +115,19 @@ namespace Barotrauma.Items.Components
foreach (FabricableItem fi in fabricableItems)
{
Color color = ((itemList.CountChildren % 2) == 0) ? Color.Transparent : Color.Black*0.3f;
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25), fi.TargetItem.Name,
new GUITextBlock(
new Rectangle(0, 0, 0, 25), fi.TargetItem.Name,
color, Color.White,
Alignment.Left, Alignment.Left, null, itemList);
textBlock.UserData = fi;
textBlock.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
textBlock.HoverColor = Color.Gold * 0.2f;
textBlock.SelectedColor = Color.Gold * 0.5f;
Alignment.Left, Alignment.Left, null, itemList)
{
UserData = fi,
Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f),
HoverColor = Color.Gold * 0.2f,
SelectedColor = Color.Gold * 0.5f,
ToolTip = fi.TargetItem.Description
};
}
}
@@ -135,7 +139,7 @@ namespace Barotrauma.Items.Components
if (selectedItemFrame != null) GuiFrame.RemoveChild(selectedItemFrame);
//int width = 200, height = 150;
selectedItemFrame = new GUIFrame(new Rectangle(0,0,(int)(GuiFrame.Rect.Width*0.4f),250), Color.Black*0.8f, Alignment.CenterY | Alignment.Right, null, GuiFrame);
selectedItemFrame = new GUIFrame(new Rectangle(0, 0, (int)(GuiFrame.Rect.Width * 0.4f), 250), Color.Black * 0.8f, Alignment.CenterY | Alignment.Right, null, GuiFrame);
selectedItemFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
@@ -170,7 +174,7 @@ namespace Barotrauma.Items.Components
if (!inadequateSkills.Any())
{
text = "Required items:\n";
foreach (Tuple<ItemPrefab,int> ip in targetItem.RequiredItems)
foreach (Tuple<ItemPrefab, int> ip in targetItem.RequiredItems)
{
text += " - " + ip.Item1.Name + " x"+ip.Item2+"\n";
}
@@ -204,6 +208,16 @@ namespace Barotrauma.Items.Components
return true;
}
public override bool Select(Character character)
{
if (itemList.Selected != null)
{
SelectItem(itemList.Selected, itemList.Selected.UserData);
}
return base.Select(character);
}
public override bool Pick(Character picker)
{
return (picker != null);
@@ -224,16 +238,6 @@ namespace Barotrauma.Items.Components
item.NewComponentEvent(this, true, true);
}
//listElement.Color = Color.Green;
//itemList.Enabled = false;
//activateButton.Text = "Cancel";
//fabricatedItem = obj as FabricableItem;
//IsActive = true;
//timeUntilReady = fabricatedItem.RequiredTime;
return true;
}
@@ -18,6 +18,8 @@ namespace Barotrauma.Items.Components
List<Vent> ventList;
private float totalHullVolume;
public bool IsRunning()
{
return (running && item.Condition>0.0f);
@@ -98,18 +100,27 @@ namespace Barotrauma.Items.Components
if (linkedItem == null) continue;
Vent vent = linkedItem.GetComponent<Vent>();
if (vent != null) ventList.Add(vent);
if (vent == null) continue;
ventList.Add(vent);
if (linkedItem.CurrentHull!=null) totalHullVolume += linkedItem.CurrentHull.FullVolume;
}
}
public override void OnMapLoaded()
{
GetVents();
}
private void UpdateVents(float deltaOxygen)
{
if (!ventList.Any()) return;
if (!ventList.Any() || totalHullVolume == 0.0f) return;
deltaOxygen = deltaOxygen / ventList.Count;
foreach (Vent v in ventList)
{
v.OxygenFlow = deltaOxygen;
if (v.Item.CurrentHull == null) continue;
v.OxygenFlow = deltaOxygen * (v.Item.CurrentHull.FullVolume / totalHullVolume);
v.IsActive = true;
}
}