water ambience sounds change according to speed, oxygengenerator fills oxygen tanks even if their condition is 0, submarine refactoring & bugfixes, wire node editing bugfixes
This commit is contained in:
@@ -44,6 +44,8 @@ namespace Subsurface
|
||||
steeringManager = new SteeringManager(this);
|
||||
}
|
||||
|
||||
public virtual void OnAttacked(IDamageable attacker, float amount) { }
|
||||
|
||||
public virtual void SelectTarget(AITarget target) { }
|
||||
|
||||
public virtual void Update(float deltaTime) { }
|
||||
|
||||
@@ -262,6 +262,13 @@ namespace Subsurface
|
||||
targetEntity = closestBody.UserData as IDamageable;
|
||||
}
|
||||
|
||||
public override void OnAttacked(IDamageable attacker, float amount)
|
||||
{
|
||||
if (attacker==null || attacker.AiTarget==null) return;
|
||||
AITargetMemory targetMemory = FindTargetMemory(attacker.AiTarget);
|
||||
targetMemory.Priority += amount;
|
||||
}
|
||||
|
||||
private void UpdateLimbAttack(float deltaTime, Limb limb, Vector2 attackPosition)
|
||||
{
|
||||
IDamageable damageTarget = null;
|
||||
@@ -295,8 +302,8 @@ namespace Subsurface
|
||||
{
|
||||
attackTimer += deltaTime;
|
||||
limb.body.ApplyTorque(limb.Mass * 50.0f * Character.AnimController.Dir * dir);
|
||||
|
||||
limb.attack.DoDamage(damageTarget, limb.SimPosition, deltaTime, (limb.soundTimer <= 0.0f));
|
||||
|
||||
limb.attack.DoDamage(Character, damageTarget, limb.SimPosition, deltaTime, (limb.soundTimer <= 0.0f));
|
||||
|
||||
limb.soundTimer = Limb.SoundInterval;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Subsurface
|
||||
{
|
||||
class AICharacter : Character
|
||||
{
|
||||
const float AttackBackPriority = 1.0f;
|
||||
|
||||
private AIController aiController;
|
||||
|
||||
public AICharacter(string file) : this(file, Vector2.Zero, null)
|
||||
@@ -57,6 +59,15 @@ namespace Subsurface
|
||||
aiController.Update(deltaTime);
|
||||
}
|
||||
|
||||
public override AttackResult AddDamage(IDamageable attacker, Vector2 position, Attack attack, bool playSound = false)
|
||||
{
|
||||
AttackResult result = base.AddDamage(attacker, position, attack, playSound);
|
||||
|
||||
aiController.OnAttacked(attacker, (result.Damage + result.Bleeding)/Math.Max(health,1.0f));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data)
|
||||
{
|
||||
if (type == NetworkEventType.KillCharacter)
|
||||
|
||||
@@ -51,6 +51,12 @@ namespace Subsurface
|
||||
|
||||
private float priority;
|
||||
|
||||
|
||||
//public Attack(AttackType type, float range,)
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
public Attack(XElement element)
|
||||
{
|
||||
try
|
||||
@@ -94,10 +100,10 @@ namespace Subsurface
|
||||
{
|
||||
if (subElement.Name.ToString().ToLower() == "particleemitter") particleEmitterPrefab = new ParticleEmitterPrefab(subElement);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public AttackResult DoDamage(IDamageable target, Vector2 position, float deltaTime, bool playSound = true)
|
||||
|
||||
public AttackResult DoDamage(IDamageable attacker, IDamageable target, Vector2 position, float deltaTime, bool playSound = true)
|
||||
{
|
||||
float damageAmount = 0.0f;
|
||||
//DamageSoundType damageSoundType = DamageSoundType.None;
|
||||
@@ -125,7 +131,7 @@ namespace Subsurface
|
||||
sound.Play(1.0f, 500.0f, position);
|
||||
}
|
||||
|
||||
return target.AddDamage(position, DamageType, damageAmount, bleedingAmount, Stun, playSound);
|
||||
return target.AddDamage(attacker, position, this, playSound);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -856,7 +856,12 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
public AttackResult AddDamage(Vector2 position, DamageType damageType, float amount, float bleedingAmount, float stun, bool playSound = false)
|
||||
public virtual AttackResult AddDamage(IDamageable attacker, Vector2 position, Attack attack, bool playSound = false)
|
||||
{
|
||||
return AddDamage(position, attack.DamageType, attack.Damage, attack.BleedingDamage, attack.Stun, playSound);
|
||||
}
|
||||
|
||||
public AttackResult AddDamage(Vector2 position, DamageType damageType, float amount, float bleedingAmount, float stun, bool playSound)
|
||||
{
|
||||
AnimController.StunTimer = Math.Max(AnimController.StunTimer, stun);
|
||||
|
||||
@@ -882,7 +887,6 @@ namespace Subsurface
|
||||
bleeding += attackResult.Bleeding;
|
||||
|
||||
return attackResult;
|
||||
|
||||
}
|
||||
|
||||
public void Stun()
|
||||
|
||||
@@ -669,13 +669,13 @@ namespace Subsurface
|
||||
foreach (MapEntity e in MapEntity.mapEntityList)
|
||||
{
|
||||
Gap gap = e as Gap;
|
||||
if (gap == null || gap.FlowTargetHull != currentHull || gap.FlowForce == Vector2.Zero) continue;
|
||||
if (gap == null || gap.FlowTargetHull != currentHull || gap.LerpedFlowForce == Vector2.Zero) continue;
|
||||
|
||||
Vector2 gapPos = gap.SimPosition;
|
||||
|
||||
float dist = Vector2.Distance(limbPos, gapPos);
|
||||
|
||||
force += Vector2.Normalize(gap.FlowForce) * (Math.Max(gap.FlowForce.Length() - dist, 0.0f) / 500.0f);
|
||||
force += Vector2.Normalize(gap.LerpedFlowForce) * (Math.Max(gap.LerpedFlowForce.Length() - dist, 0.0f) / 500.0f);
|
||||
}
|
||||
|
||||
if (force.Length() > 20.0f) return force;
|
||||
|
||||
Reference in New Issue
Block a user