Endworm attacks working, itemlabel text saving bugfix, deconstructors & fabricators need power, engine sprite, disable wire node dragging in character mode, only hit with one meleeweapon at a time, fixrequirement text overflow fix, mapentities can hace multiple categories, Gap.FindHull fix, Waypoint ladder & gap saving, stuff

This commit is contained in:
Regalis
2016-01-18 20:09:38 +02:00
parent 5f1cb194ab
commit 1a5b3fa66a
39 changed files with 206 additions and 152 deletions
@@ -42,14 +42,14 @@
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="704,0,320,400" depth="0.07" origin="0.5,0.5"/> <sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="704,0,320,400" depth="0.07" origin="0.5,0.5"/>
</limb> </limb>
<limb id = "8" width="100" height="450" impacttolerance="100.0"> <limb id = "8" width="50" height="320" impacttolerance="100.0">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="755,552,137,470" depth="0.08" origin="0.5,0.5"/> <sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="755,552,137,470" depth="0.08" origin="0.5,0.5"/>
<attack type="PinchCW" range="500" duration="0.5" damage="30" stun="5.0" structuredamage="500" damagetype="slash"/> <attack type="PinchCW" range="800" duration="0.5" damage="30" stun="5.0" structuredamage="500" damagetype="slash"/>
</limb> </limb>
<limb id = "9" width="100" height="450" impacttolerance="100.0"> <limb id = "9" width="50" height="320" impacttolerance="100.0">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="892,552,137,470" depth="0.08" origin="0.6,0.5"/> <sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="892,552,137,470" depth="0.08" origin="0.6,0.5"/>
<attack type="PinchCCW" range="500" duration="0.5" damage="30" stun="5.0" structuredamage="500" damagetype="slash"/> <attack type="PinchCCW" range="800" duration="0.5" damage="30" stun="5.0" structuredamage="500" damagetype="slash"/>
</limb> </limb>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -2,6 +2,7 @@
<Items> <Items>
<Item <Item
name="Oxygen Tank" name="Oxygen Tank"
category="Equipment,Misc"
Tags="smallitem" Tags="smallitem"
pickdistance="150" pickdistance="150"
price="50"> price="50">
Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 61 KiB

+1 -1
View File
@@ -9,7 +9,7 @@
<Sprite texture ="engine.png" depth="0.8"/> <Sprite texture ="engine.png" depth="0.8"/>
<Engine minvoltage="0.5" powerperforce="10.0" maxforce="500" canbeselected = "true"> <Engine minvoltage="0.5" powerconsumption="2000.0" maxforce="2000" canbeselected = "true">
<GuiFrame rect="0,0,350,160" alignment="Center" color="0.0,0.0,0.0,0.6"/> <GuiFrame rect="0,0,350,160" alignment="Center" color="0.0,0.0,0.0,0.6"/>
<sound file="engine.ogg" type="OnActive" range="3000.0" volume="CurrentVolume" loop="true"/> <sound file="engine.ogg" type="OnActive" range="3000.0" volume="CurrentVolume" loop="true"/>
</Engine> </Engine>
@@ -9,7 +9,7 @@
<Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="0,128,64,128"/> <Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="0,128,64,128"/>
<Fabricator canbeselected = "true"> <Fabricator canbeselected = "true" powerconsumption="500.0">
<GuiFrame rect="0,0,600,400" alignment="Center" color="0.0,0.0,0.0,0.6"/> <GuiFrame rect="0,0,600,400" alignment="Center" color="0.0,0.0,0.0,0.6"/>
@@ -58,7 +58,7 @@
<Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="64,128,64,128"/> <Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="64,128,64,128"/>
<Deconstructor canbeselected = "true"> <Deconstructor canbeselected = "true" powerconsumption="500.0">
<sound file="deconstructor.ogg" type="OnActive" range="1000.0" loop="true"/> <sound file="deconstructor.ogg" type="OnActive" range="1000.0" loop="true"/>
<GuiFrame rect="0,0,300,200" alignment="Center" color="0.0,0.0,0.0,0.6"/> <GuiFrame rect="0,0,300,200" alignment="Center" color="0.0,0.0,0.0,0.6"/>
+1 -2
View File
@@ -69,8 +69,7 @@
name="Incendium Fuel Rod" name="Incendium Fuel Rod"
Tags="smallitem" Tags="smallitem"
pickdistance="150" pickdistance="150"
spritecolor="0.5,0.0,0.0,1.0" spritecolor="0.5,0.0,0.0,1.0">
price="200">
<Sprite texture ="fuelrod.png"/> <Sprite texture ="fuelrod.png"/>
+1 -1
View File
@@ -64,7 +64,7 @@
<Item <Item
name="Railgun Shell" name="Railgun Shell"
category="Equipment" category="Misc"
pickdistance="200" pickdistance="200"
price="100"> price="100">
+3 -3
View File
@@ -83,7 +83,7 @@
<Body width="90" height="30" density="10"/> <Body width="90" height="30" density="10"/>
<MeleeWeapon slots="Any,RightHand" <MeleeWeapon slots="Any,RightHand,LeftHand"
aimpos="50,0" handle1="-5,0" holdangle="10" reload="1.0"> aimpos="50,0" handle1="-5,0" holdangle="10" reload="1.0">
<Attack damage="2" stun="0.2" damagetype="Blunt" sound="Content/Items/Weapons/smack.ogg"/> <Attack damage="2" stun="0.2" damagetype="Blunt" sound="Content/Items/Weapons/smack.ogg"/>
<StatusEffect type="OnUse" target="Contained,Character" Condition="-25.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Weapons/stunbaton.ogg"> <StatusEffect type="OnUse" target="Contained,Character" Condition="-25.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Weapons/stunbaton.ogg">
@@ -104,7 +104,7 @@
<Item <Item
name="Battery Cell" name="Battery Cell"
category="Equipment" category="Equipment,Electrical"
pickdistance="150" pickdistance="150"
tags="smallitem,loadable" tags="smallitem,loadable"
price="50" price="50"
@@ -119,7 +119,7 @@
<Item <Item
name="Fulgurium Battery Cell" name="Fulgurium Battery Cell"
category="Equipment" category="Equipment,Electrical"
pickdistance="150" pickdistance="150"
tags="smallitem,loadable" tags="smallitem,loadable"
description="A battery cell contructed of the rare and poorly understood compound Fulgurium."> description="A battery cell contructed of the rare and poorly understood compound Fulgurium.">
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

+1 -1
View File
@@ -17,7 +17,7 @@
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="192,0,64,64"/> <Sprite texture="Content/UI/orderSymbols.png" sourcerect="192,0,64,64"/>
</Order> </Order>
<Order name="Operate Railgun" doingtext="Operating Railgun" targetitemtype="Turret" options="Fire at will, Hold fire" color="1.0,0.0,0.0,1.0"> <Order name="Operate Railgun" doingtext="Operating Railgun" targetitemtype="Turret" usecontroller="true" options="Fire at will, Hold fire" color="1.0,0.0,0.0,1.0">
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="0,64,64,64"/> <Sprite texture="Content/UI/orderSymbols.png" sourcerect="0,64,64,64"/>
</Order> </Order>
</Orders> </Orders>
@@ -35,7 +35,7 @@ namespace Barotrauma
public override bool IsCompleted() public override bool IsCompleted()
{ {
return isCompleted; return isCompleted || container.Inventory.FindItem(itemName)!=null;
} }
protected override void Act(float deltaTime) protected override void Act(float deltaTime)
@@ -59,6 +59,8 @@ namespace Barotrauma
protected override void Act(float deltaTime) protected override void Act(float deltaTime)
{ {
if (target == character) return;
waitUntilPathUnreachable -= deltaTime; waitUntilPathUnreachable -= deltaTime;
if (character.SelectedConstruction!=null && character.SelectedConstruction.GetComponent<Ladder>()==null) if (character.SelectedConstruction!=null && character.SelectedConstruction.GetComponent<Ladder>()==null)
@@ -85,12 +85,12 @@ namespace Barotrauma
currentObjective = new AIObjectiveGoTo(Character.Controlled, character, true); currentObjective = new AIObjectiveGoTo(Character.Controlled, character, true);
break; break;
case "wait": case "wait":
currentObjective = new AIObjectiveGoTo(character.SimPosition, character, true); currentObjective = new AIObjectiveGoTo(character, character, true);
break; break;
default: default:
if (order.TargetItem == null) return; if (order.TargetItem == null) return;
currentObjective = new AIObjectiveOperateItem(order.TargetItem, character, option); currentObjective = new AIObjectiveOperateItem(order.TargetItem, character, option, null, order.UseController);
break; break;
} }
@@ -30,15 +30,19 @@ namespace Barotrauma
get { return operateTarget; } get { return operateTarget; }
} }
public AIObjectiveOperateItem(ItemComponent item, Character character, string option, Entity operateTarget = null) public AIObjectiveOperateItem(ItemComponent item, Character character, string option, Entity operateTarget = null, bool useController = false)
:base (character, option) :base (character, option)
{ {
component = item; component = item;
this.operateTarget = operateTarget; this.operateTarget = operateTarget;
var controllers = item.Item.GetConnectedComponents<Controller>(); if (useController)
if (controllers.Any()) component = controllers[0]; {
var controllers = item.Item.GetConnectedComponents<Controller>();
if (controllers.Any()) component = controllers[0];
}
canBeCompleted = true; canBeCompleted = true;
} }
+11 -6
View File
@@ -24,6 +24,8 @@ namespace Barotrauma
public readonly Color Color; public readonly Color Color;
public readonly bool UseController;
public ItemComponent TargetItem; public ItemComponent TargetItem;
public readonly string[] Options; public readonly string[] Options;
@@ -76,6 +78,8 @@ namespace Barotrauma
Color = new Color(ToolBox.GetAttributeVector4(orderElement, "color", new Vector4(1.0f, 1.0f, 1.0f, 1.0f))); Color = new Color(ToolBox.GetAttributeVector4(orderElement, "color", new Vector4(1.0f, 1.0f, 1.0f, 1.0f)));
UseController = ToolBox.GetAttributeBool(orderElement, "usecontroller", false);
string optionStr = ToolBox.GetAttributeString(orderElement, "options", ""); string optionStr = ToolBox.GetAttributeString(orderElement, "options", "");
if (string.IsNullOrWhiteSpace(optionStr)) if (string.IsNullOrWhiteSpace(optionStr))
@@ -112,12 +116,13 @@ namespace Barotrauma
public Order(Order prefab, ItemComponent targetItem) public Order(Order prefab, ItemComponent targetItem)
{ {
Name = prefab.Name; Name = prefab.Name;
DoingText = prefab.DoingText; DoingText = prefab.DoingText;
ItemComponentType = prefab.ItemComponentType; ItemComponentType = prefab.ItemComponentType;
Options = prefab.Options; Options = prefab.Options;
SymbolSprite = prefab.SymbolSprite; SymbolSprite = prefab.SymbolSprite;
Color = prefab.Color; Color = prefab.Color;
UseController = prefab.UseController;
TargetItem = targetItem; TargetItem = targetItem;
} }
+7 -1
View File
@@ -89,6 +89,7 @@ namespace Barotrauma
private Character closestCharacter, selectedCharacter; private Character closestCharacter, selectedCharacter;
protected bool isDead; protected bool isDead;
private CauseOfDeath causeOfDeath;
public readonly bool IsHumanoid; public readonly bool IsHumanoid;
@@ -291,6 +292,11 @@ namespace Barotrauma
get { return isDead; } get { return isDead; }
} }
public CauseOfDeath CauseOfDeath
{
get { return causeOfDeath; }
}
public override Vector2 SimPosition public override Vector2 SimPosition
{ {
get { return AnimController.RefLimb.SimPosition; } get { return AnimController.RefLimb.SimPosition; }
@@ -915,7 +921,6 @@ namespace Barotrauma
if (!protectedFromPressure && if (!protectedFromPressure &&
(AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 100.0f)) (AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 100.0f))
{ {
PressureTimer += ((AnimController.CurrentHull == null) ? PressureTimer += ((AnimController.CurrentHull == null) ?
100.0f : AnimController.CurrentHull.LethalPressure) * deltaTime; 100.0f : AnimController.CurrentHull.LethalPressure) * deltaTime;
@@ -1222,6 +1227,7 @@ namespace Barotrauma
health = 0.0f; health = 0.0f;
isDead = true; isDead = true;
this.causeOfDeath = causeOfDeath;
AnimController.movement = Vector2.Zero; AnimController.movement = Vector2.Zero;
AnimController.TargetMovement = Vector2.Zero; AnimController.TargetMovement = Vector2.Zero;
+6 -3
View File
@@ -150,12 +150,12 @@ namespace Barotrauma
NewMessage("menu: go to main menu", Color.Cyan); NewMessage("menu: go to main menu", Color.Cyan);
NewMessage("game: enter the ''game screen''", Color.Cyan); NewMessage("game: enter the ''game screen''", Color.Cyan);
NewMessage("edit: switch to submarine editor", Color.Cyan); NewMessage("edit: switch to submarine editor", Color.Cyan);
NewMessage("load [submarine name]: load a submarine!", Color.Cyan); NewMessage("edit [submarine name]: load a submarine and switch to submarine editor", Color.Cyan);
NewMessage("load [submarine name]: load a submarine", Color.Cyan);
NewMessage("save [submarine name]: save the current submarine using the specified name", Color.Cyan); NewMessage("save [submarine name]: save the current submarine using the specified name", Color.Cyan);
NewMessage(" ", Color.Cyan); NewMessage(" ", Color.Cyan);
NewMessage("spawn: spawn a creature at a random spawnpoint", Color.Cyan); NewMessage("spawn: spawn a creature at a random spawnpoint", Color.Cyan);
NewMessage("spawn: spawn a creature at a random spawnpoint", Color.Cyan); NewMessage("spawn: spawn a creature at a random spawnpoint", Color.Cyan);
@@ -187,7 +187,6 @@ namespace Barotrauma
NewMessage("debugdraw: toggles the ''debug draw mode''", Color.Cyan); NewMessage("debugdraw: toggles the ''debug draw mode''", Color.Cyan);
NewMessage("netstats: toggles the visibility of the network statistics panel", Color.Cyan); NewMessage("netstats: toggles the visibility of the network statistics panel", Color.Cyan);
break; break;
case "createfilelist": case "createfilelist":
UpdaterUtil.SaveFileList("filelist.xml"); UpdaterUtil.SaveFileList("filelist.xml");
@@ -242,6 +241,10 @@ namespace Barotrauma
case "editmapscreen": case "editmapscreen":
case "editmap": case "editmap":
case "edit": case "edit":
if (commands.Length>1)
{
Submarine.Load(string.Join(" ", commands.Skip(1)));
}
GameMain.EditMapScreen.Select(); GameMain.EditMapScreen.Select();
break; break;
case "test": case "test":
@@ -254,7 +254,7 @@ namespace Barotrauma.Tutorials
infoBox = CreateInfoFrame("Steer the submarine downwards, heading further into the cavern."); infoBox = CreateInfoFrame("Steer the submarine downwards, heading further into the cavern.");
while (Submarine.Loaded.Position.Y > 31000.0f) while (Submarine.Loaded.Position.Y > 10000.0f)
{ {
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
} }
+18 -29
View File
@@ -10,27 +10,25 @@ namespace Barotrauma
{ {
class ShiftSummary class ShiftSummary
{ {
class Casualty //class Casualty
{ //{
public readonly CharacterInfo character; // public readonly CharacterInfo character;
public readonly CauseOfDeath causeOfDeath; // public readonly CauseOfDeath causeOfDeath;
public readonly string description; // public readonly string description;
public Casualty(CharacterInfo characterInfo, CauseOfDeath causeOfDeath, string description) // public Casualty(CharacterInfo characterInfo, CauseOfDeath causeOfDeath, string description)
{ // {
this.character = characterInfo; // this.character = characterInfo;
this.causeOfDeath = causeOfDeath; // this.causeOfDeath = causeOfDeath;
this.description = description; // this.description = description;
} // }
} //}
private Location startLocation, endLocation; private Location startLocation, endLocation;
private GameSession gameSession; private GameSession gameSession;
private List<Casualty> casualties;
private Mission selectedMission; private Mission selectedMission;
public ShiftSummary(GameSession gameSession) public ShiftSummary(GameSession gameSession)
@@ -40,21 +38,14 @@ namespace Barotrauma
startLocation = gameSession.Map==null ? null : gameSession.Map.CurrentLocation; startLocation = gameSession.Map==null ? null : gameSession.Map.CurrentLocation;
endLocation = gameSession.Map==null ? null : gameSession.Map.SelectedLocation; endLocation = gameSession.Map==null ? null : gameSession.Map.SelectedLocation;
casualties = new List<Casualty>();
foreach (Character character in gameSession.CrewManager.characters)
{
character.OnDeath = AddCasualty;
}
selectedMission = gameSession.Mission; selectedMission = gameSession.Mission;
} }
public void AddCasualty(Character character, CauseOfDeath causeOfDeath) //public void AddCasualty(Character character, CauseOfDeath causeOfDeath)
{ //{
casualties.Add(new Casualty(character.Info, causeOfDeath, "")); // casualties.Add(new Casualty(character.Info, causeOfDeath, ""));
} //}
public GUIFrame CreateSummaryFrame(string endMessage) public GUIFrame CreateSummaryFrame(string endMessage)
{ {
@@ -107,11 +98,9 @@ namespace Barotrauma
string statusText; string statusText;
Color statusColor; Color statusColor;
var casualty = casualties.Find(c => c.character == character.Info); if (character.IsDead)
if (casualty != null)
{ {
statusText = InfoTextManager.GetInfoText("CauseOfDeath." + casualty.causeOfDeath.ToString()); statusText = InfoTextManager.GetInfoText("CauseOfDeath." + character.CauseOfDeath.ToString());
statusColor = Color.DarkRed; statusColor = Color.DarkRed;
} }
else else
@@ -54,6 +54,17 @@ namespace Barotrauma.Items.Components
if (character == null || reloadTimer>0.0f) return false; if (character == null || reloadTimer>0.0f) return false;
if (!character.IsKeyDown(InputType.Aim) || hitting) return false; if (!character.IsKeyDown(InputType.Aim) || hitting) return false;
//don't allow hitting if the character is already hitting with another weapon
for (int i = 0; i < 2; i++ )
{
if (character.SelectedItems[i] == null || character.SelectedItems[i] == Item) continue;
var otherWeapon = character.SelectedItems[i].GetComponent<MeleeWeapon>();
if (otherWeapon == null) continue;
if (otherWeapon.hitting) return false;
}
SetUser(character); SetUser(character);
if (hitPos < MathHelper.Pi * 0.69f) return false; if (hitPos < MathHelper.Pi * 0.69f) return false;
@@ -10,7 +10,7 @@ namespace Barotrauma.Items.Components
[HasDefaultValue("", true), Editable(100)] [HasDefaultValue("", true), Editable(100)]
public string Text public string Text
{ {
get { return textBlock.Text; } get { return textBlock.Text.Replace("\n", ""); }
set set
{ {
if (value == TextBlock.Text || item.Rect.Width < 5) return; if (value == TextBlock.Text || item.Rect.Width < 5) return;
@@ -8,7 +8,7 @@ using System.Xml.Linq;
namespace Barotrauma.Items.Components namespace Barotrauma.Items.Components
{ {
class Deconstructor : ItemComponent class Deconstructor : Powered
{ {
GUIProgressBar progressBar; GUIProgressBar progressBar;
GUIButton activateButton; GUIButton activateButton;
@@ -39,7 +39,12 @@ namespace Barotrauma.Items.Components
return; return;
} }
progressTimer += deltaTime; if (voltage < minVoltage) return;
if (powerConsumption == 0.0f) voltage = 1.0f;
progressTimer += deltaTime*voltage;
Voltage -= deltaTime * 10.0f;
var targetItem = container.Inventory.Items.FirstOrDefault(i => i != null); var targetItem = container.Inventory.Items.FirstOrDefault(i => i != null);
progressBar.BarSize = Math.Min(progressTimer / targetItem.Prefab.DeconstructTime, 1.0f); progressBar.BarSize = Math.Min(progressTimer / targetItem.Prefab.DeconstructTime, 1.0f);
@@ -83,6 +88,8 @@ namespace Barotrauma.Items.Components
{ {
SetActive(!IsActive); SetActive(!IsActive);
currPowerConsumption = IsActive ? powerConsumption : 0.0f;
item.NewComponentEvent(this, true, true); item.NewComponentEvent(this, true, true);
return true; return true;
@@ -64,7 +64,7 @@ namespace Barotrauma.Items.Components
if (powerConsumption == 0.0f) voltage = 1.0f; if (powerConsumption == 0.0f) voltage = 1.0f;
Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f); Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f);
if (Force != 0.0f) if (Force > 1.0f)
{ {
Vector2 currForce = new Vector2((force / 100.0f) * maxForce * (voltage / minVoltage), 0.0f); Vector2 currForce = new Vector2((force / 100.0f) * maxForce * (voltage / minVoltage), 0.0f);
@@ -72,7 +72,7 @@ namespace Barotrauma.Items.Components
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
{ {
GameMain.ParticleManager.CreateParticle("bubbles", item.WorldPosition, var bubbles = GameMain.ParticleManager.CreateParticle("bubbles", item.WorldPosition - (Vector2.UnitX * item.Rect.Width/2),
-currForce / 5.0f + new Vector2(Rand.Range(-100.0f, 100.0f), Rand.Range(-50f, 50f)), -currForce / 5.0f + new Vector2(Rand.Range(-100.0f, 100.0f), Rand.Range(-50f, 50f)),
0.0f, item.CurrentHull); 0.0f, item.CurrentHull);
} }
@@ -56,7 +56,7 @@ namespace Barotrauma.Items.Components
} }
} }
class Fabricator : ItemComponent class Fabricator : Powered
{ {
private List<FabricableItem> fabricableItems; private List<FabricableItem> fabricableItems;
@@ -64,8 +64,8 @@ namespace Barotrauma.Items.Components
private GUIFrame selectedItemFrame; private GUIFrame selectedItemFrame;
GUIProgressBar progressBar; private GUIProgressBar progressBar;
GUIButton activateButton; private GUIButton activateButton;
private FabricableItem fabricatedItem; private FabricableItem fabricatedItem;
private float timeUntilReady; private float timeUntilReady;
@@ -208,6 +208,8 @@ namespace Barotrauma.Items.Components
var containers = item.GetComponents<ItemContainer>(); var containers = item.GetComponents<ItemContainer>();
containers[0].Inventory.Locked = true; containers[0].Inventory.Locked = true;
containers[1].Inventory.Locked = true; containers[1].Inventory.Locked = true;
currPowerConsumption = powerConsumption;
} }
private void CancelFabricating() private void CancelFabricating()
@@ -216,6 +218,8 @@ namespace Barotrauma.Items.Components
IsActive = false; IsActive = false;
fabricatedItem = null; fabricatedItem = null;
currPowerConsumption = 0.0f;
if (activateButton != null) if (activateButton != null)
{ {
activateButton.Text = "Create"; activateButton.Text = "Create";
@@ -231,13 +235,19 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
timeUntilReady -= deltaTime;
if (progressBar!=null) if (progressBar!=null)
{ {
progressBar.BarSize = fabricatedItem == null ? 0.0f : (fabricatedItem.RequiredTime - timeUntilReady) / fabricatedItem.RequiredTime; progressBar.BarSize = fabricatedItem == null ? 0.0f : (fabricatedItem.RequiredTime - timeUntilReady) / fabricatedItem.RequiredTime;
} }
if (voltage < minVoltage) return;
if (powerConsumption == 0) voltage = 1.0f;
timeUntilReady -= deltaTime*voltage;
voltage -= deltaTime * 10.0f;
if (timeUntilReady > 0.0f) return; if (timeUntilReady > 0.0f) return;
var containers = item.GetComponents<ItemContainer>(); var containers = item.GetComponents<ItemContainer>();
@@ -406,14 +406,14 @@ namespace Barotrauma.Items.Components
//temperature too high/low //temperature too high/low
if (Math.Abs(tempDiff)>500.0f) if (Math.Abs(tempDiff)>500.0f)
{ {
autoTemp = false; AutoTemp = false;
FissionRate += deltaTime * 100.0f * Math.Sign(tempDiff); FissionRate += deltaTime * 100.0f * Math.Sign(tempDiff);
CoolingRate -= deltaTime * 100.0f * Math.Sign(tempDiff); CoolingRate -= deltaTime * 100.0f * Math.Sign(tempDiff);
} }
//temperature OK //temperature OK
else else
{ {
autoTemp = true; AutoTemp = true;
} }
break; break;
@@ -566,7 +566,7 @@ namespace Barotrauma.Items.Components
return; return;
} }
autoTemp = newAutoTemp; AutoTemp = newAutoTemp;
Temperature = newTemperature; Temperature = newTemperature;
ShutDownTemp = newShutDownTemp; ShutDownTemp = newShutDownTemp;
@@ -63,7 +63,8 @@ namespace Barotrauma.Items.Components
pt.Item.SendSignal("", "power", fullPower / Math.Max(fullLoad, 1.0f)); pt.Item.SendSignal("", "power", fullPower / Math.Max(fullLoad, 1.0f));
//damage the item if voltage is too high //damage the item if voltage is too high
if (-pt.currPowerConsumption < Math.Max(pt.powerLoad * 2.0f, 200.0f)) continue; if (-pt.currPowerConsumption < Math.Max(pt.powerLoad * Rand.Range(1.95f,2.05f), 200.0f)) continue;
float prevCondition = pt.item.Condition; float prevCondition = pt.item.Condition;
pt.item.Condition -= deltaTime * 10.0f; pt.item.Condition -= deltaTime * 10.0f;
@@ -328,7 +328,7 @@ namespace Barotrauma.Items.Components
//nodes.Add(newNodePos); //nodes.Add(newNodePos);
} }
if (!editing || !PlayerInput.MouseInsideWindow) return; if (!editing || !PlayerInput.MouseInsideWindow || GameMain.EditMapScreen.CharacterMode) return;
for (int i = 0; i < Nodes.Count; i++) for (int i = 0; i < Nodes.Count; i++)
{ {
@@ -347,13 +347,13 @@ namespace Barotrauma.Items.Components
} }
MapEntity.DisableSelect = true;
GUI.DrawRectangle(spriteBatch, worldPos + new Vector2(-10, -10), new Vector2(20, 20), Color.Red, false, 0.0f); GUI.DrawRectangle(spriteBatch, worldPos + new Vector2(-10, -10), new Vector2(20, 20), Color.Red, false, 0.0f);
if (selectedNodeIndex == null && draggingWire == null)// && !MapEntity.SelectedAny) if (selectedNodeIndex == null && draggingWire == null)// && !MapEntity.SelectedAny)
{ {
if (PlayerInput.LeftButtonDown() && PlayerInput.GetOldMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released) if (PlayerInput.LeftButtonDown() && PlayerInput.GetOldMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released)
{ {
MapEntity.DisableSelect = true;
MapEntity.SelectEntity(item); MapEntity.SelectEntity(item);
draggingWire = this; draggingWire = this;
selectedNodeIndex = i; selectedNodeIndex = i;
@@ -371,6 +371,7 @@ namespace Barotrauma.Items.Components
{ {
if (selectedNodeIndex != null && draggingWire == this) if (selectedNodeIndex != null && draggingWire == this)
{ {
MapEntity.DisableSelect = true; MapEntity.DisableSelect = true;
//Nodes[(int)selectedNodeIndex] = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition)-Submarine.HiddenSubPosition+Submarine.Loaded.Position; //Nodes[(int)selectedNodeIndex] = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition)-Submarine.HiddenSubPosition+Submarine.Loaded.Position;
+1 -1
View File
@@ -118,7 +118,7 @@ namespace Barotrauma
y2 = 20; y2 = 20;
foreach (Skill skill in requirement.requiredSkills) foreach (Skill skill in requirement.requiredSkills)
{ {
var skillBlock = new GUITextBlock(new Rectangle(150, y2, 200, 15), skill.Name + " - " + skill.Level, GUI.Style, Alignment.Right, Alignment.TopLeft, reqFrame); var skillBlock = new GUITextBlock(new Rectangle(0, y2, 200, 15), skill.Name + " - " + skill.Level, GUI.Style, Alignment.Right, Alignment.TopLeft, reqFrame);
skillBlock.Font = GUI.SmallFont; skillBlock.Font = GUI.SmallFont;
skillBlock.UserData = skill; skillBlock.UserData = skill;
+4 -4
View File
@@ -740,7 +740,7 @@ namespace Barotrauma
private GUIComponent CreateEditingHUD(bool inGame=false) private GUIComponent CreateEditingHUD(bool inGame=false)
{ {
int width = 400; int width = 450;
int x = GameMain.GraphicsWidth/2-width/2, y = 10; int x = GameMain.GraphicsWidth/2-width/2, y = 10;
List<ObjectProperty> editableProperties = inGame ? GetProperties<InGameEditable>() : GetProperties<Editable>(); List<ObjectProperty> editableProperties = inGame ? GetProperties<InGameEditable>() : GetProperties<Editable>();
@@ -768,7 +768,7 @@ namespace Barotrauma
if (prefab.IsLinkable) if (prefab.IsLinkable)
{ {
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to another item", new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to another item",
GUI.Style, Alignment.TopLeft, Alignment.TopRight, editingHUD); GUI.Style, Alignment.TopRight, Alignment.TopRight, editingHUD).Font = GUI.SmallFont;
y += 25; y += 25;
} }
foreach (ItemComponent ic in components) foreach (ItemComponent ic in components)
@@ -776,7 +776,7 @@ namespace Barotrauma
foreach (RelatedItem relatedItem in ic.requiredItems) foreach (RelatedItem relatedItem in ic.requiredItems)
{ {
new GUITextBlock(new Rectangle(0, y, 100, 20), ic.Name + ": " + relatedItem.Type.ToString() + " required", GUI.Style, editingHUD); new GUITextBlock(new Rectangle(0, y, 100, 20), ic.Name + ": " + relatedItem.Type.ToString() + " required", GUI.Style, editingHUD);
GUITextBox namesBox = new GUITextBox(new Rectangle(0, y, 200, 20), Alignment.Right, GUI.Style, editingHUD); GUITextBox namesBox = new GUITextBox(new Rectangle(-10, y, 160, 20), Alignment.Right, GUI.Style, editingHUD);
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (relatedItem); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (relatedItem);
PropertyDescriptor property = properties.Find("JoinedNames", false); PropertyDescriptor property = properties.Find("JoinedNames", false);
@@ -800,7 +800,7 @@ namespace Barotrauma
var editable = objectProperty.Attributes.OfType<Editable>().FirstOrDefault<Editable>(); var editable = objectProperty.Attributes.OfType<Editable>().FirstOrDefault<Editable>();
if (editable != null) height = (int)(Math.Ceiling(editable.MaxLength / 20.0f) * 20.0f); if (editable != null) height = (int)(Math.Ceiling(editable.MaxLength / 20.0f) * 20.0f);
GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, height), GUI.Style, editingHUD); GUITextBox propertyBox = new GUITextBox(new Rectangle(180, y, 250, height), GUI.Style, editingHUD);
if (height>20) propertyBox.Wrap = true; if (height>20) propertyBox.Wrap = true;
object value = objectProperty.GetValue(); object value = objectProperty.GetValue();
+13 -3
View File
@@ -196,9 +196,19 @@ namespace Barotrauma
FireProof = ToolBox.GetAttributeBool(element, "fireproof", false); FireProof = ToolBox.GetAttributeBool(element, "fireproof", false);
MapEntityCategory category;
Enum.TryParse(ToolBox.GetAttributeString(element, "category", "Misc"), out category); string categoriesStr = ToolBox.GetAttributeString(element, "category", "Misc");
Category = category; string[] categories = categoriesStr.Split(',');
for (int i = 0; i<categories.Length; i++)
{
MapEntityCategory category;
if (Enum.TryParse(ToolBox.GetAttributeString(element, "category", "Misc"), out category))
{
Category = i == 0 ? category : Category | category;
}
}
string spriteColorStr = ToolBox.GetAttributeString(element, "spritecolor", "1.0,1.0,1.0,1.0"); string spriteColorStr = ToolBox.GetAttributeString(element, "spritecolor", "1.0,1.0,1.0,1.0");
SpriteColor = new Color(ToolBox.ParseToVector4(spriteColorStr)); SpriteColor = new Color(ToolBox.ParseToVector4(spriteColorStr));
+23 -42
View File
@@ -120,50 +120,39 @@ namespace Barotrauma
linkedTo.Clear(); linkedTo.Clear();
foreach (Hull h in Hull.hullList) Vector2[] searchPos = new Vector2[2];
if (isHorizontal)
{ {
if (!Submarine.RectsOverlap(h.Rect, rect, false)) continue; searchPos[0] = new Vector2(rect.X, rect.Y - rect.Height / 2);
searchPos[1] = new Vector2(rect.Right, rect.Y - rect.Height / 2);
//if the gap is inside the hull completely, ignore it
if (rect.X > h.Rect.X && rect.X + rect.Width < h.Rect.X+h.Rect.Width &&
rect.Y < h.Rect.Y && rect.Y - rect.Height > h.Rect.Y - h.Rect.Height) continue;
for (int i = 0; i < 2; i++ )
{
if (hulls[i] != null) continue;
hulls[i] = h;
break;
}
if (hulls[1] != null) break;
} }
else
{
searchPos[0] = new Vector2(rect.Center.X, rect.Y);
searchPos[1] = new Vector2(rect.Center.X, rect.Y - rect.Height);
}
hulls[0] = Hull.FindHullOld(searchPos[0], null, false);
hulls[1] = Hull.FindHullOld(searchPos[1], null, false);
if (hulls[0] == null && hulls[1] == null) return; if (hulls[0] == null && hulls[1] == null) return;
if (hulls[0] != null && hulls[1] != null) if (hulls[0]==null && hulls[1]!=null)
{ {
if ((isHorizontal && hulls[0].Rect.X > hulls[1].Rect.X) || (!isHorizontal && hulls[0].Rect.Y < hulls[1].Rect.Y)) Hull temp = hulls[0];
{ hulls[0] = hulls[1];
//make sure that hull1 is the lefthand room if the gap is horizontal, hulls[1] = temp;
//or that hull1 is the upper hull if the gap is vertical
Hull temp = hulls[0];
hulls[0] = hulls[1];
hulls[1] = temp;
}
} }
linkedTo.Add(hulls[0]); linkedTo.Add(hulls[0]);
if (hulls[1] != null) linkedTo.Add(hulls[1]); if (hulls[1] != null) linkedTo.Add(hulls[1]);
} }
public override void Draw(SpriteBatch sb, bool editing, bool back = true) public override void Draw(SpriteBatch sb, bool editing, bool back = true)
{ {
if (GameMain.DebugDraw) if (GameMain.DebugDraw)
{ {
Vector2 center = new Vector2(WorldRect.X + rect.Width / 2.0f, -(WorldRect.Y - rect.Width / 2.0f)); Vector2 center = new Vector2(WorldRect.X + rect.Width / 2.0f, -(WorldRect.Y - rect.Height/ 2.0f));
GUI.DrawLine(sb, center, center + flowForce/10.0f, Color.Red); GUI.DrawLine(sb, center, center + flowForce/10.0f, Color.Red);
GUI.DrawLine(sb, center + Vector2.One * 5.0f, center + lerpedFlowForce / 10.0f + Vector2.One * 5.0f, Color.Orange); GUI.DrawLine(sb, center + Vector2.One * 5.0f, center + lerpedFlowForce / 10.0f + Vector2.One * 5.0f, Color.Orange);
@@ -241,7 +230,7 @@ namespace Barotrauma
UpdateRoomToRoom(deltaTime); UpdateRoomToRoom(deltaTime);
} }
lerpedFlowForce = Vector2.Lerp(lerpedFlowForce, flowForce, deltaTime*2.0f); lerpedFlowForce = Vector2.Lerp(lerpedFlowForce, flowForce, deltaTime);
if (LerpedFlowForce.Length() > 100.0f && flowTargetHull != null && flowTargetHull.Volume < flowTargetHull.FullVolume) if (LerpedFlowForce.Length() > 100.0f && flowTargetHull != null && flowTargetHull.Volume < flowTargetHull.FullVolume)
{ {
@@ -276,19 +265,21 @@ namespace Barotrauma
} }
else else
{ {
if (Math.Sign(flowTargetHull.Rect.Y - rect.Y) != Math.Sign(lerpedFlowForce.Y)) return;
pos.Y += Math.Sign(flowForce.Y) * rect.Height / 2.0f; pos.Y += Math.Sign(flowForce.Y) * rect.Height / 2.0f;
for (int i = 0; i < rect.Width; i += (int)Rand.Range(80, 100)) for (int i = 0; i < rect.Width; i += (int)Rand.Range(80, 100))
{ {
pos.X = Rand.Range(rect.X, rect.X + rect.Width); pos.X = Rand.Range(rect.X, rect.X + rect.Width);
Vector2 velocity = new Vector2( Vector2 velocity = new Vector2(
flowForce.X * Rand.Range(0.5f, 0.7f), lerpedFlowForce.X * Rand.Range(0.5f, 0.7f),
Math.Max(flowForce.Y,-100.0f) * Rand.Range(0.5f, 0.7f)); Math.Max(lerpedFlowForce.Y, -100.0f) * Rand.Range(0.5f, 0.7f));
var splash = GameMain.ParticleManager.CreateParticle( var splash = GameMain.ParticleManager.CreateParticle(
"watersplash", "watersplash",
Submarine.Loaded == null ? pos : pos + Submarine.Loaded.Position, Submarine.Loaded == null ? pos : pos + Submarine.Loaded.Position,
velocity); -velocity);
if (splash != null) splash.Size = splash.Size * MathHelper.Clamp(rect.Width / 50.0f, 0.8f, 4.0f); if (splash != null) splash.Size = splash.Size * MathHelper.Clamp(rect.Width / 50.0f, 0.8f, 4.0f);
@@ -411,21 +402,11 @@ namespace Barotrauma
flowTargetHull = hull1; flowTargetHull = hull1;
//delta = (water2.Pressure - water1.Pressure) * 0.1f;
//if (delta > 0.1f)
//{
// int posX = (int)((rect.X + size / 2.0f - water1.Rect.X) / Hull.WaveWidth);
// //water1.WaveY[posX] = delta;
// water1.WaveVel[posX] = delta * 0.01f;
//}
if (hull1.Volume > hull1.FullVolume) if (hull1.Volume > hull1.FullVolume)
{ {
hull1.Pressure = Math.Max(hull1.Pressure, (hull1.Pressure + hull2.Pressure) / 2); hull1.Pressure = Math.Max(hull1.Pressure, (hull1.Pressure + hull2.Pressure) / 2);
} }
} }
//there's water in the upper room, drop to lower //there's water in the upper room, drop to lower
else if (hull1.Volume > 0) else if (hull1.Volume > 0)
+6 -1
View File
@@ -7,9 +7,10 @@ using Microsoft.Xna.Framework.Input;
namespace Barotrauma namespace Barotrauma
{ {
[Flags]
enum MapEntityCategory enum MapEntityCategory
{ {
Structure, Machine, Equipment, Electrical, Material, Misc Structure = 1, Machine = 2, Equipment = 4, Electrical = 8, Material = 16, Misc = 32
} }
class MapEntityPrefab class MapEntityPrefab
@@ -116,6 +117,10 @@ namespace Barotrauma
} }
public MapEntityPrefab()
{
Category = MapEntityCategory.Structure;
}
public virtual void UpdatePlacing(SpriteBatch spriteBatch, Camera cam) public virtual void UpdatePlacing(SpriteBatch spriteBatch, Camera cam)
{ {
+22 -6
View File
@@ -33,8 +33,10 @@ namespace Barotrauma
private Hull currentHull; private Hull currentHull;
private ushort ladderId;
public Ladder Ladders; public Ladder Ladders;
private ushort gapId;
public Gap ConnectedGap public Gap ConnectedGap
{ {
get; get;
@@ -198,8 +200,8 @@ namespace Barotrauma
spawnType += (int)button.UserData; spawnType += (int)button.UserData;
if (spawnType > SpawnType.Path) spawnType = SpawnType.Human; if (spawnType > SpawnType.Cargo) spawnType = SpawnType.Path;
if (spawnType < SpawnType.Human) spawnType = SpawnType.Path; if (spawnType < SpawnType.Path) spawnType = SpawnType.Cargo;
spawnTypeText.Text = spawnType.ToString(); spawnTypeText.Text = spawnType.ToString();
@@ -430,6 +432,7 @@ namespace Barotrauma
if (door != null) if (door != null)
{ {
WayPoint newPoint = new WayPoint(door.Item.Position, SpawnType.Path, Submarine.Loaded); WayPoint newPoint = new WayPoint(door.Item.Position, SpawnType.Path, Submarine.Loaded);
newPoint.Ladders = ladders;
newPoint.ConnectedGap = door.LinkedGap; newPoint.ConnectedGap = door.LinkedGap;
newPoint.ConnectTo(prevPoint); newPoint.ConnectTo(prevPoint);
@@ -656,6 +659,15 @@ namespace Barotrauma
public override void OnMapLoaded() public override void OnMapLoaded()
{ {
currentHull = Hull.FindHull(WorldPosition, currentHull); currentHull = Hull.FindHull(WorldPosition, currentHull);
if (gapId > 0) ConnectedGap = FindEntityByID(gapId) as Gap;
if (ladderId > 0)
{
var ladderItem = FindEntityByID(ladderId) as Item;
if (ladderItem != null) Ladders = ladderItem.GetComponent<Ladder>();
}
} }
public override XElement Save(XDocument doc) public override XElement Save(XDocument doc)
@@ -673,10 +685,11 @@ namespace Barotrauma
element.Add(new XAttribute("idcardtags", string.Join(",", idCardTags))); element.Add(new XAttribute("idcardtags", string.Join(",", idCardTags)));
} }
if (assignedJob != null) if (assignedJob != null) element.Add(new XAttribute("job", assignedJob.Name));
{
element.Add(new XAttribute("job", assignedJob.Name));
} if (ConnectedGap != null) element.Add(new XAttribute("gap", ConnectedGap.ID));
if (Ladders != null) element.Add(new XAttribute("ladders", Ladders.Item.ID));
doc.Root.Add(element); doc.Root.Add(element);
@@ -718,6 +731,9 @@ namespace Barotrauma
w.assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLower() == jobName); w.assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLower() == jobName);
} }
w.ladderId = (ushort)ToolBox.GetAttributeInt(element, "ladders", 0);
w.gapId = (ushort)ToolBox.GetAttributeInt(element, "gap", 0);
w.linkedToID = new List<ushort>(); w.linkedToID = new List<ushort>();
int i = 0; int i = 0;
while (element.Attribute("linkedto" + i) != null) while (element.Attribute("linkedto" + i) != null)
@@ -767,8 +767,6 @@ namespace Barotrauma.Networking
Character character = Character.Create(ch, position, !isMyCharacter, false); Character character = Character.Create(ch, position, !isMyCharacter, false);
GameMain.GameSession.CrewManager.characters.Add(character); GameMain.GameSession.CrewManager.characters.Add(character);
character.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
character.ID = ID; character.ID = ID;
@@ -777,7 +777,6 @@ namespace Barotrauma.Networking
ConnectedClients[i].Character.GiveJobItems(assignedWayPoints[i]); ConnectedClients[i].Character.GiveJobItems(assignedWayPoints[i]);
GameMain.GameSession.CrewManager.characters.Add(ConnectedClients[i].Character); GameMain.GameSession.CrewManager.characters.Add(ConnectedClients[i].Character);
ConnectedClients[i].Character.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
} }
if (characterInfo != null) if (characterInfo != null)
@@ -788,7 +787,6 @@ namespace Barotrauma.Networking
myCharacter.GiveJobItems(assignedWayPoints[assignedWayPoints.Length - 1]); myCharacter.GiveJobItems(assignedWayPoints[assignedWayPoints.Length - 1]);
GameMain.GameSession.CrewManager.characters.Add(myCharacter); GameMain.GameSession.CrewManager.characters.Add(myCharacter);
myCharacter.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
} }
var startMessage = CreateStartMessage(roundStartSeed, Submarine.Loaded, GameMain.GameSession.gameMode.Preset); var startMessage = CreateStartMessage(roundStartSeed, Submarine.Loaded, GameMain.GameSession.gameMode.Preset);
+13 -6
View File
@@ -57,6 +57,11 @@ namespace Barotrauma
return "Physics bodies: " + GameMain.World.BodyList.Count; return "Physics bodies: " + GameMain.World.BodyList.Count;
} }
public bool CharacterMode
{
get { return characterMode; }
}
public EditMapScreen() public EditMapScreen()
{ {
@@ -98,26 +103,27 @@ namespace Barotrauma
GUItabs = new GUIComponent[Enum.GetValues(typeof(MapEntityCategory)).Length]; GUItabs = new GUIComponent[Enum.GetValues(typeof(MapEntityCategory)).Length];
int width = 400, height = 400; int width = 400, height = 400;
int y = 160; int y = 160;
int i = 0;
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory))) foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
{ {
var catButton = new GUIButton(new Rectangle(0, y, 0, 20), category.ToString(), Alignment.Left, GUI.Style, GUIpanel); var catButton = new GUIButton(new Rectangle(0, y, 0, 20), category.ToString(), Alignment.Left, GUI.Style, GUIpanel);
catButton.UserData = (int)category; catButton.UserData = i;
catButton.OnClicked = SelectTab; catButton.OnClicked = SelectTab;
y+=25; y+=25;
GUItabs[(int)category] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style); GUItabs[i] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
GUItabs[(int)category].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f); GUItabs[i].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 0, 0), Color.White * 0.7f, GUI.Style, GUItabs[(int)category]); GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 0, 0), Color.White * 0.7f, GUI.Style, GUItabs[i]);
itemList.OnSelected = SelectPrefab; itemList.OnSelected = SelectPrefab;
itemList.CheckSelected = MapEntityPrefab.GetSelected; itemList.CheckSelected = MapEntityPrefab.GetSelected;
foreach (MapEntityPrefab ep in MapEntityPrefab.list) foreach (MapEntityPrefab ep in MapEntityPrefab.list)
{ {
if (ep.Category != category) continue; if (!ep.Category.HasFlag(category)) continue;
Color color = ((itemList.CountChildren % 2) == 0) ? Color.Transparent : Color.White * 0.1f; Color color = ((itemList.CountChildren % 2) == 0) ? Color.Transparent : Color.White * 0.1f;
@@ -151,6 +157,7 @@ namespace Barotrauma
itemList.children.Sort((i1, i2) => (i1.UserData as MapEntityPrefab).Name.CompareTo((i2.UserData as MapEntityPrefab).Name)); itemList.children.Sort((i1, i2) => (i1.UserData as MapEntityPrefab).Name.CompareTo((i2.UserData as MapEntityPrefab).Name));
i++;
} }
y+=50; y+=50;
+2 -2
View File
@@ -146,7 +146,7 @@ namespace Barotrauma
int x = selectedItemList.Rect.Width + 40; int x = selectedItemList.Rect.Width + 40;
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory))) foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
{ {
var items = MapEntityPrefab.list.FindAll(ep => ep.Price>0.0f && ep.Category == category); var items = MapEntityPrefab.list.FindAll(ep => ep.Price>0.0f && ep.Category.HasFlag(category));
if (!items.Any()) continue; if (!items.Any()) continue;
var categoryButton = new GUIButton(new Rectangle(x, 0, 100, 20), category.ToString(), GUI.Style, bottomPanel[(int)PanelTab.Store]); var categoryButton = new GUIButton(new Rectangle(x, 0, 100, 20), category.ToString(), GUI.Style, bottomPanel[(int)PanelTab.Store]);
@@ -443,7 +443,7 @@ namespace Barotrauma
storeItemList.ClearChildren(); storeItemList.ClearChildren();
MapEntityCategory category = (MapEntityCategory)selection; MapEntityCategory category = (MapEntityCategory)selection;
var items = MapEntityPrefab.list.FindAll(ep => ep.Price > 0.0f && ep.Category == category); var items = MapEntityPrefab.list.FindAll(ep => ep.Price > 0.0f && ep.Category.HasFlag(category));
int width = storeItemList.Rect.Width; int width = storeItemList.Rect.Width;
Binary file not shown.