assigning jobs when a round starts, crew tab in multiplayer, repairtool particles light & sounds, attachable buttons, increased repairtool range & limbdamage, captain's uniform, wearable sprite bugfixes
This commit is contained in:
@@ -418,10 +418,12 @@ namespace Subsurface
|
||||
|
||||
public void GiveJobItems(WayPoint spawnPoint)
|
||||
{
|
||||
if (Info == null || Info.Job == null) return;
|
||||
|
||||
foreach (string itemName in Info.Job.SpawnItemNames)
|
||||
if (info == null || info.Job == null) return;
|
||||
|
||||
for (int i = 0; i < info.Job.SpawnItemNames.Count; i++ )
|
||||
{
|
||||
string itemName = info.Job.SpawnItemNames[i];
|
||||
|
||||
ItemPrefab itemPrefab = ItemPrefab.list.Find(ip => ip.Name == itemName) as ItemPrefab;
|
||||
if (itemPrefab == null)
|
||||
{
|
||||
@@ -431,14 +433,18 @@ namespace Subsurface
|
||||
|
||||
Item item = new Item(itemPrefab, Position);
|
||||
inventory.TryPutItem(item, item.AllowedSlots, false);
|
||||
|
||||
if (item.Prefab.Name == "ID Card" && spawnPoint!=null)
|
||||
|
||||
if (info.Job.EquipSpawnItem[i])
|
||||
{
|
||||
item.Equip(this);
|
||||
}
|
||||
|
||||
if (item.Prefab.Name == "ID Card" && spawnPoint != null)
|
||||
{
|
||||
foreach (string s in spawnPoint.IdCardTags)
|
||||
{
|
||||
|
||||
item.AddTag(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -476,8 +482,7 @@ namespace Subsurface
|
||||
if (i == 1 && selectedItems[0] == selectedItems[1]) continue;
|
||||
|
||||
if (actionKeyDown.State) selectedItems[i].Use(deltaTime, this);
|
||||
if (secondaryKeyDown.State && selectedItems[i] != null) selectedItems[i].SecondaryUse(deltaTime, this);
|
||||
|
||||
if (secondaryKeyDown.State && selectedItems[i] != null) selectedItems[i].SecondaryUse(deltaTime, this);
|
||||
}
|
||||
|
||||
if (selectedConstruction != null)
|
||||
@@ -906,6 +911,8 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
health = 0.0f;
|
||||
|
||||
isDead = true;
|
||||
AnimController.movement = Vector2.Zero;
|
||||
AnimController.TargetMovement = Vector2.Zero;
|
||||
@@ -914,7 +921,6 @@ namespace Subsurface
|
||||
{
|
||||
if (selectedItems[i] != null) selectedItems[i].Drop(this);
|
||||
}
|
||||
|
||||
|
||||
aiTarget.Remove();
|
||||
aiTarget = null;
|
||||
|
||||
@@ -172,22 +172,27 @@ namespace Subsurface
|
||||
int x = 0, y = 0;
|
||||
new GUITextBlock(new Rectangle(x+80, y, 200, 20), Name, GUI.style, frame);
|
||||
y += 20;
|
||||
new GUITextBlock(new Rectangle(x+80, y, 200, 20), Job.Name, GUI.style, frame);
|
||||
y += 30;
|
||||
|
||||
var skills = Job.Skills;
|
||||
skills.Sort((s1, s2) => -s1.Level.CompareTo(s2.Level));
|
||||
|
||||
new GUITextBlock(new Rectangle(x, y, 200, 20), "Skills:", GUI.style, frame);
|
||||
y += 20;
|
||||
foreach (Skill skill in skills)
|
||||
if (Job!=null)
|
||||
{
|
||||
Color textColor = Color.White * (0.5f + skill.Level/200.0f);
|
||||
new GUITextBlock(new Rectangle(x+20, y, 200, 20), skill.Name, Color.Transparent, textColor, Alignment.Left, GUI.style, frame);
|
||||
new GUITextBlock(new Rectangle(x + 20, y, 200, 20), skill.Level.ToString(), Color.Transparent, textColor, Alignment.Right, GUI.style, frame);
|
||||
new GUITextBlock(new Rectangle(x+80, y, 200, 20), Job.Name, GUI.style, frame);
|
||||
y += 30;
|
||||
|
||||
var skills = Job.Skills;
|
||||
skills.Sort((s1, s2) => -s1.Level.CompareTo(s2.Level));
|
||||
|
||||
new GUITextBlock(new Rectangle(x, y, 200, 20), "Skills:", GUI.style, frame);
|
||||
y += 20;
|
||||
foreach (Skill skill in skills)
|
||||
{
|
||||
Color textColor = Color.White * (0.5f + skill.Level/200.0f);
|
||||
new GUITextBlock(new Rectangle(x+20, y, 200, 20), skill.Name, Color.Transparent, textColor, Alignment.Left, GUI.style, frame);
|
||||
new GUITextBlock(new Rectangle(x + 20, y, 200, 20), skill.Level.ToString(), Color.Transparent, textColor, Alignment.Right, GUI.style, frame);
|
||||
y += 20;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,11 @@ namespace Subsurface
|
||||
get { return prefab.ItemNames; }
|
||||
}
|
||||
|
||||
public List<bool> EquipSpawnItem
|
||||
{
|
||||
get { return prefab.EquipItem; }
|
||||
}
|
||||
|
||||
public List<Skill> Skills
|
||||
{
|
||||
get { return skills.Values.ToList(); }
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Subsurface
|
||||
|
||||
//names of the items the character spawns with
|
||||
public List<string> ItemNames;
|
||||
public List<bool> EquipItem;
|
||||
|
||||
public Dictionary<string, Vector2> Skills;
|
||||
|
||||
@@ -63,6 +64,7 @@ namespace Subsurface
|
||||
AllowAlways = ToolBox.GetAttributeBool(element, "allowalways", false);
|
||||
|
||||
ItemNames = new List<string>();
|
||||
EquipItem = new List<bool>();
|
||||
|
||||
Skills = new Dictionary<string, Vector2>();
|
||||
|
||||
@@ -72,7 +74,12 @@ namespace Subsurface
|
||||
{
|
||||
case "item":
|
||||
string itemName = ToolBox.GetAttributeString(subElement, "name", "");
|
||||
if (!string.IsNullOrEmpty(itemName)) ItemNames.Add(itemName);
|
||||
bool equipItem = ToolBox.GetAttributeBool(subElement, "equip", false);
|
||||
if (!string.IsNullOrEmpty(itemName))
|
||||
{
|
||||
ItemNames.Add(itemName);
|
||||
EquipItem.Add(equipItem);
|
||||
}
|
||||
break;
|
||||
case "skills":
|
||||
LoadSkills(subElement);
|
||||
|
||||
@@ -5,6 +5,7 @@ using FarseerPhysics.Dynamics;
|
||||
using FarseerPhysics.Dynamics.Joints;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Subsurface.Items.Components;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
@@ -60,7 +61,7 @@ namespace Subsurface
|
||||
private Direction dir;
|
||||
|
||||
private Item wearingItem;
|
||||
private Sprite wearingItemSprite;
|
||||
private WearableSprite wearingItemSprite;
|
||||
|
||||
private Vector2 animTargetPos;
|
||||
|
||||
@@ -154,7 +155,7 @@ namespace Subsurface
|
||||
set { wearingItem = value; }
|
||||
}
|
||||
|
||||
public Sprite WearingItemSprite
|
||||
public WearableSprite WearingItemSprite
|
||||
{
|
||||
get { return wearingItemSprite; }
|
||||
set { wearingItemSprite = value; }
|
||||
@@ -184,7 +185,7 @@ namespace Subsurface
|
||||
body.CollidesWith = Physics.CollisionAll & ~Physics.CollisionCharacter & ~Physics.CollisionMisc;
|
||||
}
|
||||
|
||||
impactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 8.0f);
|
||||
impactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 10.0f);
|
||||
|
||||
body.UserData = this;
|
||||
|
||||
@@ -398,16 +399,28 @@ namespace Subsurface
|
||||
Color color = Color.White;// new Color(1.0f, 1.0f - damage / maxHealth, 1.0f - damage / maxHealth);
|
||||
|
||||
body.Dir = Dir;
|
||||
body.Draw(spriteBatch, sprite, color);
|
||||
|
||||
if (wearingItem == null || !wearingItemSprite.HideLimb)
|
||||
{
|
||||
body.Draw(spriteBatch, sprite, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
body.UpdateDrawPosition();
|
||||
}
|
||||
|
||||
if (wearingItem != null)
|
||||
{
|
||||
SpriteEffects spriteEffect = (dir == Direction.Right) ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
wearingItemSprite.Draw(spriteBatch,
|
||||
|
||||
Vector2 origin = wearingItemSprite.Sprite.Origin;
|
||||
if (body.Dir == -1.0f) origin.X = wearingItemSprite.Sprite.SourceRect.Width - origin.X;
|
||||
|
||||
wearingItemSprite.Sprite.Draw(spriteBatch,
|
||||
new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
|
||||
color,
|
||||
color, origin,
|
||||
-body.DrawRotation,
|
||||
1.0f, spriteEffect);
|
||||
1.0f, spriteEffect, sprite.Depth - 0.000001f);
|
||||
}
|
||||
|
||||
if (!Game1.DebugDraw) return;
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace Subsurface
|
||||
}
|
||||
|
||||
float startDepth = 0.1f;
|
||||
float increment = 0.0001f;
|
||||
float increment = 0.001f;
|
||||
|
||||
foreach (Character otherCharacter in Character.CharacterList)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ namespace Subsurface
|
||||
|
||||
foreach (Limb limb in limbs)
|
||||
{
|
||||
limb.sprite.Depth = startDepth + limb.sprite.Depth * 0.00001f;
|
||||
limb.sprite.Depth = startDepth + limb.sprite.Depth * 0.0001f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user