Subnautica: add logic dumper for mod (#1386)
* Subnautica: add logic dumper for mod * Subnautica: export more data * Subnautica: fix some Cyclops logic
This commit is contained in:
		
							parent
							
								
									ad4846cedd
								
							
						
					
					
						commit
						a85ca9cc87
					
				| 
						 | 
				
			
			@ -571,9 +571,35 @@ location_table: Dict[int, LocationDict] = {
 | 
			
		|||
            'need_laser_cutter': False,
 | 
			
		||||
            'position': {'x': 83.2, 'y': -276.4, 'z': -345.5}},
 | 
			
		||||
}
 | 
			
		||||
if False:  # turn to True to export for Subnautica mod
 | 
			
		||||
    payload = {location_id: location_data["position"] for location_id, location_data in location_table.items()}
 | 
			
		||||
    import json
 | 
			
		||||
 | 
			
		||||
if False:  # turn to True to export for Subnautica mod
 | 
			
		||||
    import json
 | 
			
		||||
    import math
 | 
			
		||||
 | 
			
		||||
    payload = {location_id: location_data["position"] for location_id, location_data in location_table.items()}
 | 
			
		||||
    with open("locations.json", "w") as f:
 | 
			
		||||
        json.dump(payload, f)
 | 
			
		||||
 | 
			
		||||
    def radiated(pos: Vector):
 | 
			
		||||
        aurora_dist = math.sqrt((pos["x"] - 1038.0) ** 2 + (pos["y"] - -3.4) ** 2 + (pos["y"] - -163.1) ** 2)
 | 
			
		||||
        return aurora_dist < 950
 | 
			
		||||
 | 
			
		||||
    def far_away(pos: Vector):
 | 
			
		||||
        return (pos["x"] ** 2 + pos["z"] ** 2) > (800 ** 2)
 | 
			
		||||
 | 
			
		||||
    payload = {
 | 
			
		||||
        # "LaserCutter" in Subnautica ID
 | 
			
		||||
        "761": [location_id for location_id, location_data
 | 
			
		||||
                in location_table.items() if location_data["need_laser_cutter"]],
 | 
			
		||||
        # PropulsionCannon in Subnautica ID
 | 
			
		||||
        "757": [location_id for location_id, location_data
 | 
			
		||||
                in location_table.items() if location_data.get("need_propulsion_cannon", False)],
 | 
			
		||||
        # Radiation Suit in Subnautica ID
 | 
			
		||||
        "519": [location_id for location_id, location_data
 | 
			
		||||
                in location_table.items() if radiated(location_data["position"])],
 | 
			
		||||
        # SeaGlide in Subnautica ID
 | 
			
		||||
        "751": [location_id for location_id, location_data
 | 
			
		||||
                in location_table.items() if far_away(location_data["position"])],
 | 
			
		||||
    }
 | 
			
		||||
    with open("logic.json", "w") as f:
 | 
			
		||||
        json.dump(payload, f)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,8 +71,8 @@ def has_cyclops(state: "CollectionState", player: int) -> bool:
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def has_cyclops_depth_module_mk1(state: "CollectionState", player: int) -> bool:
 | 
			
		||||
    return state.has("Cyclops Depth Module MK1", player) and \
 | 
			
		||||
           has_modification_station(state, player)
 | 
			
		||||
    # Crafted in the Cyclops, so we don't need to check for crafting station
 | 
			
		||||
    return state.has("Cyclops Depth Module MK1", player)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def has_cyclops_depth_module_mk2(state: "CollectionState", player: int) -> bool:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ class SubnauticaWorld(World):
 | 
			
		|||
    an unknown bacteria. The planet's automatic quarantine will shoot you down if you try to leave.
 | 
			
		||||
    You must find a cure for yourself, build an escape rocket, and leave the planet.
 | 
			
		||||
    """
 | 
			
		||||
    game: str = "Subnautica"
 | 
			
		||||
    game = "Subnautica"
 | 
			
		||||
    web = SubnaticaWeb()
 | 
			
		||||
 | 
			
		||||
    item_name_to_id = {data["name"]: item_id for item_id, data in Items.item_table.items()}
 | 
			
		||||
| 
						 | 
				
			
			@ -112,6 +112,7 @@ class SubnauticaWorld(World):
 | 
			
		|||
    def fill_slot_data(self) -> Dict[str, Any]:
 | 
			
		||||
        goal: Options.Goal = self.multiworld.goal[self.player]
 | 
			
		||||
        item_pool: Options.ItemPool = self.multiworld.item_pool[self.player]
 | 
			
		||||
        swim_rule: Options.SwimRule = self.multiworld.swim_rule[self.player]
 | 
			
		||||
        vanilla_tech: List[str] = []
 | 
			
		||||
        if item_pool == Options.ItemPool.option_valuable:
 | 
			
		||||
            for item in Items.item_table.values():
 | 
			
		||||
| 
						 | 
				
			
			@ -120,6 +121,7 @@ class SubnauticaWorld(World):
 | 
			
		|||
 | 
			
		||||
        slot_data: Dict[str, Any] = {
 | 
			
		||||
            "goal": goal.current_key,
 | 
			
		||||
            "swim_rule": swim_rule.current_key,
 | 
			
		||||
            "vanilla_tech": vanilla_tech,
 | 
			
		||||
            "creatures_to_scan": self.creatures_to_scan,
 | 
			
		||||
            "death_link": self.multiworld.death_link[self.player].value,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue