Created
May 8, 2012 03:02
-
-
Save ironchefpython/2632233 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var factions = {} | |
var Faction = manager.registerPrototype({ | |
"properties": { | |
"name": manager.StringType, | |
"description": manager.StringType(function() {return this =! "" && this.length <=25;}), | |
"members": manager.CollectionType(manager.getPrototype("player")) | |
} | |
"listeners" { | |
"load": function(event) { | |
factions[this.name] = this; | |
}, | |
"init": function(event) { | |
newFaction = game.createEntity(Faction, { | |
name: "TheForgotten", | |
description: "The forgotten people of middle earth.", | |
members: [game.getPlayer("tim")] | |
}); | |
var otherFaction = factions["Blah"]; | |
newFaction.name = "Foo" ; | |
game.deleteEntity(newFaction); | |
}, | |
"console": function(event) { | |
if (event.command.indexOf("list") === 0) { | |
console.log("listing factions"); | |
} else if (event.command.indexOf("add") === 0) { | |
console.log("adding faction"); | |
<code to parse command and make a new faction> | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment