- Charybdis's and coelanths can eat other creatures.

- Split charybdis's tail into several parts, the single stiff tail limb made it too difficult for it to turn around.
- Option to override the torque that's used to rotate the mainlimb of swimming creatures to the correct direction.
- The scale of the characters' limbs is taken into account in EditCharacterScreen.
This commit is contained in:
Joonas Rikkonen
2017-06-22 18:16:00 +03:00
parent 38f92acf8e
commit e090806d3a
8 changed files with 66 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 KiB

After

Width:  |  Height:  |  Size: 617 KiB

View File

@@ -9,15 +9,22 @@
attackpriorityrooms="50.0"
attackpriorityweaker="50"
attackprioritystronger="-30"
eatpriority="40"
sight="0.5"
hearing="1.0"/>
<ragdoll waveamplitude="150.0" wavelength="10000" swimspeed="4.0" scale="1.5" canentersubmarine="false">
<ragdoll
waveamplitude="150.0"
wavelength="10000"
steertorque="1000"
swimspeed="4.0"
scale="1.5"
canentersubmarine="false">
<collider radius="80" height="440"/>
<!-- body -->
<limb id = "0" radius="100" height="470" type="Torso" steerforce="1.0">
<limb id = "0" radius="100" height="470" type="Torso" steerforce="1.0" mouthpos="0,260">
<sprite texture="Content/Characters/Charybdis/charybdis.png" sourcerect="160,0,242,688" depth="0.015" origin="0.5,0.5"/>
</limb>
@@ -33,17 +40,25 @@
</limb>
<!-- tail -->
<limb id = "3" radius="80" height="580" type="Tail">
<sprite texture="Content/Characters/Charybdis/charybdis.png" sourcerect="0,0,160,752" depth="0.02" origin="0.5,0.5"/>
<limb id = "3" radius="60" height="250" type="Tail">
<sprite texture="Content/Characters/Charybdis/charybdis.png" sourcerect="0,0,160,379" depth="0.02" origin="0.5,0.5"/>
</limb>
<limb id = "4" radius="30" height="168" type="Tail">
<sprite texture="Content/Characters/Charybdis/charybdis.png" sourcerect="24,402,83,228" depth="0.02" origin="0.5,0.5"/>
</limb>
<limb id = "5" radius="20" height="200" type="Tail">
<sprite texture="Content/Characters/Charybdis/charybdis.png" sourcerect="33,645,77,244" depth="0.02" origin="0.5,0.5"/>
</limb>
<!-- body to lower yaw -->
<joint limb1="0" limb1anchor="48,128" limb2="1" limb2anchor="-30,-90" lowerlimit="-10" upperlimit="30"/>
<!-- body to front fin -->
<joint limb1="0" limb1anchor="32,-32" limb2="2" limb2anchor="-32,260" lowerlimit="-50" upperlimit="0"/>
<!-- body to tail -->
<joint limb1="0" limb1anchor="0,-270" limb2="3" limb2anchor="0,280" lowerlimit="-20" upperlimit="20"/>
<joint limb1="0" limb1anchor="0,-270" limb2="3" limb2anchor="2,134" lowerlimit="-30" upperlimit="30"/>
<joint limb1="3" limb1anchor="-10,-153" limb2="4" limb2anchor="6,88" lowerlimit="-30" upperlimit="30"/>
<joint limb1="4" limb1anchor="-14,-95" limb2="5" limb2anchor="-18,108" lowerlimit="-30" upperlimit="30"/>
</ragdoll>
</Character>

View File

@@ -6,20 +6,27 @@
<sound file="Content/Characters/Coelanth/idle2.ogg" state="None" />
<ai
combatstrength="300"
combatstrength="400"
attackpriorityhumans="90.0"
attackpriorityrooms="50.0"
attackpriorityweaker="50"
attackprioritystronger="-100"
eatpriority="40"
sight="0.1"
hearing="1.0"/>
<ragdoll waveamplitude="50.0" wavelength="2500" swimspeed="5.0" walkspeed="3.5" canentersubmarine="false">
<ragdoll
waveamplitude="50.0"
wavelength="2500"
steertorque="500"
swimspeed="5.0"
walkspeed="3.5"
canentersubmarine="false">
<collider radius="50" height="250"/>
<!-- head -->
<limb id = "0" radius="50" height="270" type="Head" steerforce="1.0">
<limb id = "0" radius="50" height="270" type="Head" steerforce="1.0" mouthpos="50,75">
<sprite texture="Content/Characters/Coelanth/coelanth.png" sourcerect="267,171,162,392" depth="0.02" origin ="0.5,0.5"/>
</limb>

View File

@@ -15,8 +15,11 @@
sight="0.5"
hearing="1.0"/>
<ragdoll waveamplitude="50.0" wavelength="2500"
swimspeed="4.0" swimspeedmultiplier="1.5"
<ragdoll waveamplitude="50.0"
wavelength="2500"
steertorque="100"
swimspeed="4.0"
swimspeedmultiplier="1.5"
canentersubmarine="false">
<collider radius="50" height="320"/>

View File

@@ -485,6 +485,7 @@ namespace Barotrauma
{
//only one limb left, the character is now full eaten
Entity.Spawner.AddToRemoveQueue(targetCharacter);
selectedAiTarget = null;
state = AIState.None;
}
else //sever a random joint

View File

@@ -15,6 +15,8 @@ namespace Barotrauma
private float waveAmplitude;
private float waveLength;
private float steerTorque;
private bool rotateTowardsMovement;
private bool mirror, flip;
@@ -28,13 +30,15 @@ namespace Barotrauma
public FishAnimController(Character character, XElement element)
: base(character, element)
{
waveAmplitude = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "waveamplitude", 0.0f));
waveLength = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "wavelength", 0.0f));
waveAmplitude = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "waveamplitude", 0.0f));
waveLength = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "wavelength", 0.0f));
steerTorque = ToolBox.GetAttributeFloat(element, "steertorque", 25.0f);
flip = ToolBox.GetAttributeBool(element, "flip", true);
mirror = ToolBox.GetAttributeBool(element, "mirror", false);
flip = ToolBox.GetAttributeBool(element, "flip", true);
mirror = ToolBox.GetAttributeBool(element, "mirror", false);
float footRot = ToolBox.GetAttributeFloat(element,"footrotation", float.NaN);
float footRot = ToolBox.GetAttributeFloat(element, "footrotation", float.NaN);
if (float.IsNaN(footRot))
{
footRotation = null;
@@ -184,12 +188,12 @@ namespace Barotrauma
if (rotateTowardsMovement)
{
Collider.SmoothRotate(movementAngle, 25.0f);
MainLimb.body.SmoothRotate(movementAngle, 25.0f);
MainLimb.body.SmoothRotate(movementAngle, steerTorque);
}
else
{
Collider.SmoothRotate(HeadAngle * Dir, 25.0f);
MainLimb.body.SmoothRotate(HeadAngle * Dir, 25.0f);
MainLimb.body.SmoothRotate(HeadAngle * Dir, steerTorque);
}
Limb tail = GetLimb(LimbType.Tail);

View File

@@ -136,6 +136,11 @@ namespace Barotrauma
get { return body.Rotation; }
}
public float Scale
{
get { return scale; }
}
//where an animcontroller is trying to pull the limb, only used for debug visualization
public Vector2 AnimTargetPos
{

View File

@@ -253,24 +253,27 @@ namespace Barotrauma
{
continue;
}
jointPos.Y = -jointPos.Y;
jointPos += limbBodyPos;
Vector2 tformedJointPos = jointPos /= limb.Scale;
tformedJointPos.Y = -tformedJointPos.Y;
tformedJointPos += limbBodyPos;
if (joint.BodyA == limb.body.FarseerBody)
{
float a1 = joint.UpperLimit - MathHelper.PiOver2;
float a2 = joint.LowerLimit - MathHelper.PiOver2;
float a3 =( a1+a2)/2.0f;
GUI.DrawLine(spriteBatch, jointPos, jointPos + new Vector2((float)Math.Cos(a1), -(float)Math.Sin(a1)) * 30.0f, Color.Green);
GUI.DrawLine(spriteBatch, jointPos, jointPos + new Vector2((float)Math.Cos(a2), -(float)Math.Sin(a2)) * 30.0f, Color.DarkGreen);
float a3 = (a1 + a2) / 2.0f;
GUI.DrawLine(spriteBatch, tformedJointPos, tformedJointPos + new Vector2((float)Math.Cos(a1), -(float)Math.Sin(a1)) * 30.0f, Color.Green);
GUI.DrawLine(spriteBatch, tformedJointPos, tformedJointPos + new Vector2((float)Math.Cos(a2), -(float)Math.Sin(a2)) * 30.0f, Color.DarkGreen);
GUI.DrawLine(spriteBatch, jointPos, jointPos + new Vector2((float)Math.Cos(a3), -(float)Math.Sin(a3)) * 30.0f, Color.LightGray);
GUI.DrawLine(spriteBatch, tformedJointPos, tformedJointPos + new Vector2((float)Math.Cos(a3), -(float)Math.Sin(a3)) * 30.0f, Color.LightGray);
}
GUI.DrawRectangle(spriteBatch, jointPos, new Vector2(5.0f, 5.0f), Color.Red, true);
if (Vector2.Distance(PlayerInput.MousePosition, jointPos) < 6.0f)
GUI.DrawRectangle(spriteBatch, tformedJointPos, new Vector2(5.0f, 5.0f), Color.Red, true);
if (Vector2.Distance(PlayerInput.MousePosition, tformedJointPos) < 10.0f)
{
GUI.DrawRectangle(spriteBatch, jointPos - new Vector2(3.0f, 3.0f), new Vector2(11.0f, 11.0f), Color.Red, false);
GUI.DrawString(spriteBatch, tformedJointPos + Vector2.One*10.0f, jointPos.ToString(), Color.White, Color.Black * 0.5f);
GUI.DrawRectangle(spriteBatch, tformedJointPos - new Vector2(3.0f, 3.0f), new Vector2(11.0f, 11.0f), Color.Red, false);
if (PlayerInput.LeftButtonHeld())
{
Vector2 speed = ConvertUnits.ToSimUnits(PlayerInput.MouseSpeed);