From 73d11b69770e5ca322ccbb69834a18ebdfbfec8d Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 6 Jan 2024 12:04:13 -0500 Subject: Mod side of randomizing green colorful --- randomizer/generator.gd | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'randomizer') 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): var painting_scene = load(scene_path) var new_painting = painting_scene.instance() new_painting.set_name("%s_new" % mapping[0]) - + var old_painting = scene.get_node("Decorations/Paintings").get_node(mapping[0]) new_painting.translation = old_painting.translation new_painting.rotation = old_painting.rotation scene.get_node("Decorations/Paintings").add_child(new_painting) old_painting.queue_free() + + # Randomize THE COLORFUL - WALLS + var gridmap = scene.get_node("GridMap") + var mesh_library = gridmap.mesh_library + var mapvec1 = gridmap.world_to_map(gridmap.to_local(Vector3(-14.5, 0, -95.5))) + var mapvec2 = gridmap.world_to_map(gridmap.to_local(Vector3(-9.5, 6.5, -84.5))) + var mapvec_ex = gridmap.world_to_map(gridmap.to_local(Vector3(-10.5, 0.5, -86.5))) + + var walls_puzzle = _pickRandom(_generated_puzzles.walls_puzzles) + var mesh_item = mesh_library.find_item_by_name(walls_puzzle[1]) + + for x in range(mapvec1.x, mapvec2.x + 1): + for y in range(mapvec1.y, mapvec2.y + 1): + for z in range(mapvec1.z, mapvec2.z + 1): + if gridmap.get_cell_item(x,y,z) != GridMap.INVALID_CELL_ITEM: + gridmap.set_cell_item(x, y, z, mesh_item) + + gridmap.set_cell_item(mapvec_ex.x, mapvec_ex.y, mapvec_ex.z, mesh_library.find_item_by_name("MeshInstance2")) + 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)) + + var walls_puzzle_node = panels_parent.get_node("Doorways Room/Panel_path_i") + walls_puzzle_node.answer = walls_puzzle[0] func _pickRandom(set): -- cgit 1.4.1