diff options
Diffstat (limited to 'randomizer/generator.gd')
-rw-r--r-- | randomizer/generator.gd | 74 |
1 files changed, 73 insertions, 1 deletions
diff --git a/randomizer/generator.gd b/randomizer/generator.gd index 6c1883b..8502f6e 100644 --- a/randomizer/generator.gd +++ b/randomizer/generator.gd | |||
@@ -2,6 +2,7 @@ extends Node | |||
2 | 2 | ||
3 | var panel_mapping = [] | 3 | var panel_mapping = [] |
4 | var painting_mapping = [] | 4 | var painting_mapping = [] |
5 | var steady_mapping = [] | ||
5 | var gen_seed | 6 | var gen_seed |
6 | var is_set_seed = false | 7 | var is_set_seed = false |
7 | 8 | ||
@@ -43,6 +44,7 @@ const kBlueMiddle = 12 | |||
43 | const kBlueBottom = 13 | 44 | const kBlueBottom = 13 |
44 | const kPurpleTop = 14 | 45 | const kPurpleTop = 14 |
45 | const kPurpleMiddle = 15 | 46 | const kPurpleMiddle = 15 |
47 | const kColorIs = 16 | ||
46 | 48 | ||
47 | const kPuzzleTypes = [ | 49 | const kPuzzleTypes = [ |
48 | kWhiteMiddle, | 50 | kWhiteMiddle, |
@@ -61,7 +63,8 @@ const kPuzzleTypes = [ | |||
61 | kBlueMiddle, | 63 | kBlueMiddle, |
62 | kBlueBottom, | 64 | kBlueBottom, |
63 | kPurpleTop, | 65 | kPurpleTop, |
64 | kPurpleMiddle | 66 | kPurpleMiddle, |
67 | kColorIs | ||
65 | ] | 68 | ] |
66 | 69 | ||
67 | const kMustReuseAnswer = 1 | 70 | const kMustReuseAnswer = 1 |
@@ -523,6 +526,24 @@ func generate(chosen_seed): | |||
523 | _gStack2("Hangry Room/Panel_red_mid_4", kRedMiddle, "Hangry Room/Panel_red_bot_4", kRedBottom) | 526 | _gStack2("Hangry Room/Panel_red_mid_4", kRedMiddle, "Hangry Room/Panel_red_bot_4", kRedBottom) |
524 | _gStack2("Hangry Room/Panel_red_mid_5", kRedMiddle, "Hangry Room/Panel_red_bot_5", kRedBottom) | 527 | _gStack2("Hangry Room/Panel_red_mid_5", kRedMiddle, "Hangry Room/Panel_red_bot_5", kRedBottom) |
525 | 528 | ||
529 | _setUniquePool("steady") | ||
530 | _gSteady("Rock Room/Panel_limelight_lime", kRedMiddle) | ||
531 | _gSteady("Rock Room/Panel_blue_blueberry", kBlueMiddle) | ||
532 | _gSteady("Rock Room/Panel_lump_plum", kYellowMiddle) | ||
533 | _gSteady("Rock Room/Panel_hairy_cherry", kBlueTop) | ||
534 | _gSteady("Rock Room/Panel_blue_orange", kBlackBottom) | ||
535 | _gSteady("Rock Room/Panel_melon_lemon", kYellowMiddle) | ||
536 | _gSteady("Rock Room/Panel_herald_emerald", kPurpleMiddle) | ||
537 | _gSteady("Rock Room/Panel_sap_sapphire", kBlueMiddle) | ||
538 | _gSteady("Rock Room/Panel_thistle_amethyst", kPurpleTop) | ||
539 | _gSteady("Rock Room/Panel_bury_ruby", kYellowMiddle) | ||
540 | _gSteady("Rock Room/Panel_antechamber_amber", kRedMiddle) | ||
541 | _gSteady("Rock Room/Panel_top_topaz", kBlueMiddle) | ||
542 | _gSteady("Rock Room/Panel_lielack_lilac", kWhiteTop) | ||
543 | _gSteady("Rock Room/Panel_soar_rose", kBlackTop) | ||
544 | _gSteady("Rock Room/Panel_incarnation_carnation", kRedMiddle) | ||
545 | _gSteady("Rock Room/Panel_sun_sunflower", kBlueMiddle) | ||
546 | |||
526 | _clearUniquePool() | 547 | _clearUniquePool() |
527 | _gSingle("Entry Room/Panel_hidden_hidden", kWhiteMiddle) | 548 | _gSingle("Entry Room/Panel_hidden_hidden", kWhiteMiddle) |
528 | 549 | ||
@@ -841,6 +862,19 @@ func apply(scene): | |||
841 | var walls_puzzle_node = panels_parent.get_node("Doorways Room/Panel_path_i") | 862 | var walls_puzzle_node = panels_parent.get_node("Doorways Room/Panel_path_i") |
842 | walls_puzzle_node.answer = walls_puzzle[0] | 863 | walls_puzzle_node.answer = walls_puzzle[0] |
843 | 864 | ||
865 | # Randomize ceilings of The Steady | ||
866 | var ceilings = [ | ||
867 | [71.5, 98.5], [64.5, 98.5], [57.5, 98.5], [50.5, 98.5], [43.5, 98.5], [36.5, 98.5], | ||
868 | [71.5, 91.5], [64.5, 91.5], [57.5, 91.5], [50.5, 91.5], [43.5, 91.5], [36.5, 91.5], | ||
869 | [57.5, 84.5], [50.5, 84.5], [43.5, 84.5], [36.5, 84.5] | ||
870 | ] | ||
871 | for i in range(0, 16): | ||
872 | var color_mesh = mesh_library.find_item_by_name(steady_mapping[i]) | ||
873 | var ceilingvec1 = gridmap.world_to_map(gridmap.to_local(Vector3(ceilings[i][0], 5.5, ceilings[i][1]))) | ||
874 | for x in range(ceilingvec1.x - 4, ceilingvec1.x + 1): | ||
875 | for z in range(ceilingvec1.z - 4, ceilingvec1.z + 1): | ||
876 | gridmap.set_cell_item(x, ceilingvec1.y, z, color_mesh) | ||
877 | |||
844 | 878 | ||
845 | func _pickRandom(set): | 879 | func _pickRandom(set): |
846 | if set.size() == 0: | 880 | if set.size() == 0: |
@@ -1120,6 +1154,44 @@ func _gCombo(panel_path, left_type, right_type): | |||
1120 | _writePanel(panel_path, hint_text, _answer_by_id[chosen[2]]) | 1154 | _writePanel(panel_path, hint_text, _answer_by_id[chosen[2]]) |
1121 | 1155 | ||
1122 | 1156 | ||
1157 | func _gSteady(panel_path, puzzle_type): | ||
1158 | _cur_panel = panel_path | ||
1159 | var pre_choices = _filterBestPuzzles(_answers_by_type[kColorIs]) | ||
1160 | var puzzle_choices = [] | ||
1161 | for word_id in pre_choices: | ||
1162 | if _puzzle_by_id[word_id][1].has(puzzle_type): | ||
1163 | puzzle_choices.append(word_id) | ||
1164 | if puzzle_choices.empty(): | ||
1165 | print("No possible puzzles for panel %s" % panel_path) | ||
1166 | else: | ||
1167 | var answer_id = _pickRandom(puzzle_choices) | ||
1168 | var hint_choices = _puzzle_by_id[answer_id][1][puzzle_type] | ||
1169 | var hint_id = _pickRandom(hint_choices) | ||
1170 | var color_choices = _puzzle_by_id[answer_id][1][kColorIs] | ||
1171 | var color_id = _pickRandom(color_choices) | ||
1172 | var color_word = _answer_by_id[color_id] | ||
1173 | _setPanel(panel_path, hint_id, answer_id) | ||
1174 | |||
1175 | if color_word == "red": | ||
1176 | steady_mapping.append("MeshInstance7") | ||
1177 | elif color_word == "blue": | ||
1178 | steady_mapping.append("MeshInstance4") | ||
1179 | elif color_word == "green": | ||
1180 | steady_mapping.append("MeshInstance2") | ||
1181 | elif color_word == "black": | ||
1182 | steady_mapping.append("MeshInstance6") | ||
1183 | elif color_word == "white": | ||
1184 | steady_mapping.append("MeshInstance5") | ||
1185 | elif color_word == "brown": | ||
1186 | steady_mapping.append("MeshInstance3") | ||
1187 | elif color_word == "orange": | ||
1188 | steady_mapping.append("MeshInstance10") | ||
1189 | elif color_word == "yellow": | ||
1190 | steady_mapping.append("MeshInstance9") | ||
1191 | elif color_word == "purple": | ||
1192 | steady_mapping.append("MeshInstance8") | ||
1193 | |||
1194 | |||
1123 | func _applyCipher(text): | 1195 | func _applyCipher(text): |
1124 | var result = text | 1196 | var result = text |
1125 | for i in range(result.length()): | 1197 | for i in range(result.length()): |