From 14dff4e787e29b5035632eefbaf59850de7453ef Mon Sep 17 00:00:00 2001 From: kamyu2 Date: Thu, 15 Mar 2012 21:08:57 -0500 Subject: [PATCH] Add rotation for upside down stairs. --- blockrotation.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/blockrotation.py b/blockrotation.py index 9af6d89..b68d399 100644 --- a/blockrotation.py +++ b/blockrotation.py @@ -7,6 +7,16 @@ def genericVerticalFlip(cls): if hasattr(cls, "Up") and hasattr(cls, "Down"): rotation[cls.Up] = cls.Down rotation[cls.Down] = cls.Up + + if hasattr(cls, "TopNorth") and hasattr(cls, "TopWest") and hasattr(cls, "TopSouth") and hasattr(cls, "TopEast"): + rotation[cls.North] = cls.TopNorth + rotation[cls.West] = cls.TopWest + rotation[cls.South] = cls.TopSouth + rotation[cls.East] = cls.TopEast + rotation[cls.TopNorth] = cls.North + rotation[cls.TopWest] = cls.West + rotation[cls.TopSouth] = cls.South + rotation[cls.TopEast] = cls.East return rotation @@ -17,6 +27,12 @@ def genericRotation(cls): rotation[cls.West] = cls.South rotation[cls.South] = cls.East rotation[cls.East] = cls.North + if hasattr(cls, "TopNorth") and hasattr(cls, "TopWest") and hasattr(cls, "TopSouth") and hasattr(cls, "TopEast"): + rotation[cls.TopNorth] = cls.TopWest + rotation[cls.TopWest] = cls.TopSouth + rotation[cls.TopSouth] = cls.TopEast + rotation[cls.TopEast] = cls.TopNorth + return rotation @@ -24,6 +40,10 @@ def genericEastWestFlip(cls): rotation = arange(16, dtype='uint8') rotation[cls.West] = cls.East rotation[cls.East] = cls.West + if hasattr(cls, "TopWest") and hasattr(cls, "TopEast"): + rotation[cls.TopWest] = cls.TopEast + rotation[cls.TopEast] = cls.TopWest + return rotation @@ -31,6 +51,10 @@ def genericNorthSouthFlip(cls): rotation = arange(16, dtype='uint8') rotation[cls.South] = cls.North rotation[cls.North] = cls.South + if hasattr(cls, "TopNorth") and hasattr(cls, "TopSouth"): + rotation[cls.TopSouth] = cls.TopNorth + rotation[cls.TopNorth] = cls.TopSouth + return rotation rotationClasses = [] @@ -77,6 +101,10 @@ class Stair: North = 1 West = 2 East = 3 + TopSouth = 4 + TopNorth = 5 + TopWest = 6 + TopEast = 7 genericFlipRotation(Stair)