diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-12-12 19:28:58 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-12-12 19:28:58 -0500 |
commit | 2edb8d4b8b451eef0ad3329e808a0bf31cbf61d6 (patch) | |
tree | ded22baf8c59a0ffca8b5cffdc5a3bb7db6d52e7 /randomizer/generator.gd | |
parent | c4e836d207299354b3e182e179e4ca121ac2b7dd (diff) | |
download | lingo-randomizer-2edb8d4b8b451eef0ad3329e808a0bf31cbf61d6.tar.gz lingo-randomizer-2edb8d4b8b451eef0ad3329e808a0bf31cbf61d6.tar.bz2 lingo-randomizer-2edb8d4b8b451eef0ad3329e808a0bf31cbf61d6.zip |
Added painting puzzles
Diffstat (limited to 'randomizer/generator.gd')
-rw-r--r-- | randomizer/generator.gd | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/randomizer/generator.gd b/randomizer/generator.gd index fb0c6b0..090ec8a 100644 --- a/randomizer/generator.gd +++ b/randomizer/generator.gd | |||
@@ -1,6 +1,7 @@ | |||
1 | extends Node | 1 | extends Node |
2 | 2 | ||
3 | var panel_mapping = [] | 3 | var panel_mapping = [] |
4 | var painting_mapping = [] | ||
4 | var gen_seed | 5 | var gen_seed |
5 | var is_set_seed = false | 6 | var is_set_seed = false |
6 | 7 | ||
@@ -14,6 +15,7 @@ var _flags = 0 | |||
14 | var _total_generated = 0 | 15 | var _total_generated = 0 |
15 | var _hint_by_path = {} | 16 | var _hint_by_path = {} |
16 | var _answer_by_path = {} | 17 | var _answer_by_path = {} |
18 | var _painting_puzzles = [] | ||
17 | 19 | ||
18 | var _unique_pool = "" | 20 | var _unique_pool = "" |
19 | var _answers_by_unique_pool = {} | 21 | var _answers_by_unique_pool = {} |
@@ -95,6 +97,7 @@ func generate(chosen_seed): | |||
95 | _puzzle_by_id = [] | 97 | _puzzle_by_id = [] |
96 | _hint_by_path = {} | 98 | _hint_by_path = {} |
97 | _answer_by_path = {} | 99 | _answer_by_path = {} |
100 | _painting_puzzles = _generated_puzzles.paintings | ||
98 | var openable_answers = [] | 101 | var openable_answers = [] |
99 | 102 | ||
100 | for puzzle_type in kPuzzleTypes: | 103 | for puzzle_type in kPuzzleTypes: |
@@ -628,6 +631,12 @@ func generate(chosen_seed): | |||
628 | _gOrangeAddition("Tower Room/Panel_reads_rust_lawns_6") | 631 | _gOrangeAddition("Tower Room/Panel_reads_rust_lawns_6") |
629 | _gOrangeAddition("Tower Room/Panel_waded_wee_warts_7") | 632 | _gOrangeAddition("Tower Room/Panel_waded_wee_warts_7") |
630 | 633 | ||
634 | _gPaintingPuzzle("Panel Room/Panel_painting_flower", "flower_painting_gray") | ||
635 | _gPaintingPuzzle("Panel Room/Panel_painting_eye", "eye_painting_gray") | ||
636 | _gPaintingPuzzle("Panel Room/Panel_painting_snowman", "snowman_painting_gray") | ||
637 | _gPaintingPuzzle("Panel Room/Panel_painting_owl", "owl_painting_gray") | ||
638 | _gPaintingPuzzle("Panel Room/Panel_painting_panda", "panda_painting_gray") | ||
639 | |||
631 | _setFlag(kObscureHint) | 640 | _setFlag(kObscureHint) |
632 | _gSingle("Entry Room/Panel_forward_forward", kWhiteMiddle) | 641 | _gSingle("Entry Room/Panel_forward_forward", kWhiteMiddle) |
633 | _gSingle("Entry Room/Panel_between_between", kWhiteMiddle) | 642 | _gSingle("Entry Room/Panel_between_between", kWhiteMiddle) |
@@ -722,6 +731,19 @@ func apply(scene): | |||
722 | var panel = panels_parent.get_node(puzzle[0]) | 731 | var panel = panels_parent.get_node(puzzle[0]) |
723 | panel.text = puzzle[1] | 732 | panel.text = puzzle[1] |
724 | panel.answer = puzzle[2] | 733 | panel.answer = puzzle[2] |
734 | |||
735 | for mapping in painting_mapping: | ||
736 | var scene_path = "res://nodes/paintings/%s.tscn" % mapping[1] | ||
737 | var painting_scene = load(scene_path) | ||
738 | var new_painting = painting_scene.instance() | ||
739 | new_painting.set_name("%s_new" % mapping[0]) | ||
740 | |||
741 | var old_painting = scene.get_node("Decorations/Paintings").get_node(mapping[0]) | ||
742 | new_painting.translation = old_painting.translation | ||
743 | new_painting.rotation = old_painting.rotation | ||
744 | |||
745 | scene.get_node("Decorations/Paintings").add_child(new_painting) | ||
746 | old_painting.queue_free() | ||
725 | 747 | ||
726 | 748 | ||
727 | func _pickRandom(set): | 749 | func _pickRandom(set): |
@@ -911,6 +933,13 @@ func _gOrangeAddition(panel_path): | |||
911 | _writePanel(panel_path, "%s + %s" % [word1, word2], solution) | 933 | _writePanel(panel_path, "%s + %s" % [word1, word2], solution) |
912 | 934 | ||
913 | 935 | ||
936 | func _gPaintingPuzzle(panel_path, painting_name): | ||
937 | var chosen = _pickRandom(_painting_puzzles) | ||
938 | _painting_puzzles.erase(chosen) | ||
939 | _writePanel(panel_path, "painting", chosen[1]) | ||
940 | painting_mapping.append([painting_name, chosen[0]]) | ||
941 | |||
942 | |||
914 | func _applyCipher(text): | 943 | func _applyCipher(text): |
915 | var result = text | 944 | var result = text |
916 | for i in range(result.length()): | 945 | for i in range(result.length()): |