Skip to content

Instantly share code, notes, and snippets.

@Darthfett
Created November 6, 2011 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Darthfett/1342503 to your computer and use it in GitHub Desktop.
Save Darthfett/1342503 to your computer and use it in GitHub Desktop.
Lever Metadata
// Methods of Dealing with Metadata (such as whether a lever is turned on or off (powered or unpowered)
// 1:
mf.Metadata.Levers = {
"SideEastOff": 1,
"SideWestOff": 2,
"SideSouthOff": 3,
"SideNorthOff": 4,
"TopNorthOff": 5,
"TopEastOff": 6,
"SideEastOn": 9,
"SideWestOn": 10,
"SideSouthOn": 11,
"SideNorthOn": 12,
"TopNorthOn": 13,
"TopEastOn": 14
};
// And a metadata library makes further usable functions
// 2:
var block = mf.BlockAt(...);
if (block.isPowered()) { ... }
// Also to consider:
var powered = block.isPowered();
// powered is "undefined" if the type of block is not powerable, OR
// isPowered is "undefined" if the type of block is not powerable
// 3:
var block = mf.BlockAt(...);
if (mf.Metadata.isPowered(block1)) { ... }
// Also to consider:
var powered = mf.Metadata.isPowered(block2)
// powered is "undefined" if the type is not powerable, OR
// a block passed to isPowered is asserted to be of a 'powerable' type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment