More accurate and reliable submarine-level collisions, looping OnUse sounds bugfix, new music clips, item sprites removed from limbs when someone else loots the item, Camera.WorldView fix, checking vector.LengthSquared before normalizing to avoid creating a NaN vector

This commit is contained in:
Regalis
2015-10-04 23:50:46 +03:00
parent 0be4ad4f84
commit f13a48ef52
33 changed files with 342 additions and 217 deletions

View File

@@ -240,7 +240,7 @@ namespace Subsurface.Items.Components
{
if (!isStuck)
{
OpenState += deltaTime * ((isOpen) ? 2.0f : -1.0f);
OpenState += deltaTime * ((isOpen) ? 2.0f : -2.0f);
LinkedGap.Open = openState;
}

View File

@@ -221,7 +221,7 @@ namespace Subsurface.Items.Components
AnimController ac = picker.AnimController;
//item.sprite.Depth = picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.01f;
//item.sprite.Depth = picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.01f;
ac.HoldItem(deltaTime, item, handlePos, holdPos, aimPos, picker.GetInputState(InputType.SecondaryHeld), holdAngle);
}

View File

@@ -111,11 +111,11 @@ namespace Subsurface.Items.Components
Vector2 targetPosition = item.body.SimPosition;
//targetPosition = targetPosition.X, -targetPosition.Y);
float degreeOfSuccess = DegreeOfSuccess(character);
float degreeOfSuccess = DegreeOfSuccess(character)/100.0f;
if (Rand.Range(0.0f, 1.0f) > degreeOfSuccess * degreeOfSuccess)
if (Rand.Range(0.0f, 0.5f) > degreeOfSuccess)
{
ApplyStatusEffects(ActionType.OnFailure, 1.0f, character);
ApplyStatusEffects(ActionType.OnFailure, deltaTime, character);
return false;
}
@@ -147,7 +147,7 @@ namespace Subsurface.Items.Components
targetStructure.HighLightSection(sectionIndex);
targetStructure.AddDamage(sectionIndex, -structureFixAmount);
targetStructure.AddDamage(sectionIndex, -structureFixAmount*degreeOfSuccess);
//if the next section is small enough, apply the effect to it as well
//(to make it easier to fix a small "left-over" section)
@@ -155,7 +155,7 @@ namespace Subsurface.Items.Components
if (nextSectionLength > 0 && nextSectionLength < Structure.wallSectionSize * 0.3f)
{
targetStructure.HighLightSection(sectionIndex + 1);
targetStructure.AddDamage(sectionIndex + 1, -structureFixAmount);
targetStructure.AddDamage(sectionIndex + 1, -structureFixAmount * degreeOfSuccess);
}
}
@@ -163,7 +163,7 @@ namespace Subsurface.Items.Components
{
if (character.GetInputState(InputType.SecondaryHeld))
{
targetLimb.character.Health += limbFixAmount;
targetLimb.character.Health += limbFixAmount * degreeOfSuccess;
//isActive = true;
}
}

View File

@@ -277,12 +277,12 @@ namespace Subsurface.Items.Components
private int loopingSoundIndex;
public void PlaySound(ActionType type, Vector2 position)
{
List<ItemSound> matchingSounds = sounds.FindAll(x => x.Type == type);
if (matchingSounds.Count == 0) return;
ItemSound itemSound = null;
if (!Sounds.SoundManager.IsPlaying(loopingSoundIndex))
{
List<ItemSound> matchingSounds = sounds.FindAll(x => x.Type == type);
if (matchingSounds.Count == 0) return;
int index = Rand.Int(matchingSounds.Count);
itemSound = matchingSounds[index];
}

View File

@@ -151,7 +151,6 @@ namespace Subsurface.Items.Components
}
}
item.body.FarseerBody.OnCollision -= OnProjectileCollision;
item.body.FarseerBody.IsBullet = false;
@@ -181,17 +180,21 @@ namespace Subsurface.Items.Components
}
var containedItems = item.ContainedItems;
if (containedItems == null) return true;
foreach (Item contained in containedItems)
if (containedItems != null)
{
if (contained.body != null)
foreach (Item contained in containedItems)
{
contained.SetTransform(item.SimPosition, contained.body.Rotation);
if (contained.body != null)
{
contained.SetTransform(item.SimPosition, contained.body.Rotation);
}
contained.Condition = 0.0f;
}
contained.Condition = 0.0f;
}
return false;
return (f2.CollisionCategories != Physics.CollisionCharacter);
//return false;
}
private bool StickToTarget(Body targetBody, Vector2 axis)