Skip to content

Commit

Permalink
LostArtefacts#241 TR3 Environment Randomization
Browse files Browse the repository at this point in the history
If converting a pickup trigger to something else, the first action list item (the pickup reference) will be removed.
EntityPropertyCondition now supports checking X,Y,Z and Room.
  • Loading branch information
lahm86 committed Dec 16, 2021
1 parent 5a1ff5a commit 00204d6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public class EMEntityPropertyCondition : BaseEMCondition
public short? Intensity1 { get; set; }
public short? Intensity2 { get; set; }
public ushort? Flags { get; set; }
public int? X { get; set; }
public int? Y { get; set; }
public int? Z { get; set; }
public short? Room { get; set; }

public override bool GetResult(TR2Level level)
{
Expand Down Expand Up @@ -55,6 +59,22 @@ private bool GetResult(TR2Entity entity)
{
result &= entity.Flags == Flags.Value;
}
if (X.HasValue)
{
result &= entity.X == X.Value;
}
if (Y.HasValue)
{
result &= entity.Y == Y.Value;
}
if (Z.HasValue)
{
result &= entity.Z == Z.Value;
}
if (Room.HasValue)
{
result &= entity.Room == Room.Value;
}
return result;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ private void ConvertTrigger(TRRoomSector sector, FDControl floorData)
{
if (TrigType.HasValue)
{
if (trigger.TrigType == FDTrigType.Pickup && TrigType.Value != FDTrigType.Pickup && trigger.TrigActionList.Count > 0)
{
// The first action entry for pickup triggers is the pickup reference itself, so
// this is no longer needed.
trigger.TrigActionList.RemoveAt(0);
}
trigger.TrigType = TrigType.Value;
}
if (OneShot.HasValue)
Expand Down

0 comments on commit 00204d6

Please sign in to comment.