Created
April 30, 2011 22:17
-
-
Save hikari-no-yume/950039 to your computer and use it in GitHub Desktop.
This file contains 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
diff --git a/bravo/plugins/build_hooks.py b/bravo/plugins/build_hooks.py | |
index 98e2bff..a6bec20 100644 | |
--- a/bravo/plugins/build_hooks.py | |
+++ b/bravo/plugins/build_hooks.py | |
@@ -5,6 +5,7 @@ from bravo.blocks import blocks, items | |
from bravo.entity import Chest, Sign | |
from bravo.ibravo import IBuildHook | |
from bravo.utilities import split_coords | |
+from bravo.terrain import NormalTree | |
class Tile(object): | |
""" | |
@@ -166,7 +167,31 @@ class BuildSnow(object): | |
before = tuple() | |
after = ("build",) | |
+ | |
+class GrowSapling(object): | |
+ """ | |
+ Grows saplings when placed. | |
+ | |
+ You almost certainly want to enable this plugin. | |
+ """ | |
+ | |
+ implements(IBuildHook) | |
+ | |
+ @inlineCallbacks | |
+ def build_hook(self, factory, player, builddata): | |
+ block = yield factory.world.get_block((builddata.x, builddata.y, builddata.z)) | |
+ | |
+ if block == blocks["sapling"].slot: | |
+ NormalTree(pos=(builddata.x, builddata.y, builddata.z)) | |
+ | |
+ returnValue((True, builddata)) | |
+ | |
+ name = "grow_sapling" | |
+ | |
+ before = tuple() | |
+ after = ("build","build_snow") | |
tile = Tile() | |
build = Build() | |
build_snow = BuildSnow() | |
+grow_sapling = GrowSapling() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment