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

View File

@@ -42,14 +42,14 @@
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="704,0,320,400" depth="0.07" origin="0.5,0.5"/>
</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"/>
<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 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"/>
<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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -9,7 +9,7 @@
<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"/>
<sound file="engine.ogg" type="OnActive" range="3000.0" volume="CurrentVolume" loop="true"/>
</Engine>

View File

@@ -9,7 +9,7 @@
<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"/>
@@ -58,7 +58,7 @@
<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"/>
<GuiFrame rect="0,0,300,200" alignment="Center" color="0.0,0.0,0.0,0.6"/>

View File

@@ -69,8 +69,7 @@
name="Incendium Fuel Rod"
Tags="smallitem"
pickdistance="150"
spritecolor="0.5,0.0,0.0,1.0"
price="200">
spritecolor="0.5,0.0,0.0,1.0">
<Sprite texture ="fuelrod.png"/>

View File

@@ -64,7 +64,7 @@
<Item
name="Railgun Shell"
category="Equipment"
category="Misc"
pickdistance="200"
price="100">

View File

@@ -83,7 +83,7 @@
<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">
<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">
@@ -104,7 +104,7 @@
<Item
name="Battery Cell"
category="Equipment"
category="Equipment,Electrical"
pickdistance="150"
tags="smallitem,loadable"
price="50"
@@ -119,7 +119,7 @@
<Item
name="Fulgurium Battery Cell"
category="Equipment"
category="Equipment,Electrical"
pickdistance="150"
tags="smallitem,loadable"
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

View File

@@ -17,7 +17,7 @@
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="192,0,64,64"/>
</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"/>
</Order>
</Orders>

View File

@@ -35,7 +35,7 @@ namespace Barotrauma
public override bool IsCompleted()
{
return isCompleted;
return isCompleted || container.Inventory.FindItem(itemName)!=null;
}
protected override void Act(float deltaTime)

View File

@@ -59,6 +59,8 @@ namespace Barotrauma
protected override void Act(float deltaTime)
{
if (target == character) return;
waitUntilPathUnreachable -= deltaTime;
if (character.SelectedConstruction!=null && character.SelectedConstruction.GetComponent<Ladder>()==null)

View File

@@ -85,12 +85,12 @@ namespace Barotrauma
currentObjective = new AIObjectiveGoTo(Character.Controlled, character, true);
break;
case "wait":
currentObjective = new AIObjectiveGoTo(character.SimPosition, character, true);
currentObjective = new AIObjectiveGoTo(character, character, true);
break;
default:
if (order.TargetItem == null) return;
currentObjective = new AIObjectiveOperateItem(order.TargetItem, character, option);
currentObjective = new AIObjectiveOperateItem(order.TargetItem, character, option, null, order.UseController);
break;
}

View File

@@ -30,15 +30,19 @@ namespace Barotrauma
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)
{
component = item;
this.operateTarget = operateTarget;
var controllers = item.Item.GetConnectedComponents<Controller>();
if (controllers.Any()) component = controllers[0];
if (useController)
{
var controllers = item.Item.GetConnectedComponents<Controller>();
if (controllers.Any()) component = controllers[0];
}
canBeCompleted = true;
}

View File

@@ -24,6 +24,8 @@ namespace Barotrauma
public readonly Color Color;
public readonly bool UseController;
public ItemComponent TargetItem;
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)));
UseController = ToolBox.GetAttributeBool(orderElement, "usecontroller", false);
string optionStr = ToolBox.GetAttributeString(orderElement, "options", "");
if (string.IsNullOrWhiteSpace(optionStr))
@@ -112,12 +116,13 @@ namespace Barotrauma
public Order(Order prefab, ItemComponent targetItem)
{
Name = prefab.Name;
DoingText = prefab.DoingText;
ItemComponentType = prefab.ItemComponentType;
Options = prefab.Options;
SymbolSprite = prefab.SymbolSprite;
Color = prefab.Color;
Name = prefab.Name;
DoingText = prefab.DoingText;
ItemComponentType = prefab.ItemComponentType;
Options = prefab.Options;
SymbolSprite = prefab.SymbolSprite;
Color = prefab.Color;
UseController = prefab.UseController;
TargetItem = targetItem;
}

View File

@@ -89,6 +89,7 @@ namespace Barotrauma
private Character closestCharacter, selectedCharacter;
protected bool isDead;
private CauseOfDeath causeOfDeath;
public readonly bool IsHumanoid;
@@ -291,6 +292,11 @@ namespace Barotrauma
get { return isDead; }
}
public CauseOfDeath CauseOfDeath
{
get { return causeOfDeath; }
}
public override Vector2 SimPosition
{
get { return AnimController.RefLimb.SimPosition; }
@@ -915,7 +921,6 @@ namespace Barotrauma
if (!protectedFromPressure &&
(AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 100.0f))
{
PressureTimer += ((AnimController.CurrentHull == null) ?
100.0f : AnimController.CurrentHull.LethalPressure) * deltaTime;
@@ -1222,6 +1227,7 @@ namespace Barotrauma
health = 0.0f;
isDead = true;
this.causeOfDeath = causeOfDeath;
AnimController.movement = Vector2.Zero;
AnimController.TargetMovement = Vector2.Zero;

View File

@@ -150,11 +150,11 @@ namespace Barotrauma
NewMessage("menu: go to main menu", Color.Cyan);
NewMessage("game: enter the ''game screen''", 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(" ", 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);
@@ -186,7 +186,6 @@ namespace Barotrauma
NewMessage("debugdraw: toggles the ''debug draw mode''", Color.Cyan);
NewMessage("netstats: toggles the visibility of the network statistics panel", Color.Cyan);
break;
case "createfilelist":
@@ -241,7 +240,11 @@ namespace Barotrauma
break;
case "editmapscreen":
case "editmap":
case "edit":
case "edit":
if (commands.Length>1)
{
Submarine.Load(string.Join(" ", commands.Skip(1)));
}
GameMain.EditMapScreen.Select();
break;
case "test":

View File

@@ -254,7 +254,7 @@ namespace Barotrauma.Tutorials
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;
}

View File

@@ -10,27 +10,25 @@ namespace Barotrauma
{
class ShiftSummary
{
class Casualty
{
public readonly CharacterInfo character;
public readonly CauseOfDeath causeOfDeath;
//class Casualty
//{
// public readonly CharacterInfo character;
// public readonly CauseOfDeath causeOfDeath;
public readonly string description;
// public readonly string description;
public Casualty(CharacterInfo characterInfo, CauseOfDeath causeOfDeath, string description)
{
this.character = characterInfo;
this.causeOfDeath = causeOfDeath;
this.description = description;
}
}
// public Casualty(CharacterInfo characterInfo, CauseOfDeath causeOfDeath, string description)
// {
// this.character = characterInfo;
// this.causeOfDeath = causeOfDeath;
// this.description = description;
// }
//}
private Location startLocation, endLocation;
private GameSession gameSession;
private List<Casualty> casualties;
private Mission selectedMission;
public ShiftSummary(GameSession gameSession)
@@ -39,22 +37,15 @@ namespace Barotrauma
startLocation = gameSession.Map==null ? null : gameSession.Map.CurrentLocation;
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;
}
public void AddCasualty(Character character, CauseOfDeath causeOfDeath)
{
casualties.Add(new Casualty(character.Info, causeOfDeath, ""));
}
//public void AddCasualty(Character character, CauseOfDeath causeOfDeath)
//{
// casualties.Add(new Casualty(character.Info, causeOfDeath, ""));
//}
public GUIFrame CreateSummaryFrame(string endMessage)
{
@@ -106,12 +97,10 @@ namespace Barotrauma
string statusText;
Color statusColor;
var casualty = casualties.Find(c => c.character == character.Info);
if (casualty != null)
if (character.IsDead)
{
statusText = InfoTextManager.GetInfoText("CauseOfDeath." + casualty.causeOfDeath.ToString());
statusText = InfoTextManager.GetInfoText("CauseOfDeath." + character.CauseOfDeath.ToString());
statusColor = Color.DarkRed;
}
else

View File

@@ -54,6 +54,17 @@ namespace Barotrauma.Items.Components
if (character == null || reloadTimer>0.0f) 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);
if (hitPos < MathHelper.Pi * 0.69f) return false;

View File

@@ -10,7 +10,7 @@ namespace Barotrauma.Items.Components
[HasDefaultValue("", true), Editable(100)]
public string Text
{
get { return textBlock.Text; }
get { return textBlock.Text.Replace("\n", ""); }
set
{
if (value == TextBlock.Text || item.Rect.Width < 5) return;

View File

@@ -8,7 +8,7 @@ using System.Xml.Linq;
namespace Barotrauma.Items.Components
{
class Deconstructor : ItemComponent
class Deconstructor : Powered
{
GUIProgressBar progressBar;
GUIButton activateButton;
@@ -39,7 +39,12 @@ namespace Barotrauma.Items.Components
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);
progressBar.BarSize = Math.Min(progressTimer / targetItem.Prefab.DeconstructTime, 1.0f);
@@ -83,6 +88,8 @@ namespace Barotrauma.Items.Components
{
SetActive(!IsActive);
currPowerConsumption = IsActive ? powerConsumption : 0.0f;
item.NewComponentEvent(this, true, true);
return true;

View File

@@ -64,7 +64,7 @@ namespace Barotrauma.Items.Components
if (powerConsumption == 0.0f) voltage = 1.0f;
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);
@@ -72,7 +72,7 @@ namespace Barotrauma.Items.Components
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)),
0.0f, item.CurrentHull);
}

View File

@@ -56,7 +56,7 @@ namespace Barotrauma.Items.Components
}
}
class Fabricator : ItemComponent
class Fabricator : Powered
{
private List<FabricableItem> fabricableItems;
@@ -64,8 +64,8 @@ namespace Barotrauma.Items.Components
private GUIFrame selectedItemFrame;
GUIProgressBar progressBar;
GUIButton activateButton;
private GUIProgressBar progressBar;
private GUIButton activateButton;
private FabricableItem fabricatedItem;
private float timeUntilReady;
@@ -208,6 +208,8 @@ namespace Barotrauma.Items.Components
var containers = item.GetComponents<ItemContainer>();
containers[0].Inventory.Locked = true;
containers[1].Inventory.Locked = true;
currPowerConsumption = powerConsumption;
}
private void CancelFabricating()
@@ -216,6 +218,8 @@ namespace Barotrauma.Items.Components
IsActive = false;
fabricatedItem = null;
currPowerConsumption = 0.0f;
if (activateButton != null)
{
activateButton.Text = "Create";
@@ -231,13 +235,19 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam)
{
timeUntilReady -= deltaTime;
if (progressBar!=null)
{
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;
var containers = item.GetComponents<ItemContainer>();

View File

@@ -406,14 +406,14 @@ namespace Barotrauma.Items.Components
//temperature too high/low
if (Math.Abs(tempDiff)>500.0f)
{
autoTemp = false;
AutoTemp = false;
FissionRate += deltaTime * 100.0f * Math.Sign(tempDiff);
CoolingRate -= deltaTime * 100.0f * Math.Sign(tempDiff);
}
//temperature OK
else
{
autoTemp = true;
AutoTemp = true;
}
break;
@@ -566,7 +566,7 @@ namespace Barotrauma.Items.Components
return;
}
autoTemp = newAutoTemp;
AutoTemp = newAutoTemp;
Temperature = newTemperature;
ShutDownTemp = newShutDownTemp;

View File

@@ -63,7 +63,8 @@ namespace Barotrauma.Items.Components
pt.Item.SendSignal("", "power", fullPower / Math.Max(fullLoad, 1.0f));
//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;
pt.item.Condition -= deltaTime * 10.0f;

View File

@@ -328,8 +328,8 @@ namespace Barotrauma.Items.Components
//nodes.Add(newNodePos);
}
if (!editing || !PlayerInput.MouseInsideWindow) return;
if (!editing || !PlayerInput.MouseInsideWindow || GameMain.EditMapScreen.CharacterMode) return;
for (int i = 0; i < Nodes.Count; i++)
{
Vector2 worldPos = Nodes[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);
if (selectedNodeIndex == null && draggingWire == null)// && !MapEntity.SelectedAny)
{
if (PlayerInput.LeftButtonDown() && PlayerInput.GetOldMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released)
{
MapEntity.DisableSelect = true;
MapEntity.SelectEntity(item);
draggingWire = this;
selectedNodeIndex = i;
@@ -371,6 +371,7 @@ namespace Barotrauma.Items.Components
{
if (selectedNodeIndex != null && draggingWire == this)
{
MapEntity.DisableSelect = true;
//Nodes[(int)selectedNodeIndex] = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition)-Submarine.HiddenSubPosition+Submarine.Loaded.Position;

View File

@@ -118,7 +118,7 @@ namespace Barotrauma
y2 = 20;
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.UserData = skill;

View File

@@ -740,7 +740,7 @@ namespace Barotrauma
private GUIComponent CreateEditingHUD(bool inGame=false)
{
int width = 400;
int width = 450;
int x = GameMain.GraphicsWidth/2-width/2, y = 10;
List<ObjectProperty> editableProperties = inGame ? GetProperties<InGameEditable>() : GetProperties<Editable>();
@@ -768,7 +768,7 @@ namespace Barotrauma
if (prefab.IsLinkable)
{
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;
}
foreach (ItemComponent ic in components)
@@ -776,7 +776,7 @@ namespace Barotrauma
foreach (RelatedItem relatedItem in ic.requiredItems)
{
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);
PropertyDescriptor property = properties.Find("JoinedNames", false);
@@ -800,7 +800,7 @@ namespace Barotrauma
var editable = objectProperty.Attributes.OfType<Editable>().FirstOrDefault<Editable>();
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;
object value = objectProperty.GetValue();

View File

@@ -196,10 +196,20 @@ namespace Barotrauma
FireProof = ToolBox.GetAttributeBool(element, "fireproof", false);
MapEntityCategory category;
Enum.TryParse(ToolBox.GetAttributeString(element, "category", "Misc"), out category);
Category = category;
string categoriesStr = ToolBox.GetAttributeString(element, "category", "Misc");
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");
SpriteColor = new Color(ToolBox.ParseToVector4(spriteColorStr));

View File

@@ -120,50 +120,39 @@ namespace Barotrauma
linkedTo.Clear();
foreach (Hull h in Hull.hullList)
Vector2[] searchPos = new Vector2[2];
if (isHorizontal)
{
if (!Submarine.RectsOverlap(h.Rect, rect, false)) continue;
//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;
searchPos[0] = new Vector2(rect.X, rect.Y - rect.Height / 2);
searchPos[1] = new Vector2(rect.Right, rect.Y - rect.Height / 2);
}
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)
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))
{
//make sure that hull1 is the lefthand room if the gap is horizontal,
//or that hull1 is the upper hull if the gap is vertical
Hull temp = hulls[0];
hulls[0] = hulls[1];
hulls[1] = temp;
}
Hull temp = hulls[0];
hulls[0] = hulls[1];
hulls[1] = temp;
}
linkedTo.Add(hulls[0]);
if (hulls[1] != null) linkedTo.Add(hulls[1]);
}
public override void Draw(SpriteBatch sb, bool editing, bool back = true)
{
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 + Vector2.One * 5.0f, center + lerpedFlowForce / 10.0f + Vector2.One * 5.0f, Color.Orange);
@@ -241,7 +230,7 @@ namespace Barotrauma
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)
{
@@ -276,19 +265,21 @@ namespace Barotrauma
}
else
{
if (Math.Sign(flowTargetHull.Rect.Y - rect.Y) != Math.Sign(lerpedFlowForce.Y)) return;
pos.Y += Math.Sign(flowForce.Y) * rect.Height / 2.0f;
for (int i = 0; i < rect.Width; i += (int)Rand.Range(80, 100))
{
pos.X = Rand.Range(rect.X, rect.X + rect.Width);
Vector2 velocity = new Vector2(
flowForce.X * Rand.Range(0.5f, 0.7f),
Math.Max(flowForce.Y,-100.0f) * Rand.Range(0.5f, 0.7f));
lerpedFlowForce.X * Rand.Range(0.5f, 0.7f),
Math.Max(lerpedFlowForce.Y, -100.0f) * Rand.Range(0.5f, 0.7f));
var splash = GameMain.ParticleManager.CreateParticle(
"watersplash",
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);
@@ -411,20 +402,10 @@ namespace Barotrauma
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)
{
hull1.Pressure = Math.Max(hull1.Pressure, (hull1.Pressure + hull2.Pressure) / 2);
}
}
}
//there's water in the upper room, drop to lower

View File

@@ -7,9 +7,10 @@ using Microsoft.Xna.Framework.Input;
namespace Barotrauma
{
[Flags]
enum MapEntityCategory
{
Structure, Machine, Equipment, Electrical, Material, Misc
Structure = 1, Machine = 2, Equipment = 4, Electrical = 8, Material = 16, Misc = 32
}
class MapEntityPrefab
@@ -116,6 +117,10 @@ namespace Barotrauma
}
public MapEntityPrefab()
{
Category = MapEntityCategory.Structure;
}
public virtual void UpdatePlacing(SpriteBatch spriteBatch, Camera cam)
{

View File

@@ -33,8 +33,10 @@ namespace Barotrauma
private Hull currentHull;
private ushort ladderId;
public Ladder Ladders;
private ushort gapId;
public Gap ConnectedGap
{
get;
@@ -198,8 +200,8 @@ namespace Barotrauma
spawnType += (int)button.UserData;
if (spawnType > SpawnType.Path) spawnType = SpawnType.Human;
if (spawnType < SpawnType.Human) spawnType = SpawnType.Path;
if (spawnType > SpawnType.Cargo) spawnType = SpawnType.Path;
if (spawnType < SpawnType.Path) spawnType = SpawnType.Cargo;
spawnTypeText.Text = spawnType.ToString();
@@ -430,6 +432,7 @@ namespace Barotrauma
if (door != null)
{
WayPoint newPoint = new WayPoint(door.Item.Position, SpawnType.Path, Submarine.Loaded);
newPoint.Ladders = ladders;
newPoint.ConnectedGap = door.LinkedGap;
newPoint.ConnectTo(prevPoint);
@@ -656,6 +659,15 @@ namespace Barotrauma
public override void OnMapLoaded()
{
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)
@@ -673,10 +685,11 @@ namespace Barotrauma
element.Add(new XAttribute("idcardtags", string.Join(",", idCardTags)));
}
if (assignedJob != null)
{
element.Add(new XAttribute("job", assignedJob.Name));
}
if (assignedJob != null) 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);
@@ -718,6 +731,9 @@ namespace Barotrauma
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>();
int i = 0;
while (element.Attribute("linkedto" + i) != null)

View File

@@ -766,9 +766,7 @@ namespace Barotrauma.Networking
}
Character character = Character.Create(ch, position, !isMyCharacter, false);
GameMain.GameSession.CrewManager.characters.Add(character);
character.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
GameMain.GameSession.CrewManager.characters.Add(character);
character.ID = ID;

View File

@@ -777,7 +777,6 @@ namespace Barotrauma.Networking
ConnectedClients[i].Character.GiveJobItems(assignedWayPoints[i]);
GameMain.GameSession.CrewManager.characters.Add(ConnectedClients[i].Character);
ConnectedClients[i].Character.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
}
if (characterInfo != null)
@@ -788,7 +787,6 @@ namespace Barotrauma.Networking
myCharacter.GiveJobItems(assignedWayPoints[assignedWayPoints.Length - 1]);
GameMain.GameSession.CrewManager.characters.Add(myCharacter);
myCharacter.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
}
var startMessage = CreateStartMessage(roundStartSeed, Submarine.Loaded, GameMain.GameSession.gameMode.Preset);

View File

@@ -57,6 +57,11 @@ namespace Barotrauma
return "Physics bodies: " + GameMain.World.BodyList.Count;
}
public bool CharacterMode
{
get { return characterMode; }
}
public EditMapScreen()
{
@@ -97,27 +102,28 @@ namespace Barotrauma
GUItabs = new GUIComponent[Enum.GetValues(typeof(MapEntityCategory)).Length];
int width = 400, height = 400;
int y = 160;
int i = 0;
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);
catButton.UserData = (int)category;
catButton.UserData = i;
catButton.OnClicked = SelectTab;
y+=25;
GUItabs[(int)category] = 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] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
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.CheckSelected = MapEntityPrefab.GetSelected;
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;
@@ -151,6 +157,7 @@ namespace Barotrauma
itemList.children.Sort((i1, i2) => (i1.UserData as MapEntityPrefab).Name.CompareTo((i2.UserData as MapEntityPrefab).Name));
i++;
}
y+=50;

View File

@@ -146,7 +146,7 @@ namespace Barotrauma
int x = selectedItemList.Rect.Width + 40;
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;
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();
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;

Binary file not shown.