Show item IDs in inventory tooltips if debugdraw is enabled, itemspawner sync bugfix, characters can be revived (atm only through the debug console)

This commit is contained in:
Regalis
2016-02-09 20:00:53 +02:00
parent 5beaf43e17
commit 4e46c44d51
9 changed files with 76 additions and 9 deletions

View File

@@ -296,6 +296,14 @@ namespace Barotrauma
public bool IsDead
{
get { return isDead; }
//set
//{
// if (isDead == value) return;
// if (isDead)
// {
// Revive(false);
// }
//}
}
public CauseOfDeath CauseOfDeath
@@ -1234,7 +1242,7 @@ namespace Barotrauma
//CoroutineManager.StartCoroutine(DeathAnim(GameMain.GameScreen.Cam));
health = 0.0f;
//health = 0.0f;
isDead = true;
this.causeOfDeath = causeOfDeath;
@@ -1245,9 +1253,13 @@ namespace Barotrauma
{
if (selectedItems[i] != null) selectedItems[i].Drop(this);
}
aiTarget.Remove();
aiTarget = null;
if (aiTarget!=null)
{
aiTarget.Remove();
aiTarget = null;
}
foreach (Limb limb in AnimController.Limbs)
{
@@ -1258,7 +1270,6 @@ namespace Barotrauma
foreach (RevoluteJoint joint in AnimController.limbJoints)
{
joint.MotorEnabled = false;
joint.MaxMotorTorque = 0.0f;
}
if (GameMain.GameSession != null)
@@ -1267,6 +1278,25 @@ namespace Barotrauma
}
}
public void Revive(bool isNetworkMessage)
{
isDead = false;
aiTarget = new AITarget(this);
health = Math.Max(maxHealth * 0.1f, health);
foreach (RevoluteJoint joint in AnimController.limbJoints)
{
joint.MotorEnabled = true;
}
if (GameMain.GameSession != null)
{
GameMain.GameSession.ReviveCharacter(this);
}
}
public override bool FillNetworkData(NetworkEventType type, NetBuffer message, object data)
{
switch (type)

View File

@@ -266,6 +266,11 @@ namespace Barotrauma
case "godmode":
Submarine.Loaded.GodMode = !Submarine.Loaded.GodMode;
break;
case "dumpids":
int count = commands.Length < 2 ? 10 : int.Parse(commands[1]);
Entity.DumpIds(count);
break;
case "heal":
if (Character.Controlled != null)
{
@@ -274,6 +279,12 @@ namespace Barotrauma
Character.Controlled.Bleeding = 0.0f;
}
break;
case "revive":
if (Character.Controlled != null)
{
Character.Controlled.Revive(false);
}
break;
case "freecamera":
case "freecam":
Character.Controlled = null;

View File

@@ -181,6 +181,17 @@ namespace Barotrauma
if (crewFrameOpen) crewFrame.Update(deltaTime);
}
public void ReviveCharacter(Character revivedCharacter)
{
GUIComponent characterBlock = listBox.GetChild(revivedCharacter) as GUIComponent;
if (characterBlock != null) characterBlock.Color = Color.Transparent;
if (revivedCharacter is AICharacter)
{
commander.UpdateCharacters();
}
}
public void KillCharacter(Character killedCharacter)
{
GUIComponent characterBlock = listBox.GetChild(killedCharacter) as GUIComponent;

View File

@@ -173,6 +173,11 @@ namespace Barotrauma
CrewManager.KillCharacter(character);
}
public void ReviveCharacter(Character character)
{
CrewManager.ReviveCharacter(character);
}
public bool LoadPrevious(GUIButton button, object obj)
{
SaveUtil.LoadGame(saveFile);

View File

@@ -266,7 +266,15 @@ namespace Barotrauma
if (Items[i] != null && slotRect.Contains(PlayerInput.MousePosition))
{
toolTip = string.IsNullOrEmpty(Items[i].Description) ? Items[i].Name : Items[i].Name + '\n' + Items[i].Description;
if (GameMain.DebugDraw)
{
toolTip = Items[i].ToString();
}
else
{
toolTip = string.IsNullOrEmpty(Items[i].Description) ? Items[i].Name : Items[i].Name + '\n' + Items[i].Description;
}
highlightedSlot = slotRect;
}

View File

@@ -199,7 +199,7 @@ namespace Barotrauma
if (slotRect.Contains(PlayerInput.MousePosition) && Items[i] != null)
{
highlightedSlot = slotRect;
toolTip = Items[i].Name;
toolTip = GameMain.DebugDraw ? Items[i].ToString() : Items[i].Name;
}
}

View File

@@ -88,7 +88,7 @@ namespace Barotrauma
message.Write(items[i].Prefab.Name);
message.Write(items[i].ID);
message.Write(inventories[i].Owner == null ? 0 : inventories[i].Owner.ID);
message.Write((inventories[i]==null || inventories[i].Owner == null) ? (ushort)0 : inventories[i].Owner.ID);
}
}

View File

@@ -407,12 +407,14 @@ namespace Barotrauma
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
{
if (back) return;
if (!ShowHulls && !GameMain.DebugDraw) return;
if (!editing && !GameMain.DebugDraw) return;
Rectangle drawRect =
Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
GUI.DrawRectangle(spriteBatch,
new Vector2(drawRect.X, -drawRect.Y),

Binary file not shown.