本文整理汇总了Python中bravo.world.World.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python World.destroy方法的具体用法?Python World.destroy怎么用?Python World.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bravo.world.World
的用法示例。
在下文中一共展示了World.destroy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestWater
# 需要导入模块: from bravo.world import World [as 别名]
# 或者: from bravo.world.World import destroy [as 别名]
#.........这里部分代码省略.........
def test_spring_fall(self):
"""
Falling water should appear below springs.
"""
self.w.set_block((0, 1, 0), blocks["spring"].slot)
self.hook.tracked.add((0, 1, 0))
# Tight-loop run the hook to equilibrium.
while self.hook.tracked:
self.hook.process()
block = yield self.w.get_block((0, 0, 0))
metadata = yield self.w.get_metadata((0, 0, 0))
self.assertEqual(block, blocks["water"].slot)
self.assertEqual(metadata, 0x8)
@inlineCallbacks
def test_spring_fall_dig(self):
"""
Destroying ground underneath spring should allow water to continue
falling downwards.
"""
self.w.set_block((0, 1, 0), blocks["spring"].slot)
self.w.set_block((0, 0, 0), blocks["dirt"].slot)
self.hook.tracked.add((0, 1, 0))
# Tight-loop run the hook to equilibrium.
while self.hook.tracked:
self.hook.process()
#dig away dirt under spring
self.w.destroy((0, 0, 0))
self.hook.tracked.add((0, 1, 0))
while self.hook.tracked:
self.hook.process()
block = yield self.w.get_block((0, 0, 0))
self.assertEqual(block, blocks["water"].slot)
def test_spring_fall_dig_offset(self):
"""
Destroying ground next to a spring should cause a waterfall effect.
"""
d = self.w.request_chunk(0, 0)
@d.addCallback
def cb(chunk):
chunk.set_block((1, 1, 0), blocks["spring"].slot)
chunk.set_block((1, 0, 0), blocks["dirt"].slot)
chunk.set_block((1, 0, 1), blocks["dirt"].slot)
self.hook.tracked.add((1, 1, 0))
# Tight-loop run the hook to equilibrium.
while self.hook.tracked:
self.hook.process()
# Dig away the dirt next to the dirt under the spring, and simulate
# the dig hook by adding the block above it.
chunk.destroy((1, 0, 1))
self.hook.tracked.add((1, 1, 1))