Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.

Commit 1256b55

Browse files
committed
fix dumb config bugs
1 parent a0049af commit 1256b55

File tree

2 files changed

+158
-80
lines changed

2 files changed

+158
-80
lines changed

Config/sm64.vanilla.yml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ object_randomization:
499499
rules:
500500
- drop_to_floor # try to place this object on the floor
501501
- floor_types_allowed: restricted # select above defined group as floor types allowed
502+
- max_slope: 0.75
502503

503504
objects:
504505
# Bosses
@@ -647,9 +648,8 @@ object_randomization:
647648
objects:
648649
- name: Yellow Coin
649650
match:
650-
- behaviours:
651-
- 0x1300090C
652-
- 0x1300091C # For Triggers?
651+
- 0x1300090C
652+
- 0x1300091C # For Triggers?
653653
- name: Red Coin
654654
match: 0x13003EAC
655655
- name: Blue Coin
@@ -664,14 +664,15 @@ object_randomization:
664664
objects:
665665
- name: Star
666666
match:
667-
- behaviours:
668-
- 0x13003E3C
669-
- 0x13003EFC # Hidden
670-
- 0x13003E8C # Red Coin Star
667+
- 0x13003E3C
668+
- 0x13003EFC # Hidden
669+
- 0x13003E8C # Red Coin Star
670+
rules:
671+
- underwater: allowed
671672
- name: Star in Box
672673
match: 0x13002250
673674
rules:
674-
- underwater: never # Boxes underwater are not breakable
675+
- underwater: never # Boxes underwater are not breakable
675676
objects:
676677
- name: "Star #1"
677678
match:
@@ -746,7 +747,7 @@ object_randomization:
746747
rules:
747748
- underwater: allowed
748749
- spawn_height: [100, 900]
749-
- max_slope: 0.99
750+
- max_slope: 0.0
750751
objects:
751752
- name: "Mario Level Spawn"
752753
match:
@@ -810,6 +811,21 @@ object_randomization:
810811

811812
- name: "Level Special Cases"
812813
objects:
814+
- name: "DDD: Limit max height in second area"
815+
match:
816+
- course_id: 0x17
817+
- area_id: 0x02
818+
for:
819+
- "*"
820+
rules:
821+
- max_y: 1500
822+
#- name: "WF: Limit slopes"
823+
# match:
824+
# - course_id: 0x18
825+
# for:
826+
# - "*"
827+
# rules:
828+
# - max_slope: 0
813829
- name: "JRB: Limit max height in Ship"
814830
match:
815831
- course_id: 0x0C
@@ -820,11 +836,10 @@ object_randomization:
820836
- max_y: 1800
821837
- name: "THI: Red Coins / Red Coin Star below Boss Room"
822838
match:
839+
- 0x13003EAC # Red Coin
840+
- 0x13003E8C # Red Coin Star
823841
- course_id: 0x0D
824-
- area_id: 0x2
825-
- behaviours:
826-
- 0x13003EAC # Red Coin
827-
- 0x13003E8C # Red Coin Star
842+
- area_id: 0x03
828843
rules:
829844
- max_y: 1750
830845
- name: "WC: Coins within Reach of Platform"
@@ -833,11 +848,11 @@ object_randomization:
833848
- course_id: 0x1D
834849
rules:
835850
- no_floor_required
836-
- min_y: -2260
837-
- max_y: 4064
851+
- min_y: -2000
852+
- max_y: 3500
838853
- distance_to:
839854
- origin: [0, -2047, 0]
840-
max_distance: 5000
855+
max_distance: 3000
841856
for:
842857
- 'Coin'
843858
- 'Coin Formations'
@@ -847,6 +862,7 @@ object_randomization:
847862
rules:
848863
- distance_to:
849864
- origin: [0, 1900, 0]
865+
max_distance: 5000
850866
for:
851867
- 'Coin'
852868
- 'Coin Formations'
@@ -898,6 +914,6 @@ custom_paintings:
898914
transform:
899915
- type: split-horizontal
900916
- name: painting_pss
901-
file: "Assets/img/custom_paintings/mika/PSS.png"
902-
transform:
903-
- type: split-horizontal
917+
file: "Assets/img/custom_paintings/mika/PSS.png"
918+
transform:
919+
- type: split-horizontal

sm64r/Config.py

Lines changed: 123 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -549,68 +549,130 @@ def parse_object_table(self, table, rules = None, match = None, exclude = None):
549549
# Object matching for existing objects
550550
if "for" in table:
551551
for obj_name in table["for"]:
552-
if obj_name not in self.object_entries_by_name:
553-
raise ValueError(f"The object '{obj_name}' is not known. Please ensure it is not referenced before it's declared. This is a current limitation.")
552+
if obj_name == "*":
553+
all_object_entry_names = list(self.object_entries_by_name.keys())
554+
for target_obj_name in all_object_entry_names:
555+
target = self.object_entries_by_name[target_obj_name]
556+
new_entries = []
557+
target_match = target["match"] if "match" in target and target["match"] is not None else dict()
558+
target_exclude = target["exclude"] if "exclude" in target and target["exclude"] is not None else dict()
559+
target_rules = target["rules"] if "rules" in target and target["rules"] is not None else dict()
560+
561+
parent_match = (match or dict())
562+
parent_exclude = (exclude or dict())
563+
564+
# print(target["name"], len(list(target_match.keys())))
565+
# don't add nodes with no matching property, those are groups
566+
if len(list(target_match.keys())) > 0:
567+
# print(f"{name}: {target['name']}")
568+
# add the entry itself
569+
new_entries.append(dict(
570+
match={
571+
**target_match, # target, i.e. for-matches
572+
**parent_match, # parent
573+
},
574+
exclude={
575+
**target_exclude,
576+
**parent_exclude,
577+
},
578+
rules={
579+
**target_rules,
580+
**rules,
581+
},
582+
name=f"{name}: {target['name']}"
583+
))
584+
585+
# add the entries children
586+
if "children" in target:
587+
children = target["children"]
588+
for child in children:
589+
child_match = child["match"] if child and "match" in child and child["match"] is not None else dict()
590+
child_exclude = child["exclude"] if child and "exclude" in child and child["exclude"] is not None else dict()
591+
592+
# don't add children with no matching property, those are groups
593+
if len(list(child_match.keys())) > 0:
594+
new_entries.append(dict(
595+
match={
596+
**child_match,
597+
**parent_match
598+
},
599+
rules={
600+
**child["rules"],
601+
**rules,
602+
},
603+
exclude={
604+
**child_exclude,
605+
**parent_exclude
606+
},
607+
name=f"{name}: {child['name']}"
608+
))
609+
610+
for new_entry in new_entries:
611+
self.object_entries_by_name[new_entry["name"]] = new_entry
612+
self.object_entries.append(new_entry)
554613
else:
555-
target = self.object_entries_by_name[obj_name]
556-
new_entries = []
557-
target_match = target["match"] if "match" in target and target["match"] is not None else dict()
558-
target_exclude = target["exclude"] if "exclude" in target and target["exclude"] is not None else dict()
559-
target_rules = target["rules"] if "rules" in target and target["rules"] is not None else dict()
560-
561-
parent_match = (match or dict())
562-
parent_exclude = (exclude or dict())
563-
564-
# print(target["name"], len(list(target_match.keys())))
565-
# don't add nodes with no matching property, those are groups
566-
if len(list(target_match.keys())) > 0:
567-
# print(f"{name}: {target['name']}")
568-
# add the entry itself
569-
new_entries.append(dict(
570-
match={
571-
**target_match, # target, i.e. for-matches
572-
**parent_match, # parent
573-
},
574-
exclude={
575-
**target_exclude,
576-
**parent_exclude,
577-
},
578-
rules={
579-
**target_rules,
580-
**rules,
581-
},
582-
name=f"{name}: {target['name']}"
583-
))
584-
585-
# add the entries children
586-
if "children" in target:
587-
children = target["children"]
588-
for child in children:
589-
child_match = child["match"] if "match" in child and child["match"] is not None else dict
590-
child_exclude = child["exclude"] if "exclude" in child and child["exclude"] is not None else dict()
591-
592-
# print(child["name"], len(list(child_match.keys())))
593-
# don't add children with no matching property, those are groups
594-
if len(list(child_match.keys())) > 0:
595-
new_entries.append(dict(
596-
match={
597-
**child_match,
598-
**parent_match
599-
},
600-
rules={
601-
**child["rules"],
602-
**rules,
603-
},
604-
exclude={
605-
**child_exclude,
606-
**parent_exclude
607-
},
608-
name=f"{name}: {child['name']}"
609-
))
610-
611-
for new_entry in new_entries:
612-
self.object_entries_by_name[new_entry["name"]] = new_entry
613-
self.object_entries.append(new_entry)
614+
if obj_name not in self.object_entries_by_name:
615+
raise ValueError(f"The object '{obj_name}' is not known. Please ensure it is not referenced before it's declared. This is a current limitation.")
616+
else:
617+
target = self.object_entries_by_name[obj_name]
618+
new_entries = []
619+
target_match = target["match"] if "match" in target and target["match"] is not None else dict()
620+
target_exclude = target["exclude"] if "exclude" in target and target["exclude"] is not None else dict()
621+
target_rules = target["rules"] if "rules" in target and target["rules"] is not None else dict()
622+
623+
parent_match = (match or dict())
624+
parent_exclude = (exclude or dict())
625+
626+
# print(target["name"], len(list(target_match.keys())))
627+
# don't add nodes with no matching property, those are groups
628+
if len(list(target_match.keys())) > 0:
629+
# print(f"{name}: {target['name']}")
630+
# add the entry itself
631+
new_entries.append(dict(
632+
match={
633+
**target_match, # target, i.e. for-matches
634+
**parent_match, # parent
635+
},
636+
exclude={
637+
**target_exclude,
638+
**parent_exclude,
639+
},
640+
rules={
641+
**target_rules,
642+
**rules,
643+
},
644+
name=f"{name}: {target['name']}"
645+
))
646+
647+
# add the entries children
648+
if "children" in target:
649+
children = target["children"]
650+
for child in children:
651+
child_match = child["match"] if child and "match" in child and child["match"] is not None else dict()
652+
child_exclude = child["exclude"] if child and "exclude" in child and child["exclude"] is not None else dict()
653+
654+
# print(child["name"], len(list(child_match.keys())))
655+
# don't add children with no matching property, those are groups
656+
if len(list(child_match.keys())) > 0:
657+
new_entries.append(dict(
658+
match={
659+
**child_match,
660+
**parent_match
661+
},
662+
rules={
663+
**child["rules"],
664+
**rules,
665+
},
666+
exclude={
667+
**child_exclude,
668+
**parent_exclude
669+
},
670+
name=f"{name}: {child['name']}"
671+
))
672+
673+
for new_entry in new_entries:
674+
self.object_entries_by_name[new_entry["name"]] = new_entry
675+
self.object_entries.append(new_entry)
614676

615677
# Discard this entry, do not add to the list without the items it matched with "for"
616678
return

0 commit comments

Comments
 (0)