Added an artifact that attracts creatures, item max health can be changed & items can be made indestructible
This commit is contained in:
@@ -93,7 +93,7 @@ namespace Barotrauma.Items.Components
|
||||
public void Draw(SpriteBatch spriteBatch, bool editing)
|
||||
{
|
||||
Color color = (item.IsSelected) ? Color.Green : Color.White;
|
||||
color = color * (item.Condition / 100.0f);
|
||||
color = color * (item.Condition / item.Prefab.Health);
|
||||
color.A = 255;
|
||||
|
||||
//prefab.sprite.Draw(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color);
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (!unfixedFound)
|
||||
{
|
||||
item.Condition = 100.0f;
|
||||
item.Condition = item.Prefab.Health;
|
||||
frame = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,21 +167,21 @@ namespace Barotrauma
|
||||
|
||||
if (item != null && drawItem)
|
||||
{
|
||||
if (item.Condition < 100.0f)
|
||||
if (item.Condition < item.Prefab.Health)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, rect.Bottom - 8, rect.Width, 8), Color.Black * 0.8f, true);
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
new Rectangle(rect.X, rect.Bottom - 8, (int)(rect.Width * item.Condition / 100.0f), 8),
|
||||
new Rectangle(rect.X, rect.Bottom - 8, (int)(rect.Width * item.Condition / item.Prefab.Health), 8),
|
||||
Color.Lerp(Color.Red, Color.Green, item.Condition / 100.0f) * 0.8f, true);
|
||||
}
|
||||
|
||||
var containedItems = item.ContainedItems;
|
||||
if (containedItems != null && containedItems.Length == 1 && containedItems[0].Condition < 100.0f)
|
||||
if (containedItems != null && containedItems.Length == 1 && containedItems[0].Condition < item.Prefab.Health)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, rect.Y, rect.Width, 8), Color.Black * 0.8f, true);
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
new Rectangle(rect.X, rect.Y, (int)(rect.Width * containedItems[0].Condition / 100.0f), 8),
|
||||
Color.Lerp(Color.Red, Color.Green, containedItems[0].Condition / 100.0f) * 0.8f, true);
|
||||
Color.Lerp(Color.Red, Color.Green, containedItems[0].Condition / item.Prefab.Health) * 0.8f, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
using Barotrauma.Items.Components;
|
||||
using Barotrauma.Networking;
|
||||
using FarseerPhysics;
|
||||
using FarseerPhysics.Dynamics;
|
||||
using FarseerPhysics.Dynamics.Contacts;
|
||||
using Lidgren.Network;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
@@ -455,7 +452,7 @@ namespace Barotrauma
|
||||
ownInventory.ClientRead(type, msg, sendingTime);
|
||||
break;
|
||||
case NetEntityEvent.Type.Status:
|
||||
condition = msg.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
condition = msg.ReadRangedSingle(0.0f, prefab.Health, 8);
|
||||
|
||||
if (FixRequirements.Count > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user