Some new wall sprites, wires are automatically dropped if both items they're attached to are removed, other items aren't highlighted while dragging an item in editor

This commit is contained in:
Regalis
2016-05-22 01:31:36 +03:00
parent b2f83b43f8
commit 00b1ec38e2
8 changed files with 107 additions and 49 deletions
@@ -4,7 +4,7 @@
linkable="true"
pickdistance ="150">
<Sprite texture ="locker.png" depth="0.85"/>
<Sprite texture ="locker.png" depth="0.84"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="smallitem"/>
@@ -16,7 +16,7 @@
linkable="true"
pickdistance ="150">
<Sprite texture ="cabinets.png" depth="0.85" sourcerect="0,0,48,64"/>
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,0,48,64"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="chem"/>
@@ -29,7 +29,7 @@
linkable="true"
pickdistance ="150">
<Sprite texture ="cabinets.png" depth="0.85" sourcerect="0,64,48,64"/>
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,64,48,64"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="chem"/>
+38 -17
View File
@@ -21,31 +21,31 @@
description="A decorative structure with no collision detection"
width = "32" height ="128" resizevertical="true"/>
<engineeringLabel sprite="Content/Map/testroom.png" sourcerect="464,336,153,16" depth ="0.99"
<engineeringLabel sprite="Content/Map/testroom.png" sourcerect="448,322,153,16" depth ="0.99"
width = "153" height ="16"/>
<commandLabel sprite="Content/Map/testroom.png" sourcerect="464,352,128,16" depth ="0.99"
<commandLabel sprite="Content/Map/testroom.png" sourcerect="448,339,128,16" depth ="0.99"
width = "128" height ="16"/>
<airlockLabel sprite="Content/Map/testroom.png" sourcerect="464,368,199,16" depth ="0.99"
<airlockLabel sprite="Content/Map/testroom.png" sourcerect="448,356,199,16" depth ="0.99"
width = "99" height ="16"/>
<cabinsLabel sprite="Content/Map/testroom.png" sourcerect="464,384,83,16" depth ="0.99"
<cabinsLabel sprite="Content/Map/testroom.png" sourcerect="448,373,83,16" depth ="0.99"
width = "83" height ="16"/>
<medicalLabel sprite="Content/Map/testroom.png" sourcerect="464,400,110,16" depth ="0.99"
<medicalLabel sprite="Content/Map/testroom.png" sourcerect="448,390,110,16" depth ="0.99"
width = "110" height ="16"/>
<arrowUp sprite="Content/Map/testroom.png" sourcerect="592,367,16,16" depth ="0.99"
<arrowUp sprite="Content/Map/testroom.png" sourcerect="577,356,16,16" depth ="0.99"
width = "16" height ="16"/>
<arrowDown sprite="Content/Map/testroom.png" sourcerect="608,367,16,16" depth ="0.99"
<arrowDown sprite="Content/Map/testroom.png" sourcerect="594,356,16,16" depth ="0.99"
width = "16" height ="16"/>
<arrowLeft sprite="Content/Map/testroom.png" sourcerect="592,383,16,16" depth ="0.99"
<arrowLeft sprite="Content/Map/testroom.png" sourcerect="577,373,16,16" depth ="0.99"
width = "16" height ="16"/>
<arrowRight sprite="Content/Map/testroom.png" sourcerect="608,383,16,16" depth ="0.99"
<arrowRight sprite="Content/Map/testroom.png" sourcerect="597,373,16,16" depth ="0.99"
width = "16" height ="16"/>
<leftwall sprite="Content/Map/testroom.png" sourcerect="990,274,32,512" depth ="0.05" castshadow="true"
@@ -56,14 +56,31 @@
description="A vertical wall with collision detection"
width = "32" height ="64" resizevertical="true" body="true" health="500"/>
<topwall sprite="Content/Map/testroom.png" sourcerect="208,439,496,32" depth ="0.06" castshadow="true"
<topwall sprite="Content/Map/testroom.png" sourcerect="3,989,512,32" depth ="0.06" castshadow="true"
description="A horizontal wall with collision detection"
width = "64" height ="32" resizehorizontal="true" body="true" health="500"/>
<topwindow sprite="Content/Map/testroom.png" sourcerect="208,352,128,80" depth ="0.05"
<TopWallHeavy sprite="Content/Map/testroom.png" sourcerect="193,414,512,96" depth ="0.06" castshadow="true"
description="A horizontal wall with collision detection"
width = "96" height ="96" resizehorizontal="true" body="true" health="1000"/>
<LeftWallHeavy sprite="Content/Map/testroom.png" sourcerect="0,546,96,384" depth ="0.06" castshadow="true"
description="A horizontal wall with collision detection"
width = "96" height ="96" fliphorizontal="true" resizevertical="true" body="true" health="1000"/>
<RightWallHeavy sprite="Content/Map/testroom.png" sourcerect="0,546,96,384" depth ="0.06" castshadow="true"
description="A horizontal wall with collision detection"
width = "96" height ="96" resizevertical="true" body="true" health="1000"/>
<CableHolderHorizontal sprite="Content/Map/testroom.png" sourcerect="199,348,96,24" depth = "0.85"
width="32" height="24" resizehorizontal="true"/>
<CableHolderVertical sprite="Content/Map/testroom.png" sourcerect="705,416,24,96" depth = "0.85"
width="24" height="32" resizevertical="true"/>
<topwindow sprite="Content/Map/testroom.png" sourcerect="625,327,128,80" depth ="0.05"
width = "128" height ="80" body="true" health="100"/>
<verticalwindow sprite="Content/Map/testroom.png" sourcerect="256,784,128,224" depth ="0.05"
<verticalwindow sprite="Content/Map/testroom.png" sourcerect="399,560,128,224" depth ="0.05"
width = "128" height ="224" body="true" health="100"/>
<horizontalresizablewindow sprite="Content/Map/testroom.png" sourcerect="896,208,128,64" depth ="0.06"
@@ -94,19 +111,23 @@
<bgpanelswindow sprite="Content/Map/testroom.png" sourcerect="752,560,224,224" depth = "1.0"
width="64" height="64" resizehorizontal="true" resizevertical="true"/>
<bgorangepanels sprite="Content/Map/testroom.png" sourcerect="528,784,224,224" depth = "1.0"
<bgorangepanels sprite="Content/Map/testroom.png" sourcerect="576,798,446,224" depth = "1.0"
width="64" height="64" resizehorizontal="true" resizevertical="true"/>
<bgorangepanelwindow sprite="Content/Map/testroom.png" sourcerect="528,563,224,224" depth = "1.0"
width="64" height="64" resizehorizontal="true" resizevertical="true"/>
<stairsright sprite="Content/Map/testroom.png" sourcerect="0,704,256,320"
<PipesBackground sprite="Content/Map/testroom.png" sourcerect="381,795,192,192" depth = "1.0"
width="64" height="64" resizehorizontal="true" resizevertical="true"/>
<stairsright sprite="Content/Map/testroom.png" sourcerect="100,667,256,320"
width="256" height="320" depth = "0.1" stairdirection="Right"/>
<stairsleft sprite="Content/Map/testroom.png" fliphorizontal="true" sourcerect="0,704,256,320"
<stairsleft sprite="Content/Map/testroom.png" fliphorizontal="true" sourcerect="100,667,256,320"
width="256" height="320" depth = "0.1" stairdirection="Left"/>
<bunk sprite="Content/Map/testroom.png" fliphorizontal="true" sourcerect="0,546,173,129"
<bunk sprite="Content/Map/testroom.png" sourcerect="130,514,173,129"
width="173" height="129" depth = "0.9"/>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

+14 -1
View File
@@ -454,7 +454,7 @@ namespace Barotrauma
{
MapEntity me = MapEntity.mapEntityList[i];
if (me.SimPosition.Length()>200.0f)
if (me.SimPosition.Length()>2000.0f)
{
DebugConsole.NewMessage("Removed "+me.Name+" (simposition "+me.SimPosition+")", Color.Orange);
MapEntity.mapEntityList.RemoveAt(i);
@@ -464,6 +464,19 @@ namespace Barotrauma
DebugConsole.NewMessage("Removed " + me.Name + " (MoveWithLevel==true)", Color.Orange);
MapEntity.mapEntityList.RemoveAt(i);
}
else if (me is Item)
{
Item item = me as Item;
var wire = item.GetComponent<Wire>();
if (wire == null) continue;
if (wire.Nodes.Any() && !wire.Connections.Any(c => c != null))
{
wire.Item.Drop(null);
DebugConsole.NewMessage("Dropped wire (ID: "+wire.Item.ID+") - attached on wall but no connections found", Color.Orange);
}
}
}
break;
case "messagebox":
@@ -118,6 +118,26 @@ namespace Barotrauma.Items.Components
loadedConnections[i].wireId.CopyTo(Connections[i].wireId, 0);
}
}
protected override void RemoveComponentSpecific()
{
foreach (Connection c in Connections)
{
foreach (Wire wire in c.Wires)
{
if (wire == null) continue;
if (wire.OtherConnection(c) == null) //wire not connected to anything else
{
wire.Item.Drop(null);
}
else
{
wire.RemoveConnection(item);
}
}
}
}
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
{
@@ -23,6 +23,11 @@ namespace Barotrauma.Items.Components
private static Wire draggingWire;
private static int? selectedNodeIndex;
public Connection[] Connections
{
get { return connections; }
}
public Wire(Item item, XElement element)
: base(item, element)
+15 -12
View File
@@ -857,22 +857,25 @@ namespace Barotrauma
return;
}
GUI.DrawRectangle(spriteBatch, new Vector2(DrawPosition.X - rect.Width / 2, -(DrawPosition.Y+rect.Height/2)), new Vector2(rect.Width, rect.Height), Color.Green);
foreach (Rectangle t in prefab.Triggers)
if (isSelected || isHighlighted)
{
Rectangle transformedTrigger = TransformTrigger(t);
GUI.DrawRectangle(spriteBatch, new Vector2(DrawPosition.X - rect.Width / 2, -(DrawPosition.Y+rect.Height/2)), new Vector2(rect.Width, rect.Height), Color.Green);
Vector2 rectWorldPos = new Vector2(transformedTrigger.X, transformedTrigger.Y);
if (Submarine!=null) rectWorldPos += Submarine.Position;
rectWorldPos.Y = -rectWorldPos.Y;
foreach (Rectangle t in prefab.Triggers)
{
Rectangle transformedTrigger = TransformTrigger(t);
GUI.DrawRectangle(spriteBatch,
rectWorldPos,
new Vector2(transformedTrigger.Width, transformedTrigger.Height),
Color.Green);
Vector2 rectWorldPos = new Vector2(transformedTrigger.X, transformedTrigger.Y);
if (Submarine!=null) rectWorldPos += Submarine.Position;
rectWorldPos.Y = -rectWorldPos.Y;
GUI.DrawRectangle(spriteBatch,
rectWorldPos,
new Vector2(transformedTrigger.Width, transformedTrigger.Height),
Color.Green);
}
}
if (!ShowLinks) return;
foreach (MapEntity e in linkedTo)
+12 -16
View File
@@ -291,20 +291,23 @@ namespace Barotrauma
MapEntity highLightedEntity = null;
foreach (MapEntity e in mapEntityList)
if (startMovingPos == Vector2.Zero)
{
if (!e.SelectableInEditor) continue;
if (highLightedEntity == null || e.Sprite == null ||
(highLightedEntity.Sprite!=null && e.Sprite.Depth < highLightedEntity.Sprite.Depth))
foreach (MapEntity e in mapEntityList)
{
if (!e.SelectableInEditor) continue;
if (e.IsMouseOn(position)) highLightedEntity = e;
if (highLightedEntity == null || e.Sprite == null ||
(highLightedEntity.Sprite != null && e.Sprite.Depth < highLightedEntity.Sprite.Depth))
{
if (e.IsMouseOn(position)) highLightedEntity = e;
}
e.isSelected = false;
}
e.isSelected = false;
}
if (highLightedEntity != null) highLightedEntity.isHighlighted = true;
if (highLightedEntity != null) highLightedEntity.isHighlighted = true;
}
foreach (MapEntity e in selectedList)
{
@@ -551,13 +554,6 @@ namespace Barotrauma
{
resizing = false;
}
//if (resizeHorizontal) placeSize.X = position.X - placePosition.X;
//if (resizeVertical) placeSize.Y = placePosition.Y - position.Y;
//Rectangle newRect = Submarine.AbsRect(placePosition, placeSize);
//newRect.Width = (int)Math.Max(newRect.Width, Submarine.GridSize.X);
//newRect.Height = (int)Math.Max(newRect.Height, Submarine.GridSize.Y);
}
}