diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj
index bb1f7e392..7840f615f 100644
--- a/Subsurface/Barotrauma.csproj
+++ b/Subsurface/Barotrauma.csproj
@@ -1281,6 +1281,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
diff --git a/Subsurface/Content/Map/testroom.png b/Subsurface/Content/Map/testroom.png
index 3672e0776..2c6332335 100644
Binary files a/Subsurface/Content/Map/testroom.png and b/Subsurface/Content/Map/testroom.png differ
diff --git a/Subsurface/Content/Sounds/Music/Phantom From Space.ogg b/Subsurface/Content/Sounds/Music/Phantom From Space.ogg
new file mode 100644
index 000000000..8707b3e6a
Binary files /dev/null and b/Subsurface/Content/Sounds/Music/Phantom From Space.ogg differ
diff --git a/Subsurface/Content/Sounds/sounds.xml b/Subsurface/Content/Sounds/sounds.xml
index 43114cba9..22f05a258 100644
--- a/Subsurface/Content/Sounds/sounds.xml
+++ b/Subsurface/Content/Sounds/sounds.xml
@@ -43,6 +43,7 @@
+
diff --git a/Subsurface/Properties/AssemblyInfo.cs b/Subsurface/Properties/AssemblyInfo.cs
index d7c0f8b6f..87be44ef2 100644
--- a/Subsurface/Properties/AssemblyInfo.cs
+++ b/Subsurface/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.5.1.1")]
-[assembly: AssemblyFileVersion("0.5.1.1")]
+[assembly: AssemblyVersion("0.5.1.2")]
+[assembly: AssemblyFileVersion("0.5.1.2")]
diff --git a/Subsurface/Source/DebugConsole.cs b/Subsurface/Source/DebugConsole.cs
index 1135aa8ca..3d33e997b 100644
--- a/Subsurface/Source/DebugConsole.cs
+++ b/Subsurface/Source/DebugConsole.cs
@@ -181,6 +181,7 @@ namespace Barotrauma
NewMessage(" ", Color.Cyan);
NewMessage("spawn [creaturename] [near/inside/outside]: spawn a creature at a random spawnpoint (use the second parameter to only select spawnpoints near/inside/outside the submarine)", Color.Cyan);
+ NewMessage("spawnitem [itemname] [cursor/inventory]: spawn an item at the position of the cursor, in the inventory of the controlled character or at a random spawnpoint if the last parameter is omitted", Color.Cyan);
NewMessage(" ", Color.Cyan);
@@ -200,7 +201,7 @@ namespace Barotrauma
NewMessage("revive: bring the controlled character back from the dead", Color.Cyan);
NewMessage(" ", Color.Cyan);
-
+
NewMessage("fixwalls: fixes all the walls", Color.Cyan);
NewMessage("fixitems: fixes every item/device in the sub", Color.Cyan);
NewMessage("oxygen: replenishes the oxygen in every room to 100%", Color.Cyan);
@@ -219,6 +220,7 @@ namespace Barotrauma
UpdaterUtil.SaveFileList("filelist.xml");
break;
case "spawn":
+ case "spawncharacter":
if (commands.Length == 1) return;
Character spawnedCharacter = null;
@@ -231,7 +233,7 @@ namespace Barotrauma
switch (commands[2].ToLowerInvariant())
{
case "inside":
- spawnPoint = WayPoint.GetRandom(SpawnType.Human);
+ spawnPoint = WayPoint.GetRandom(SpawnType.Human, null, Submarine.MainSub);
break;
case "outside":
spawnPoint = WayPoint.GetRandom(SpawnType.Enemy);
@@ -294,6 +296,54 @@ namespace Barotrauma
GameMain.Server.SendCharacterSpawnMessage(spawnedCharacter);
}
+ break;
+ case "spawnitem":
+ if (commands.Length < 2) return;
+
+ Vector2? spawnPos = null;
+ Inventory spawnInventory = null;
+
+ int extraParams = 0;
+ switch (commands.Last())
+ {
+ case "cursor":
+ extraParams = 1;
+ spawnPos = GameMain.GameScreen.Cam.ScreenToWorld(PlayerInput.MousePosition);
+ break;
+ case "inventory":
+ extraParams = 1;
+ spawnInventory = Character.Controlled == null ? null : Character.Controlled.Inventory;
+ break;
+ default:
+ extraParams = 0;
+ break;
+ }
+
+ string itemName = string.Join(" ", commands.Skip(1).Take(commands.Length - extraParams - 1)).ToLowerInvariant();
+
+ var itemPrefab = MapEntityPrefab.list.Find(ip => ip.Name.ToLowerInvariant() == itemName) as ItemPrefab;
+ if (itemPrefab == null)
+ {
+ ThrowError("Item \""+itemName+"\" not found!");
+ return;
+ }
+
+ if (spawnPos == null && spawnInventory == null)
+ {
+ var wp = WayPoint.GetRandom(SpawnType.Human, null, Submarine.MainSub);
+ spawnPos = wp == null ? Vector2.Zero : wp.WorldPosition;
+ }
+
+ if (spawnPos != null)
+ {
+ Item.Spawner.QueueItem(itemPrefab, (Vector2)spawnPos, false);
+
+ }
+ else if (spawnInventory != null)
+ {
+ Item.Spawner.QueueItem(itemPrefab, (Inventory)spawnInventory, false);
+ }
+
break;
case "disablecrewai":
HumanAIController.DisableCrewAI = !HumanAIController.DisableCrewAI;
diff --git a/Subsurface/Source/Items/ItemSpawner.cs b/Subsurface/Source/Items/ItemSpawner.cs
index 3089631da..708832da5 100644
--- a/Subsurface/Source/Items/ItemSpawner.cs
+++ b/Subsurface/Source/Items/ItemSpawner.cs
@@ -17,20 +17,20 @@ namespace Barotrauma
spawnQueue = new Queue>();
}
- //public void QueueItem(ItemPrefab itemPrefab, Vector2 position, bool isNetworkMessage = false)
- //{
- // if (!isNetworkMessage && GameMain.Client!=null)
- // {
- // //clients aren't allowed to spawn new items unless the server says so
- // return;
- // }
+ public void QueueItem(ItemPrefab itemPrefab, Vector2 worldPosition, bool isNetworkMessage = false)
+ {
+ if (!isNetworkMessage && GameMain.Client != null)
+ {
+ //clients aren't allowed to spawn new items unless the server says so
+ return;
+ }
- // var itemInfo = new Pair();
- // itemInfo.First = itemPrefab;
- // itemInfo.Second = position;
+ var itemInfo = new Pair();
+ itemInfo.First = itemPrefab;
+ itemInfo.Second = worldPosition;
- // spawnQueue.Enqueue(itemInfo);
- //}
+ spawnQueue.Enqueue(itemInfo);
+ }
public void QueueItem(ItemPrefab itemPrefab, Inventory inventory, bool isNetworkMessage = false)
{
@@ -58,26 +58,22 @@ namespace Barotrauma
{
var itemInfo = spawnQueue.Dequeue();
- //if (itemInfo.Second is Vector2)
- //{
- // //todo: take multiple subs into account
- // Vector2 position = (Vector2)itemInfo.Second - Submarine.MainSub.HiddenSubPosition;
+ if (itemInfo.Second is Vector2)
+ {
+ var item = new Item(itemInfo.First, (Vector2)itemInfo.Second, null);
+ AddToSpawnedList(item);
- // items.Add(new Item(itemInfo.First, position, null));
- // inventories.Add(null);
-
- //}
- //else
- if (itemInfo.Second is Inventory)
+ items.Add(item);
+ }
+ else if (itemInfo.Second is Inventory)
{
var item = new Item(itemInfo.First, Vector2.Zero, null);
AddToSpawnedList(item);
var inventory = (Inventory)itemInfo.Second;
- inventory.TryPutItem(item, null, false);
+ inventory.TryPutItem(item, item.AllowedSlots, false);
items.Add(item);
- //inventories.Add(inventory);
}
}
@@ -131,8 +127,6 @@ namespace Barotrauma
Vector2 pos = Vector2.Zero;
ushort inventoryId = message.ReadUInt16();
- Submarine sub = null;
-
int inventorySlotIndex = -1;
if (inventoryId > 0)
diff --git a/Subsurface/changelog.txt b/Subsurface/changelog.txt
index 261fa063d..6d3e0eb50 100644
--- a/Subsurface/changelog.txt
+++ b/Subsurface/changelog.txt
@@ -1,3 +1,13 @@
+---------------------------------------------------------------------------------------------------------
+v0.5.1.2
+---------------------------------------------------------------------------------------------------------
+
+- hacked clients can't join a full server or change the name of their character anymore
+- option to choose which character to control using the "control" command when there are multiple
+characters/creatures with the same name
+- a console command for spawning items
+- the server logs show who sent each chat message
+
---------------------------------------------------------------------------------------------------------
v0.5.1.1
---------------------------------------------------------------------------------------------------------