summary refs log tree commit diff stats
path: root/randomizer
diff options
context:
space:
mode:
Diffstat (limited to 'randomizer')
-rw-r--r--randomizer/generator.gd24
1 files changed, 23 insertions, 1 deletions
diff --git a/randomizer/generator.gd b/randomizer/generator.gd index fca9aa9..bc2ebb0 100644 --- a/randomizer/generator.gd +++ b/randomizer/generator.gd
@@ -797,13 +797,35 @@ func apply(scene):
797 var painting_scene = load(scene_path) 797 var painting_scene = load(scene_path)
798 var new_painting = painting_scene.instance() 798 var new_painting = painting_scene.instance()
799 new_painting.set_name("%s_new" % mapping[0]) 799 new_painting.set_name("%s_new" % mapping[0])
800 800
801 var old_painting = scene.get_node("Decorations/Paintings").get_node(mapping[0]) 801 var old_painting = scene.get_node("Decorations/Paintings").get_node(mapping[0])
802 new_painting.translation = old_painting.translation 802 new_painting.translation = old_painting.translation
803 new_painting.rotation = old_painting.rotation 803 new_painting.rotation = old_painting.rotation
804 804
805 scene.get_node("Decorations/Paintings").add_child(new_painting) 805 scene.get_node("Decorations/Paintings").add_child(new_painting)
806 old_painting.queue_free() 806 old_painting.queue_free()
807
808 # Randomize THE COLORFUL - WALLS
809 var gridmap = scene.get_node("GridMap")
810 var mesh_library = gridmap.mesh_library
811 var mapvec1 = gridmap.world_to_map(gridmap.to_local(Vector3(-14.5, 0, -95.5)))
812 var mapvec2 = gridmap.world_to_map(gridmap.to_local(Vector3(-9.5, 6.5, -84.5)))
813 var mapvec_ex = gridmap.world_to_map(gridmap.to_local(Vector3(-10.5, 0.5, -86.5)))
814
815 var walls_puzzle = _pickRandom(_generated_puzzles.walls_puzzles)
816 var mesh_item = mesh_library.find_item_by_name(walls_puzzle[1])
817
818 for x in range(mapvec1.x, mapvec2.x + 1):
819 for y in range(mapvec1.y, mapvec2.y + 1):
820 for z in range(mapvec1.z, mapvec2.z + 1):
821 if gridmap.get_cell_item(x,y,z) != GridMap.INVALID_CELL_ITEM:
822 gridmap.set_cell_item(x, y, z, mesh_item)
823
824 gridmap.set_cell_item(mapvec_ex.x, mapvec_ex.y, mapvec_ex.z, mesh_library.find_item_by_name("MeshInstance2"))
825 scene.get_node("Doors/Doorway Room Doors/Door_green/Hinge/MeshInstance").set_surface_material(0, mesh_library.get_item_mesh(mesh_item).surface_get_material(0))
826
827 var walls_puzzle_node = panels_parent.get_node("Doorways Room/Panel_path_i")
828 walls_puzzle_node.answer = walls_puzzle[0]
807 829
808 830
809func _pickRandom(set): 831func _pickRandom(set):