v0.5.1.2: spawnitem console command, "spawn inside" always spawns characters in the main sub, a new music clip, modified the topwindow sprite a bit

This commit is contained in:
Regalis
2016-08-31 22:06:05 +03:00
parent 8142cc734e
commit 2c51ba50a8
8 changed files with 88 additions and 30 deletions

View File

@@ -1281,6 +1281,9 @@
<None Include="Content\Sounds\Music\Enter the Maze.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Music\Phantom From Space.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Music\Road to Hell.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

View File

@@ -43,6 +43,7 @@
<music file="Content/Sounds/Music/Enter the Maze.ogg" type="repair" priorityrange="30,60"/>
<music file="Content/Sounds/Music/Static Motion.ogg" type="repair" priorityrange="50,80"/>
<music file="Content/Sounds/Music/Phantom From Space.ogg" type="monster" priorityrange="25,60"/>
<music file="Content/Sounds/Music/Unseen Horrors.ogg" type="monster" priorityrange="40,100"/>
<music file="Content/Sounds/Music/amb_JD_drone_clattering_machine.ogg" type="deep"/>

View File

@@ -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")]

View File

@@ -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;

View File

@@ -17,20 +17,20 @@ namespace Barotrauma
spawnQueue = new Queue<Pair<ItemPrefab, object>>();
}
//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<ItemPrefab, object>();
// itemInfo.First = itemPrefab;
// itemInfo.Second = position;
var itemInfo = new Pair<ItemPrefab, object>();
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)

View File

@@ -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
---------------------------------------------------------------------------------------------------------