Limb collisions can damage hull again, new UI for steering, sonar & reactor, fabricators can require more than one of each ingredient, timer for character imploding, AICharacter position syncing changes, watcher, commands can also be given to controlled character

This commit is contained in:
Regalis
2016-01-13 22:19:01 +02:00
parent 5513637fe5
commit eb20af622d
23 changed files with 400 additions and 204 deletions
@@ -159,18 +159,11 @@ namespace Barotrauma
characterButton.UserData = character;
characterButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
if (character == Character.Controlled)
{
characterButton.CanBeSelected = false;
characterButton.Color = Color.LightGray * 0.3f;
}
else
{
characterButton.Color = Color.Black * 0.5f;
characterButton.HoverColor = Color.LightGray * 0.5f;
characterButton.SelectedColor = Color.Gold * 0.5f;
characterButton.OutlineColor = Color.LightGray * 0.8f;
}
characterButton.Color = Character.Controlled == character ? Color.Gold * 0.3f : Color.Black * 0.5f;
characterButton.HoverColor = Color.LightGray * 0.5f;
characterButton.SelectedColor = Color.Gold * 0.5f;
characterButton.OutlineColor = Color.LightGray * 0.8f;
string name = character.Info.Name;
if (character.Info.Job != null) name += '\n' + "(" + character.Info.Job.Name + ")";
@@ -16,6 +16,8 @@ namespace Barotrauma
private const float UpdateTargetsInterval = 5.0f;
private const float RaycastInterval = 1.0f;
private bool attackWhenProvoked;
//the preference to attack a specific type of target (-1.0 - 1.0)
//0.0 = doesn't attack targets of the type
@@ -84,6 +86,8 @@ namespace Barotrauma
sight = ToolBox.GetAttributeFloat(aiElement, "sight", 0.0f);
hearing = ToolBox.GetAttributeFloat(aiElement, "hearing", 0.0f);
attackWhenProvoked = ToolBox.GetAttributeBool(aiElement, "attackwhenprovoked", false);
steeringManager = new SteeringManager(this);
state = AiState.None;
@@ -286,6 +290,12 @@ namespace Barotrauma
updateTargetsTimer = Math.Min(updateTargetsTimer, 0.1f);
coolDownTimer *= 0.1f;
if (amount > 1.0f && attackWhenProvoked)
{
attackHumans = 100.0f;
attackRooms = 100.0f;
}
if (attacker==null || attacker.AiTarget==null) return;
AITargetMemory targetMemory = FindTargetMemory(attacker.AiTarget);
targetMemory.Priority += amount;
@@ -508,11 +518,13 @@ namespace Barotrauma
message.Write(wallAttack);
if (wallAttack)
{
message.WriteRangedSingle(MathHelper.Clamp(wallAttackPos.X, -50.0f, 50.0f), -50.0f, 50.0f, 10);
message.WriteRangedSingle(MathHelper.Clamp(wallAttackPos.Y, -50.0f, 50.0f), -50.0f, 50.0f, 10);
}
//if (wallAttack)
//{
// Vector2 relativeWallAttackPos = wallAttackPos - Submarine.Loaded.SimPosition;
// message.WriteRangedSingle(MathHelper.Clamp(relativeWallAttackPos.X, -50.0f, 50.0f), -50.0f, 50.0f, 10);
// message.WriteRangedSingle(MathHelper.Clamp(relativeWallAttackPos.Y, -50.0f, 50.0f), -50.0f, 50.0f, 10);
//}
//message.Write(Velocity.X);
//message.Write(Velocity.Y);
@@ -542,14 +554,16 @@ namespace Barotrauma
newState = (AiState)(message.ReadByte());
bool wallAttack = message.ReadBoolean();
//bool wallAttack = message.ReadBoolean();
if (wallAttack)
{
newWallAttackPos = new Vector2(
message.ReadRangedSingle(-50.0f, 50.0f, 10),
message.ReadRangedSingle(-50.0f, 50.0f, 10));
}
//if (wallAttack)
//{
// newWallAttackPos = new Vector2(
// message.ReadRangedSingle(-50.0f, 50.0f, 10),
// message.ReadRangedSingle(-50.0f, 50.0f, 10));
// newWallAttackPos += Submarine.Loaded.SimPosition;
//}
//newVelocity = new Vector2(message.ReadFloat(), message.ReadFloat());
@@ -565,7 +579,7 @@ namespace Barotrauma
catch { return; }
wallAttackPos = newWallAttackPos;
//wallAttackPos = newWallAttackPos;
steeringManager.WanderAngle = wanderAngle;
//this.updateTargetsTimer = updateTargetsTimer;