Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5994,6 +5994,20 @@ public void StopClimbing()
AnimController.StopClimbing();
ReleaseSecondaryItem();
}
public void TryFlipCharacter()
{
if (AnimController is FishAnimController fishAnimController)
{
if (fishAnimController.CurrentFishAnimation.Flip)
{
fishAnimController.Flip();
}
}
else
{
AnimController.Flip();
}
}
}

class ActiveTeamChange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ private IEnumerable<CoroutineStatus> CreateAIHusk()
}

husk.SetStun(5);
if (character.IsFlipped)
{
husk.TryFlipCharacter();
}
yield return new WaitForSeconds(5, false);
#if CLIENT
husk?.PlaySound(CharacterSound.SoundType.Idle);
Expand Down
4 changes: 4 additions & 0 deletions Barotrauma/BarotraumaShared/SharedSource/Map/Levels/Level.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4973,6 +4973,10 @@ public void SpawnCorpses()
corpse.EnableDespawn = false;
selectedPrefab.GiveItems(corpse, wreck, sp);
bool spawnAsHusk = Rand.Value() <= Loaded.GenerationParams.HuskProbability;
if(Rand.Value() <= 0.5)
{
corpse.TryFlipCharacter(); // Random chance to spawn flipped
}
if (spawnAsHusk)
{
corpse.TurnIntoHusk(playDead: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ public AITrigger(XElement element)

private readonly int useItemCount;

private readonly bool removeItem, dropContainedItems, dropItem, removeCharacter, breakLimb, hideLimb;
private readonly bool removeItem, dropContainedItems, dropItem, removeCharacter, breakLimb, hideLimb, flipCharacter;
private readonly float hideLimbTimer;

/// <summary>
Expand Down Expand Up @@ -1014,6 +1014,9 @@ protected StatusEffect(ContentXElement element, string parentDebugName)
removeCharacter = true;
containerForItemsOnCharacterRemoval = subElement.GetAttributeIdentifier("moveitemstocontainer", Identifier.Empty);
break;
case "flipcharacter":
flipCharacter = true;
break;
case "breaklimb":
breakLimb = true;
break;
Expand Down Expand Up @@ -1671,6 +1674,9 @@ protected void Apply(float deltaTime, Entity entity, IReadOnlyList<ISerializable
PhysicsBody parentItemBody = parentItem?.body;
Hull hull = GetHull(entity);
Vector2 position = GetPosition(entity, targets, worldPosition);

bool isNotClient = GameMain.NetworkMember == null || !GameMain.NetworkMember.IsClient;

if (useItemCount > 0)
{
Character useTargetCharacter = null;
Expand Down Expand Up @@ -1748,6 +1754,17 @@ protected void Apply(float deltaTime, Entity entity, IReadOnlyList<ISerializable
if (targetCharacter != null) { RemoveCharacter(targetCharacter); }
}
}
if (flipCharacter && isNotClient)
{
for (int i = 0; i < targets.Count; i++)
{
var target = GetCharacterFromTarget(targets[i]);
if (target != null)
{
target.TryFlipCharacter();
}
}
}
if (breakLimb || hideLimb)
{
for (int i = 0; i < targets.Count; i++)
Expand Down Expand Up @@ -1817,8 +1834,6 @@ protected void Apply(float deltaTime, Entity entity, IReadOnlyList<ISerializable
}
}

bool isNotClient = GameMain.NetworkMember == null || !GameMain.NetworkMember.IsClient;

for (int i = 0; i < targets.Count; i++)
{
var target = targets[i];
Expand Down Expand Up @@ -2130,6 +2145,10 @@ entity is Item item &&
foreach (var target in targets)
{
if (target is not Character character) { continue; }
if (character.IsFlipped)
{
newCharacter.TryFlipCharacter();
}
if (characterSpawnInfo.TransferInventory && character.Inventory != null && newCharacter.Inventory != null)
{
if (character.Inventory.Capacity != newCharacter.Inventory.Capacity) { return; }
Expand Down