Merge remote-tracking branch 'origin/master' into antagonists

This commit is contained in:
Alex Noir
2017-12-03 13:10:04 +03:00
29 changed files with 359 additions and 248 deletions

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.7.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")]
[assembly: AssemblyVersion("0.7.0.1")]
[assembly: AssemblyFileVersion("0.7.0.1")]

View File

@@ -45,6 +45,7 @@ namespace Barotrauma
if (LightSource != null)
{
LightSource.ParentSub = body.Submarine;
LightSource.Rotation = (dir == Direction.Right) ? body.Rotation : body.Rotation - MathHelper.Pi;
}
}

View File

@@ -80,7 +80,11 @@ namespace Barotrauma.Networking
{
textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default];
if (string.IsNullOrWhiteSpace(message)) return false;
if (string.IsNullOrWhiteSpace(message))
{
if (textBox == chatMsgBox) textBox.Deselect();
return false;
}
if (this == GameMain.Server)
{

View File

@@ -1211,7 +1211,7 @@ namespace Barotrauma
var moneyText = new GUITextBlock(new Rectangle(120,0,200,20), "Money", "", Alignment.BottomLeft, Alignment.TopLeft, campaignContainer);
moneyText.TextGetter = campaignUI.GetMoney;
var restartText = new GUITextBlock(new Rectangle(-250, -20, 100, 30), "", "", Alignment.BottomRight, Alignment.BottomLeft, campaignContainer);
var restartText = new GUITextBlock(new Rectangle(-backButton.Rect.Width - 30, -10, 130, 30), "", "", Alignment.BottomRight, Alignment.BottomRight, campaignContainer);
restartText.Font = GUI.SmallFont;
restartText.TextGetter = AutoRestartText;
}

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.7.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")]
[assembly: AssemblyVersion("0.7.0.1")]
[assembly: AssemblyFileVersion("0.7.0.1")]

View File

@@ -277,6 +277,9 @@
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Diving\DivingSuit.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Diving\Scooter.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Door\dockingport.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -1353,6 +1356,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\Character.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\CharacterInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\CharacterNetworking.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\DamageModifier.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\DelayedEffect.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\HuskInfection.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Characters\Jobs\Job.cs" />

View File

@@ -24,12 +24,15 @@
<collider radius ="230"/>
<!-- head -->
<limb id = "0" width="300" height="673" type="Head" steerforce="1.0" flip="true" armorsector="0.0,180.0" armorvalue="100.0">
<limb id = "0" width="300" height="673" type="Head" steerforce="1.0" flip="true">
<sprite texture="Content/Characters/Carrier/carrier.png" sourcerect="0,0,393,778" depth="0.02" origin ="0.5,0.45"/>
<lightsource range="400.0" color="0.7,0.8,1.0,1.0">
<lighttexture texture="Content/Characters/Carrier/carrier.png" sourcerect="392,0,307,778" origin="0.5, 0.45"/>
</lightsource>
<damagemodifier armorsector="0.0,180.0" damagemultiplier="0.1" bleedingmultiplier="0.0" damagesound="SctructureBlunt" deflectprojectiles="true"/>
<damagemodifier armorsector="0.0,360.0" damagesound="SctructureBlunt" deflectprojectiles="true"/>
<attack range="400" damagerange="250" duration="0.08" damage="100" stun="5" force="20" damagetype="blunt" targetforce="100"/>
</limb>
@@ -62,4 +65,4 @@
</ragdoll>
</Character>
</Character>

View File

@@ -30,17 +30,20 @@
<collider width="45" radius="22"/>
<!-- head -->
<limb id = "0" radius="22" height="45" type="Head" flip="true" steerforce="1.0" armorsector="0.0,180.0" armorvalue="30.0" mouthpos="17,35">
<limb id = "0" radius="22" height="45" type="Head" flip="true" steerforce="1.0" mouthpos="17,35">
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.2" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="0,0,51,121" depth="0.02" origin="0.45,0.63"/>
</limb>
<!-- middle part -->
<limb id = "1" radius="22" height="40" flip="true" armorsector="0.0,180.0" armorvalue="20.0">0
<limb id = "1" radius="22" height="40" flip="true" >
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.2" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="57,7,59,57" depth="0.021" origin="0.3,0.65"/>
</limb>
<!-- tail -->
<limb id = "2" radius="22" height="45" type="Tail" flip="true" armorsector="0.0,180.0" armorvalue="20.0">
<limb id = "2" radius="22" height="45" type="Tail" flip="true">
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.2" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="6,141,60,95" depth="0.022" origin="0.37,0.43"/>
</limb>

View File

@@ -33,25 +33,28 @@
<collider radius="60"/>
<!-- head -->
<limb id = "0" radius="30" height="86" mass = "6" type="Head" flip="true" steerforce="1.0" armorsector="0.0,180.0" armor="10.0" mouthpos="30,65">
<limb id = "0" radius="30" height="86" mass = "6" type="Head" flip="true" steerforce="1.0" mouthpos="30,65">
<sprite texture="Content/Characters/Mantis/mantis.png" sourcerect="0,0,101,168" depth="0.02" origin="0.4,0.53"/>
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.5" bleedingmultiplier="0.1" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<!-- middle part -->
<limb id = "1" width="42" height="61" mass = "6" flip="true" armorsector="0.0,180.0" armor="10.0">
<limb id = "1" width="42" height="61" mass = "6" flip="true">
<sprite texture="Content/Characters/Mantis/mantis.png" sourcerect="3,168,59,64" depth="0.021" origin="0.3,0.65"/>
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.2" bleedingmultiplier="0.1" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<!-- middle part -->
<limb id = "2" width="35" height="52" mass = "6" flip="true" armorsector="0.0,180.0" armor="10.0">
<limb id = "2" width="35" height="52" mass = "6" flip="true">
<sprite texture="Content/Characters/Mantis/mantis.png" sourcerect="66,180,65,70" depth="0.022" origin="0.3,0.65"/>
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.5" bleedingmultiplier="0.1" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<!-- tail -->
<limb id = "3" radius="20" mass = "6" type="Tail" flip="true" armorsector="0.0,180.0" armor="10.0">
<limb id = "3" radius="20" mass = "6" type="Tail" flip="true">
<sprite texture="Content/Characters/Mantis/mantis.png" sourcerect="133,158,46,93" depth="0.023" origin="0.37,0.3"/>
</limb>
<damagemodifier damagetype="Blunt,Slash" armorsector="0.0,180.0" damagemultiplier="0.5" bleedingmultiplier="0.1" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<limb id = "4" width="15" height="63" mass = "4" refjoint="3" flip="true">
<sprite texture="Content/Characters/Mantis/mantis.png" sourcerect="232,153,20,63" depth="0.012" origin="0.5,0.5"/>

View File

@@ -19,9 +19,10 @@
<collider radius ="230"/>
<!-- head -->
<limb id = "0" radius="230" height="500" type="Head" steerforce="1.0" flip="true" armorsector="0.0,180.0" armorvalue="100.0">
<limb id = "0" radius="230" height="500" type="Head" steerforce="1.0" flip="true">
<sprite texture="Content/Characters/Moloch/moloch.png" sourcerect="0,0,628,1024" depth="0.02" origin ="0.4,0.5"/>
<attack range="700" damagerange="350" duration="0.05" damage="200" stun="5" force="20" damagetype="blunt" targetforce="100"/>
<damagemodifier damagetype="Any" armorsector="0.0,180.0" damagemultiplier="0.1" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<limb id = "1" width="50" height="440" flip="true">

View File

@@ -25,9 +25,10 @@
<collider radius="100"/>
<!-- head -->
<limb id = "0" type="Head" width="350" height="320" steerforce="1.0" flip="true" armorsector="0.0,360.0" armorvalue="100.0">
<limb id = "0" type="Head" width="350" height="320" steerforce="1.0" flip="true">
<sprite texture="Content/Characters/Watcher/watcher.png" sourcerect="0,0,369,348" depth="0.02" origin ="0.5,0.6"/>
<attack range="250" damagerange="170" duration="0.05" damage="200" stun="5" force="20" damagetype="blunt" targetforce="100"/>
<damagemodifier damagetype="Any" armorsector="0.0,360.0" damagemultiplier="0.1" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
</limb>
<limb id = "1" radius="50" height="120" flip="true">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -63,8 +63,7 @@
<Item
name="Diving Suit"
category="Equipment"
tags="diving"
tags="diving"
price="200"
fireproof="true"
description="An atmospheric diving suit capable of withstanding the immense pressure under Europa's crust.">
@@ -73,7 +72,7 @@
<Body width="37" height="113" density="15"/>
<Wearable slots="Head+Torso+Legs" armorvalue="10.0">
<Wearable slots="Head+Torso+Legs">
<sprite texture="DivingSuit.png" limb="Head" sourcerect="0,0,1,1" origin="0.5,0.5" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="Torso" sourcerect="42,0,42,97" origin="0.5,0.55" depthlimb="Head" hidelimb="true"/>
@@ -81,15 +80,18 @@
<sprite texture="DivingSuit.png" limb="RightHand" sourcerect="0,78,15,50" origin="0.45,0.4" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftHand" sourcerect="0,78,15,50" origin="0.45,0.4" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="RightArm" sourcerect="0,0,19,43" origin="0.5,0.4" depth="0.005" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftArm" sourcerect="0,0,19,43" origin="0.5,0.4" depth="0.005" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="RightArm" sourcerect="0,0,19,43" origin="0.5,0.4" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftArm" sourcerect="0,0,19,43" origin="0.5,0.4" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="RightThigh" sourcerect="22,0,18,44" origin="0.5,0.5" depth="0.01" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftThigh" sourcerect="22,0,18,44" origin="0.5,0.5" depth="0.01" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="RightThigh" sourcerect="22,0,18,44" origin="0.5,0.5" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftThigh" sourcerect="22,0,18,44" origin="0.5,0.5" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="RightLeg" sourcerect="17,47,21,51" origin="0.5,0.55" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftLeg" sourcerect="17,47,21,51" origin="0.5,0.55" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="RightFoot" sourcerect="30,100,20,25" origin="0.5,0.5" depth="0.13" inheritlimbdepth="false" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftFoot" sourcerect="30,100,20,25" origin="0.5,0.5" depth="0.13" inheritlimbdepth="false" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="RightLeg" sourcerect="17,47,21,51" origin="0.5,0.55" depth="0.02" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftLeg" sourcerect="17,47,21,51" origin="0.5,0.55" depth="0.02" hidelimb="true"/>
<StatusEffect type="OnWearing" target="Character" ObstructVision="true" PressureProtection="100.0" SpeedMultiplier="0.6" LowPassMultiplier="0.2" setvalue="true" disabledeltatime="true"/>
<StatusEffect type="OnWearing" target="Contained,Character" OxygenAvailable="1000.0" Condition="-0.5">
<RequiredItem type="Contained" name="Oxygen Tank"/>
@@ -101,6 +103,10 @@
<RequiredItem type="Contained" name="Oxygenite Shard"/>
</StatusEffect>
<StatusEffect type="OnWearing" target="Character" OxygenAvailable="-100.0"/>
<damagemodifier damagetype="Burn" armorsector="0.0,360.0" damagemultiplier="0.6"/>
<damagemodifier damagetype="Blunt" armorsector="0.0,360.0" damagemultiplier="0.8" bleedingmultiplier="0.3" damagesound="LimbArmor" deflectprojectiles="true"/>
<damagemodifier damagetype="Slash" armorsector="0.0,360.0" damagemultiplier="0.5" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
</Wearable>
<ItemContainer capacity="1" hideitems="true">
@@ -124,11 +130,11 @@
<Item name="Polycarbonate Bar"/>
</Deconstruct>
<Sprite texture ="DivingSuit.png" depth="0.55" sourcerect="22,98,59,32" origin="0.6,0.66"/>
<Sprite texture ="Scooter.png" depth="0.55"/>
<Body width="55" height="30" density="15"/>
<Holdable slots="Any,RightHand+LeftHand" aimpos="100,0" handle1="0,11" handle2="2,11"/>
<Holdable slots="Any,RightHand+LeftHand" aimpos="100,0" handle1="4,10" handle2="6,10"/>
<Propulsion force="80" usablein="water" particles="bubbles">
<RequiredItems name="Battery Cell,Fulgurium Battery Cell" type="Contained" msg="Battery Cell required"/>
@@ -139,7 +145,6 @@
</LightComponent>
</Propulsion>
<ItemContainer capacity="1" hideitems="true">
<Containable name="Battery Cell"/>
<Containable name="Fulgurium Battery Cell"/>

View File

@@ -1,8 +1,7 @@
<Items>
<Item
name="Orange Jumpsuit"
category="Equipment"
category="Equipment"
tags="smallitem"
fireproof="true"
description="The fire-resistant fabric offers some protection against fires. Plenty of pockets for carrying any extra gear an engineer might need.">
@@ -19,7 +18,10 @@
<sprite texture="engigear.png" limb="LeftThigh" sourcerect="53,0,27,49" origin="0.5,0.5" depth="0.14" hidelimb="true"/>
<sprite texture="engigear.png" limb="RightLeg" sourcerect="33,0,20,51" origin="0.5,0.5" depth="0.11" hidelimb="true"/>
<sprite texture="engigear.png" limb="LeftLeg" sourcerect="33,0,20,51" origin="0.5,0.5" depth="0.15" hidelimb="true"/>
<sprite texture="engigear.png" limb="LeftLeg" sourcerect="33,0,20,51" origin="0.5,0.5" depth="0.15" hidelimb="true"/>
<damagemodifier damagetype="Burn" armorsector="0.0,360.0" damagemultiplier="0.7"/>
<damagemodifier damagetype="Slash" armorsector="0.0,360.0" damagemultiplier="0.9" bleedingdamagemultiplier="0.9"/>
</Wearable>
<ItemContainer capacity="5">
@@ -48,6 +50,9 @@
<sprite texture="engigear.png" limb="RightLeg" sourcerect="33,77,20,51" origin="0.5,0.5" depth="0.11" hidelimb="true"/>
<sprite texture="engigear.png" limb="LeftLeg" sourcerect="33,77,20,51" origin="0.5,0.5" depth="0.15" hidelimb="true"/>
<damagemodifier damagetype="Burn" armorsector="0.0,360.0" damagemultiplier="0.7"/>
<damagemodifier damagetype="Slash" armorsector="0.0,360.0" damagemultiplier="0.9" bleedingdamagemultiplier="0.9"/>
</Wearable>
<ItemContainer capacity="5">

View File

@@ -10,17 +10,18 @@
<Body width="52" height="17" density="40"/>
<Wearable slots="Any,Torso" armorvalue="10.0">
<Wearable slots="Any,Torso">
<damagemodifier damagetype="Burn" armorsector="0.0,360.0" damagemultiplier="0.9"/>
<damagemodifier damagetype="Blunt" armorsector="0.0,360.0" damagemultiplier="0.3" bleedingmultiplier="0.3" damagesound="LimbArmor" deflectprojectiles="true"/>
<damagemodifier damagetype="Slash" armorsector="0.0,360.0" damagemultiplier="0.1" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
<sprite texture="securitygear.png" limb="Torso" sourcerect="0,0,38,58" origin="0.52,0.48"/>
<sprite texture="securitygear.png" limb="RightArm" sourcerect="41,0,21,21" origin="0.5,1.1"/>
</Wearable>
</Item>
<Item
name="Ballistic Helmet"
category="Equipment"
category="Equipment"
tags="smallitem"
description="While the helmet won't offer adequate protection against most of the inhabitants of the subsurface ocean, it can be extremely useful if there are traitors on board.">
@@ -34,6 +35,8 @@
<Body radius="12" density="50"/>
<Wearable slots="Any,Head" armorvalue="20.0">
<damagemodifier damagetype="Blunt" armorsector="0.0,360.0" damagemultiplier="0.2" bleedingmultiplier="0.2" damagesound="LimbArmor" deflectprojectiles="true"/>
<damagemodifier damagetype="Slash" armorsector="0.0,360.0" damagemultiplier="0.1" bleedingmultiplier="0.0" damagesound="LimbArmor" deflectprojectiles="true"/>
<sprite texture="securitygear.png" limb="Head" sourcerect="39,31,29,22" origin="0.51,0.9"/>
</Wearable>
</Item>

View File

@@ -72,8 +72,7 @@
<Item
name="Railgun Shell"
category="Misc"
category="Misc"
price="200">
<Deconstruct time="10">
@@ -103,8 +102,7 @@
<Item
name="Nuclear Shell"
category="Misc"
category="Misc"
price="500">
<Deconstruct time="10">

View File

@@ -11,24 +11,32 @@ namespace Barotrauma
Damage, Bloodloss, Pressure, Suffocation, Drowning, Burn, Husk, Disconnected
}
public enum DamageType { None, Blunt, Slash, Burn }
[Flags]
public enum DamageType
{
None = 0,
Blunt = 1,
Slash = 2,
Burn = 4,
Any = Blunt | Slash | Burn
}
struct AttackResult
{
public readonly float Damage;
public readonly float Bleeding;
public readonly bool HitArmor;
public AttackResult(float damage, float bleeding, bool hitArmor=false)
public readonly List<DamageModifier> AppliedDamageModifiers;
public AttackResult(float damage, float bleeding, List<DamageModifier> appliedDamageModifiers = null)
{
this.Damage = damage;
this.Bleeding = bleeding;
this.HitArmor = hitArmor;
this.AppliedDamageModifiers = appliedDamageModifiers;
}
}
partial class Attack
{
public readonly float Range;

View File

@@ -0,0 +1,66 @@
using Microsoft.Xna.Framework;
using System.Xml.Linq;
namespace Barotrauma
{
class DamageModifier
{
[Serialize(DamageType.None, false)]
public DamageType DamageType
{
get;
private set;
}
[Serialize(1.0f, false)]
public float DamageMultiplier
{
get;
private set;
}
[Serialize(1.0f, false)]
public float BleedingMultiplier
{
get;
private set;
}
[Serialize("0.0,360", false)]
public Vector2 ArmorSector
{
get;
private set;
}
[Serialize(true, false)]
public bool IsArmor
{
get;
private set;
}
[Serialize(true, false)]
public bool DeflectProjectiles
{
get;
private set;
}
#if CLIENT
[Serialize(DamageSoundType.None, false)]
public DamageSoundType DamageSoundType
{
get;
private set;
}
#endif
public DamageModifier(XElement element)
{
SerializableProperty.DeserializeProperties(this, element);
ArmorSector = new Vector2(MathHelper.ToRadians(ArmorSector.X), MathHelper.ToRadians(ArmorSector.Y));
}
}
}

View File

@@ -72,10 +72,7 @@ namespace Barotrauma
private bool isSevered;
private float severedFadeOutTimer;
private readonly Vector2 armorSector;
private readonly float armorValue;
public Vector2? MouthPos;
//a timer for delaying when a hitsound/attacksound can be played again
@@ -91,6 +88,8 @@ namespace Barotrauma
private Vector2 animTargetPos;
private float scale;
private List<DamageModifier> damageModifiers;
public float AttackTimer;
@@ -179,7 +178,7 @@ namespace Barotrauma
public float Burnt
{
get { return burnt; }
set { burnt = MathHelper.Clamp(value,0.0f,100.0f); }
protected set { burnt = MathHelper.Clamp(value, 0.0f, 100.0f); }
}
public List<WearableSprite> WearingItems
@@ -255,15 +254,7 @@ namespace Barotrauma
GameMain.World.AddJoint(pullJoint);
steerForce = element.GetAttributeFloat("steerforce", 0.0f);
//maxHealth = Math.Max(ToolBox.GetAttributeFloat(element, "health", 100.0f),1.0f);
armorSector = element.GetAttributeVector2("armorsector", Vector2.Zero);
armorSector.X = MathHelper.ToRadians(armorSector.X);
armorSector.Y = MathHelper.ToRadians(armorSector.Y);
armorValue = Math.Max(element.GetAttributeFloat("armor", 0.0f), 0.0f);
if (element.Attribute("mouthpos") != null)
{
MouthPos = ConvertUnits.ToSimUnits(element.GetAttributeVector2("mouthpos", Vector2.Zero));
@@ -272,6 +263,8 @@ namespace Barotrauma
body.BodyType = BodyType.Dynamic;
body.FarseerBody.AngularDamping = LimbAngularDamping;
damageModifiers = new List<DamageModifier>();
foreach (XElement subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLowerInvariant())
@@ -322,6 +315,9 @@ namespace Barotrauma
case "attack":
attack = new Attack(subElement);
break;
case "damagemodifier":
damageModifiers.Add(new DamageModifier(subElement));
break;
}
}
@@ -344,46 +340,51 @@ namespace Barotrauma
public AttackResult AddDamage(Vector2 position, DamageType damageType, float amount, float bleedingAmount, bool playSound)
{
bool hitArmor = false;
float totalArmorValue = 0.0f;
List<DamageModifier> appliedDamageModifiers = new List<DamageModifier>();
if (armorValue > 0.0f && SectorHit(armorSector, position))
foreach (DamageModifier damageModifier in damageModifiers)
{
hitArmor = true;
totalArmorValue += armorValue;
if (damageModifier.DamageType.HasFlag(damageType) && SectorHit(damageModifier.ArmorSector, position))
{
appliedDamageModifiers.Add(damageModifier);
}
}
foreach (WearableSprite wearable in wearingItems)
{
if (wearable.WearableComponent.ArmorValue > 0.0f &&
SectorHit(wearable.WearableComponent.ArmorSectorLimits, position))
foreach (DamageModifier damageModifier in wearable.WearableComponent.DamageModifiers)
{
hitArmor = true;
totalArmorValue += wearable.WearableComponent.ArmorValue;
if (damageModifier.DamageType.HasFlag(damageType) && SectorHit(damageModifier.ArmorSector, position))
{
appliedDamageModifiers.Add(damageModifier);
}
}
}
}
if (hitArmor)
foreach (DamageModifier damageModifier in appliedDamageModifiers)
{
totalArmorValue = Math.Max(totalArmorValue, 0.0f);
amount = Math.Max(0.0f, amount - totalArmorValue);
bleedingAmount = Math.Max(0.0f, bleedingAmount - totalArmorValue);
amount *= damageModifier.DamageMultiplier;
bleedingAmount *= damageModifier.BleedingMultiplier;
}
#if CLIENT
if (playSound)
{
DamageSoundType damageSoundType = (damageType == DamageType.Blunt) ? DamageSoundType.LimbBlunt : DamageSoundType.LimbSlash;
if (hitArmor)
{
damageSoundType = DamageSoundType.LimbArmor;
}
foreach (DamageModifier damageModifier in appliedDamageModifiers)
{
if (damageModifier.DamageSoundType != DamageSoundType.None)
{
damageSoundType = damageModifier.DamageSoundType;
break;
}
}
SoundPlayer.PlayDamageSound(damageSoundType, amount, position);
}
float bloodParticleAmount = hitArmor || bleedingAmount <= 0.0f ? 0 : (int)Math.Min(amount / 5, 10);
float bloodParticleAmount = bleedingAmount <= 0.0f ? 0 : (int)Math.Min(amount / 5, 10);
float bloodParticleSize = MathHelper.Clamp(amount / 50.0f, 0.1f, 1.0f);
for (int i = 0; i < bloodParticleAmount; i++)
@@ -402,9 +403,14 @@ namespace Barotrauma
#endif
if (damageType == DamageType.Burn)
{
Burnt += amount * 10.0f;
}
damage += Math.Max(amount,bleedingAmount) / character.MaxHealth * 100.0f;
return new AttackResult(amount, bleedingAmount, hitArmor);
return new AttackResult(amount, bleedingAmount, appliedDamageModifiers);
}
public bool SectorHit(Vector2 armorSector, Vector2 simPosition)

View File

@@ -5,6 +5,7 @@ using FarseerPhysics.Dynamics.Joints;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace Barotrauma.Items.Components
@@ -255,7 +256,8 @@ namespace Barotrauma.Items.Components
target.Body.ApplyLinearImpulse(item.body.LinearVelocity * item.body.Mass);
if (attackResult.HitArmor)
if (attackResult.AppliedDamageModifiers != null &&
attackResult.AppliedDamageModifiers.Any(dm => dm.DeflectProjectiles))
{
item.body.LinearVelocity *= 0.1f;
}

View File

@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
@@ -27,79 +28,62 @@ namespace Barotrauma.Items.Components
class Wearable : Pickable
{
WearableSprite[] wearableSprites;
LimbType[] limbType;
Limb[] limb;
private WearableSprite[] wearableSprites;
private LimbType[] limbType;
private Limb[] limb;
private float armorValue;
private List<DamageModifier> damageModifiers;
private Vector2 armorSector;
[Serialize(0.0f, false)]
public float ArmorValue
public List<DamageModifier> DamageModifiers
{
get { return armorValue; }
set { armorValue = MathHelper.Clamp(value, 0.0f, 100.0f); }
get { return damageModifiers; }
}
[Serialize("0.0,360.0", false)]
public Vector2 ArmorSector
{
get { return armorSector; }
set
{
armorSector.X = MathHelper.ToRadians(value.X);
armorSector.Y = MathHelper.ToRadians(value.Y);
}
}
public Vector2 ArmorSectorLimits
{
get { return armorSector; }
}
public Wearable (Item item, XElement element)
: base(item, element)
{
this.item = item;
var sprites = element.Elements().Where(x => x.Name.ToString() == "sprite").ToList();
int spriteCount = sprites.Count;
damageModifiers = new List<DamageModifier>();
int spriteCount = element.Elements().Count(x => x.Name.ToString() == "sprite");
wearableSprites = new WearableSprite[spriteCount];
limbType = new LimbType[spriteCount];
limb = new Limb[spriteCount];
int i = 0;
foreach (XElement subElement in sprites)
foreach (XElement subElement in element.Elements())
{
//Rectangle sourceRect = new Rectangle(
// ToolBox.GetAttributeInt(subElement, "sourcex", 1),
// ToolBox.GetAttributeInt(subElement, "sourcey", 1),
// ToolBox.GetAttributeInt(subElement, "sourcewidth", 1),
// ToolBox.GetAttributeInt(subElement, "sourceheight", 1));
if (subElement.Attribute("texture") == null)
switch (subElement.Name.ToString().ToLower())
{
DebugConsole.ThrowError("Item \"" + item.Name + "\" doesn't have a texture specified!");
return;
case "sprite":
if (subElement.Attribute("texture") == null)
{
DebugConsole.ThrowError("Item \"" + item.Name + "\" doesn't have a texture specified!");
return;
}
string spritePath = subElement.Attribute("texture").Value;
spritePath = Path.GetDirectoryName(item.Prefab.ConfigFile) + "/" + spritePath;
var sprite = new Sprite(subElement, "", spritePath);
wearableSprites[i] = new WearableSprite(this, sprite,
subElement.GetAttributeBool("hidelimb", false),
subElement.GetAttributeBool("inheritlimbdepth", true),
(LimbType)Enum.Parse(typeof(LimbType), subElement.GetAttributeString("depthlimb", "None"), true));
limbType[i] = (LimbType)Enum.Parse(typeof(LimbType),
subElement.GetAttributeString("limb", "Head"), true);
i++;
break;
case "damagemodifier":
damageModifiers.Add(new DamageModifier(subElement));
break;
}
string spritePath = subElement.Attribute("texture").Value;
spritePath = Path.GetDirectoryName( item.Prefab.ConfigFile)+"/"+spritePath;
var sprite = new Sprite(subElement, "", spritePath);
wearableSprites[i] = new WearableSprite(this, sprite,
subElement.GetAttributeBool("hidelimb", false),
subElement.GetAttributeBool("inheritlimbdepth", true),
(LimbType)Enum.Parse(typeof(LimbType), subElement.GetAttributeString("depthlimb", "None"), true));
limbType[i] = (LimbType)Enum.Parse(typeof(LimbType),
subElement.GetAttributeString("limb", "Head"), true);
i++;
}
}
public override void Equip(Character character)
{
picker = character;
@@ -107,15 +91,7 @@ namespace Barotrauma.Items.Components
{
Limb equipLimb = character.AnimController.GetLimb(limbType[i]);
if (equipLimb == null) continue;
//something is already on the limb -> unequip it
//if (equipLimb.WearingItem != null && equipLimb.WearingItem != this)
//{
// equipLimb.WearingItem.Unequip(character);
//}
//sprite[i].Depth = equipLimb.sprite.Depth - 0.001f;
item.body.Enabled = false;
IsActive = true;
@@ -143,20 +119,9 @@ namespace Barotrauma.Items.Components
Limb equipLimb = character.AnimController.GetLimb(limbType[i]);
if (equipLimb == null) continue;
//foreach (WearableSprite wearable in equipLimb.WearingItems)
//{
// if (wearable != wearableSprites[i]) continue;
equipLimb.WearingItems.RemoveAll(w => w != null && w == wearableSprites[i]);
// equipLimb.WearingItems.Remove(wearableSprites[i]);
//}
equipLimb.WearingItems.RemoveAll(w=> w!=null && w==wearableSprites[i]);
//if (equipLimb.WearingItem != this) continue;
limb[i] = null;
//equipLimb.WearingItem = null;
//equipLimb.WearingItemSprite = null;
}
IsActive = false;

View File

@@ -761,7 +761,7 @@ namespace Barotrauma
float damageAmount = attack.GetStructureDamage(deltaTime);
Condition -= damageAmount;
return new AttackResult(damageAmount, 0.0f, false);
return new AttackResult(damageAmount, 0.0f, null);
}
private bool IsInWater()

View File

@@ -205,8 +205,6 @@ namespace Barotrauma
float dmg = (float)Math.Sqrt(size.X) * deltaTime / c.AnimController.Limbs.Length;
foreach (Limb limb in c.AnimController.Limbs)
{
if (limb.WearingItems.Find(w => w != null && w.WearableComponent.Item.FireProof) != null) continue;
limb.Burnt += dmg * 10.0f;
c.AddDamage(limb.SimPosition, DamageType.Burn, dmg, 0, 0, false);
}
}

View File

@@ -1873,11 +1873,6 @@ namespace Barotrauma.Networking
private void FileTransferChanged(FileSender.FileTransferOut transfer)
{
if (connectedClients.Any(c=> c.Connection == null))
{
int sdfgsdfg = 1;
}
Client recipient = connectedClients.Find(c => c.Connection == transfer.Connection);
#if CLIENT
UpdateFileTransferIndicator(recipient);

View File

@@ -3,10 +3,7 @@
static class NetConfig
{
public const int DefaultPort = 14242;
//UpdateEntity networkevents aren't sent to clients if they're further than this from the entity
public const float UpdateEntityDistance = 2500.0f;
public const int MaxPlayers = 16;
public static string MasterServerUrl = GameMain.Config.MasterServerUrl;
@@ -20,14 +17,6 @@
//send a position update to clients (in sim units)
public const float ItemPosUpdateDistance = 2.0f;
public const float LargeCharacterUpdateInterval = 5.0f;
public const float DeleteDisconnectedTime = 10.0f;
public const float IdSendInterval = 0.2f;
public const float RerequestInterval = 0.2f;
public const int ReliableMessageBufferSize = 500;
public const int ResendAttempts = 10;
public const float DeleteDisconnectedTime = 10.0f;
}
}

View File

@@ -57,7 +57,7 @@ namespace Barotrauma
#if DEBUG && CLIENT
if (GameMain.GameSession != null && GameMain.GameSession.Level != null && GameMain.GameSession.Submarine != null &&
!DebugConsole.IsOpen)
!DebugConsole.IsOpen && GUIComponent.KeyboardDispatcher.Subscriber == null)
{
var closestSub = Submarine.FindClosest(cam.WorldViewCenter);
if (closestSub == null) closestSub = GameMain.GameSession.Submarine;

View File

@@ -130,7 +130,15 @@ namespace Barotrauma
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + obj + "\" to " + value + " (not a valid " + propertyInfo.PropertyType + ")", e);
return false;
}
propertyInfo.SetValue(obj, enumVal);
try
{
propertyInfo.SetValue(obj, enumVal);
}
catch (Exception e)
{
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + obj.ToString() + "\" to " + value.ToString(), e);
return false;
}
}
else
{
@@ -141,45 +149,55 @@ namespace Barotrauma
}
}
switch (typeName)
try
{
case "bool":
propertyInfo.SetValue(obj, value.ToLowerInvariant() == "true", null);
break;
case "int":
int intVal;
if (int.TryParse(value, out intVal))
{
propertyInfo.SetValue(obj, intVal, null);
}
break;
case "float":
float floatVal;
if (float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out floatVal))
{
propertyInfo.SetValue(obj, floatVal, null);
}
break;
case "string":
propertyInfo.SetValue(obj, value, null);
break;
case "vector2":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector2(value));
break;
case "vector3":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector3(value));
break;
case "vector4":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector4(value));
break;
case "color":
propertyInfo.SetValue(obj, XMLExtensions.ParseColor(value));
break;
case "rectangle":
propertyInfo.SetValue(obj, XMLExtensions.ParseRect(value, true));
break;
switch (typeName)
{
case "bool":
propertyInfo.SetValue(obj, value.ToLowerInvariant() == "true", null);
break;
case "int":
int intVal;
if (int.TryParse(value, out intVal))
{
propertyInfo.SetValue(obj, intVal, null);
}
break;
case "float":
float floatVal;
if (float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out floatVal))
{
propertyInfo.SetValue(obj, floatVal, null);
}
break;
case "string":
propertyInfo.SetValue(obj, value, null);
break;
case "vector2":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector2(value));
break;
case "vector3":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector3(value));
break;
case "vector4":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector4(value));
break;
case "color":
propertyInfo.SetValue(obj, XMLExtensions.ParseColor(value));
break;
case "rectangle":
propertyInfo.SetValue(obj, XMLExtensions.ParseRect(value, true));
break;
}
}
catch (Exception e)
{
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + obj.ToString() + "\" to " + value.ToString(), e);
return false;
}
return true;
}
@@ -215,42 +233,52 @@ namespace Barotrauma
}
}
if (value.GetType() == typeof(string))
try
{
switch (typeName)
if (value.GetType() == typeof(string))
{
case "string":
propertyInfo.SetValue(obj, value, null);
return true;
case "vector2":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector2((string)value));
return true;
case "vector3":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector3((string)value));
return true;
case "vector4":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector4((string)value));
return true;
case "color":
propertyInfo.SetValue(obj, XMLExtensions.ParseColor((string)value));
return true;
case "rectangle":
propertyInfo.SetValue(obj, XMLExtensions.ParseColor((string)value));
return true;
default:
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + obj.ToString() + "\" to " + value.ToString());
DebugConsole.ThrowError("(Cannot convert a string to a " + propertyDescriptor.PropertyType.ToString() + ")");
return false;
switch (typeName)
{
case "string":
propertyInfo.SetValue(obj, value, null);
return true;
case "vector2":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector2((string)value));
return true;
case "vector3":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector3((string)value));
return true;
case "vector4":
propertyInfo.SetValue(obj, XMLExtensions.ParseVector4((string)value));
return true;
case "color":
propertyInfo.SetValue(obj, XMLExtensions.ParseColor((string)value));
return true;
case "rectangle":
propertyInfo.SetValue(obj, XMLExtensions.ParseRect((string)value, false));
return true;
default:
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + obj.ToString() + "\" to " + value.ToString());
DebugConsole.ThrowError("(Cannot convert a string to a " + propertyDescriptor.PropertyType.ToString() + ")");
return false;
}
}
else if (propertyDescriptor.PropertyType != value.GetType())
{
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + obj.ToString() + "\" to " + value.ToString());
DebugConsole.ThrowError("(Non-matching type, should be " + propertyDescriptor.PropertyType + " instead of " + value.GetType() + ")");
return false;
}
propertyInfo.SetValue(obj, value, null);
}
else if (propertyDescriptor.PropertyType != value.GetType())
catch (Exception e)
{
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + obj.ToString() + "\" to " + value.ToString());
DebugConsole.ThrowError("(Non-matching type, should be " + propertyDescriptor.PropertyType + " instead of " + value.GetType() + ")");
DebugConsole.ThrowError("Failed to set the value of the property \"" + Name + "\" of \"" + obj.ToString() + "\" to " + value.ToString(), e);
return false;
}
propertyInfo.SetValue(obj, value, null);
return true;
}
catch

View File

@@ -1,3 +1,26 @@
---------------------------------------------------------------------------------------------------------
v0.7.0.1
---------------------------------------------------------------------------------------------------------
- Added console commands for modifying client permissions.
- Fixed content package setting not being saved in the settings menu.
- Item pickup sounds are only played when the controlled character picks up an item.
- Removed serverconfig.xml (the dedicated server now uses the same config file as the normal game).
- Updated the vanilla content package to version 0.7.
- Fixed entity linking in the submarine editor.
- Fixed railgun HUD crashing the game if the railgun is linked to an item that does not have an
ItemContainer component (i.e. any item that can't contain other items).
- Fixed exceptions when the player dies in the tutorial.
- Fixed the start popup saying the host is the target if the host has been selected as the traitor.
- Fixed crashes when attempting to use a railgun controller that's not connected to anything.
- Fixed autorestart counter overlapping with the campaign map in the server lobby screen.
- Fixed characters receiving damage almost exclusively to their feet when wearing a diving suit.
- Armoring reduces damage by a certain percentage, not a fixed value. Now armor doesn't make characters
invulnerable to small amounts of damage.
- The effectiveness of different types of armor depends on the type of damage. For example, diving suits
provide fairly good protection against burn and slash damage, but aren't as affective against blunt damage.
- Fixed light sources attached to limbs not rotating with the limbs.
---------------------------------------------------------------------------------------------------------
v0.7.0.0
---------------------------------------------------------------------------------------------------------