- EntitySpawner recursively deletes contained items when an item is deleted
- items in the inventories of the characters inside the shuttle are deleted when resetting the respawn shuttle - fixed host's character not being taken into account when assigning jobs for respawning characters if the host is not respawning
This commit is contained in:
@@ -98,20 +98,20 @@ namespace Barotrauma
|
|||||||
img.Color = order.Color;
|
img.Color = order.Color;
|
||||||
img.CanBeFocused = false;
|
img.CanBeFocused = false;
|
||||||
|
|
||||||
orderListBox.children[characterIndex].ToolTip = "Order: " + order.Name;
|
orderListBox.children[characterIndex].ToolTip = "Order: " + order.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SelectCharacterOrder(GUIComponent component, object selection)
|
public bool SelectCharacterOrder(GUIComponent component, object selection)
|
||||||
{
|
{
|
||||||
GameMain.GameSession.CrewManager.commander.ToggleGUIFrame();
|
commander.ToggleGUIFrame();
|
||||||
|
|
||||||
int orderIndex = orderListBox.children.IndexOf(component);
|
int orderIndex = orderListBox.children.IndexOf(component);
|
||||||
if (orderIndex<0 || orderIndex >= listBox.children.Count) return false;
|
if (orderIndex < 0 || orderIndex >= listBox.children.Count) return false;
|
||||||
|
|
||||||
var characterFrame = listBox.children[orderIndex];
|
var characterFrame = listBox.children[orderIndex];
|
||||||
if (characterFrame == null) return false;
|
if (characterFrame == null) return false;
|
||||||
|
|
||||||
GameMain.GameSession.CrewManager.commander.SelectCharacter(characterFrame.UserData as Character);
|
commander.SelectCharacter(characterFrame.UserData as Character);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,6 @@ namespace Barotrauma
|
|||||||
commander.UpdateCharacters();
|
commander.UpdateCharacters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
character.Info.CreateCharacterFrame(listBox, character.Info.Name.Replace(' ', '\n'), character);
|
character.Info.CreateCharacterFrame(listBox, character.Info.Name.Replace(' ', '\n'), character);
|
||||||
|
|
||||||
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 40, 40), Color.Transparent, null, orderListBox);
|
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 40, 40), Color.Transparent, null, orderListBox);
|
||||||
@@ -140,21 +139,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
var ai = character.AIController as HumanAIController;
|
var ai = character.AIController as HumanAIController;
|
||||||
SetCharacterOrder(character, ai.CurrentOrder);
|
SetCharacterOrder(character, ai.CurrentOrder);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//string name = character.Info.Name.Replace(' ', '\n');
|
|
||||||
|
|
||||||
//GUITextBlock textBlock = new GUITextBlock(
|
|
||||||
// new Rectangle(40, 0, 0, 25),
|
|
||||||
// name,
|
|
||||||
// Color.Transparent, Color.White,
|
|
||||||
// Alignment.Left, Alignment.Left,
|
|
||||||
// null, frame, false);
|
|
||||||
//textBlock.Font = GUI.SmallFont;
|
|
||||||
//textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
|
|
||||||
|
|
||||||
//new GUIImage(new Rectangle(-10, -5, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, frame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddToGUIUpdateList()
|
public void AddToGUIUpdateList()
|
||||||
|
|||||||
@@ -118,12 +118,23 @@ namespace Barotrauma
|
|||||||
removeQueue.Enqueue(entity);
|
removeQueue.Enqueue(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void AddToRemoveQueue(Item item)
|
||||||
{
|
{
|
||||||
if (GameMain.Client != null) return;
|
if (GameMain.Client != null) return;
|
||||||
|
|
||||||
if (!spawnQueue.Any()) return;
|
removeQueue.Enqueue(item);
|
||||||
|
if (item.ContainedItems == null) return;
|
||||||
|
foreach (Item containedItem in item.ContainedItems)
|
||||||
|
{
|
||||||
|
if (containedItem != null) AddToRemoveQueue(containedItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
if (GameMain.Client != null) return;
|
||||||
|
|
||||||
while (spawnQueue.Count>0)
|
while (spawnQueue.Count>0)
|
||||||
{
|
{
|
||||||
var entitySpawnInfo = spawnQueue.Dequeue();
|
var entitySpawnInfo = spawnQueue.Dequeue();
|
||||||
|
|||||||
@@ -1891,6 +1891,10 @@ namespace Barotrauma.Networking
|
|||||||
assignedClientCount[JobPrefab.List.IndexOf(myCharacter.Info.Job.Prefab)] = 1;
|
assignedClientCount[JobPrefab.List.IndexOf(myCharacter.Info.Job.Prefab)] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (myCharacter != null && !myCharacter.IsDead)
|
||||||
|
{
|
||||||
|
assignedClientCount[JobPrefab.List.IndexOf(myCharacter.Info.Job.Prefab)]++;
|
||||||
|
}
|
||||||
|
|
||||||
//count the clients who already have characters with an assigned job
|
//count the clients who already have characters with an assigned job
|
||||||
foreach (Client c in connectedClients)
|
foreach (Client c in connectedClients)
|
||||||
|
|||||||
@@ -324,7 +324,8 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
if (item.body != null && item.body.Enabled && item.ParentInventory == null)
|
if (item.body != null && item.body.Enabled && item.ParentInventory == null)
|
||||||
{
|
{
|
||||||
Item.Spawner.AddToRemoveQueue(item);
|
Entity.Spawner.AddToRemoveQueue(item);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.Condition = 100.0f;
|
item.Condition = 100.0f;
|
||||||
@@ -362,9 +363,17 @@ namespace Barotrauma.Networking
|
|||||||
if (c.Submarine == respawnShuttle)
|
if (c.Submarine == respawnShuttle)
|
||||||
{
|
{
|
||||||
if (Character.Controlled == c) Character.Controlled = null;
|
if (Character.Controlled == c) Character.Controlled = null;
|
||||||
//if (networkMember.Character == c) networkMember.Character = null;
|
|
||||||
c.Enabled = false;
|
c.Enabled = false;
|
||||||
|
|
||||||
|
if (c.Inventory != null)
|
||||||
|
{
|
||||||
|
foreach (Item item in c.Inventory.Items)
|
||||||
|
{
|
||||||
|
if (item == null) continue;
|
||||||
|
Entity.Spawner.AddToRemoveQueue(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c.Kill(CauseOfDeath.Damage, true);
|
c.Kill(CauseOfDeath.Damage, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user