forked from kkwik/BoxSplitGrammars-Update
/
MakeFloorplan.py
executable file
·70 lines (55 loc) · 1.92 KB
/
MakeFloorplan.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import time # for timing
from math import sqrt, tan, sin, cos, pi, ceil, floor, acos, atan, asin, degrees, radians, log, atan2, acos, asin
from random import *
from numpy import *
import json
from amulet.api.selection import SelectionGroup, SelectionBox
from amulet.api.block import Block
from GrammarBox import BoundingBox
from MCSplitGrammar import rule, split, reorient, void, fill, start_symbol, Dimension, Direction, Constraint, clearrules
inputs = (
("Random Greek Temple Generator", "label"),
("Creator: Markus Eger", "label")
)
COLUMNSIZE = 1
COLUMNHEIGHT = 8
clearrules(__file__)
MARBLE = 155
@rule
def columns():
with split(Dimension.Z,
[1,1,1,1,1,1,1]):
fill(), void(), fill()
void()
fill(), void(), fill()
@rule
def chamber():
with split(Dimension.Z, [1, -1, 1]):
fill(), void(), fill()
@rule
def naos():
with split(Dimension.X, [1, -1, 1]):
columns(), chamber(), fill()
@rule
def floorplan():
with split(Dimension.X,
[1, 1, -1, 1, 1]):
columns(),void(),
naos(),
void(),columns()
def performOperation(
world: "BaseLevel",
dimension,
selection_group: SelectionGroup,
options: dict
):
# Only operate on one selection box at a time. If there are multiple selection boxes in the selection group don't do anything
if len(selection_group.selection_boxes) == 1:
selection_box: SelectionBox = selection_group.selection_boxes[0]
bounding_box: BoundingBox = BoundingBox(selection_box.min, selection_box.shape) # Convert amulet Selection box into GrammarBox BoundingBox
sc = start_symbol(bounding_box, world, dimension)
floorplan()
export = {
"name": "Make Floorplan", # the name of the plugin
"operation": performOperation, # the actual function to call when running the plugin
}