Subnautica: updates (#759)

* Subnautica: add more goals

* Subnautica: fix wrongly positioned Databox

* Subnautica: allow techs to remain vanilla

* Subnautica: make zipimport compatible

* Subnautica: force two Seaglide fragments into local sphere 1
This commit is contained in:
Fabian Dill
2022-07-15 17:41:53 +02:00
committed by GitHub
parent 8e15fe51b6
commit 73fb1b8074
9 changed files with 1059 additions and 715 deletions

View File

@@ -1,6 +1,5 @@
from ..generic.Rules import set_rule
from .Locations import location_table
import logging
from worlds.generic.Rules import set_rule
from .Locations import location_table, LocationDict
import math
@@ -197,32 +196,32 @@ def get_max_depth(state, player):
get_prawn_max_depth(state, player))
def can_access_location(state, player, loc):
pos_x = loc.get("position").get("x")
pos_y = loc.get("position").get("y")
pos_z = loc.get("position").get("z")
depth = -pos_y # y-up
map_center_dist = math.sqrt(pos_x ** 2 + pos_z ** 2)
aurora_dist = math.sqrt((pos_x - 1038.0) ** 2 + (pos_y - -3.4) ** 2 + (pos_z - -163.1) ** 2)
need_radiation_suit = aurora_dist < 950
def can_access_location(state, player: int, loc: LocationDict):
need_laser_cutter = loc.get("need_laser_cutter", False)
need_propulsion_cannon = loc.get("need_propulsion_cannon", False)
if need_laser_cutter and not has_laser_cutter(state, player):
return False
if need_radiation_suit and not state.has("Radiation Suit", player):
need_propulsion_cannon = loc.get("need_propulsion_cannon", False)
if need_propulsion_cannon and not has_propulsion_cannon(state, player):
return False
if need_propulsion_cannon and not has_propulsion_cannon(state, player):
pos = loc["position"]
pos_x = pos["x"]
pos_y = pos["y"]
pos_z = pos["z"]
aurora_dist = math.sqrt((pos_x - 1038.0) ** 2 + (pos_y - -3.4) ** 2 + (pos_z - -163.1) ** 2)
need_radiation_suit = aurora_dist < 950
if need_radiation_suit and not state.has("Radiation Suit", player):
return False
# Seaglide doesn't unlock anything specific, but just allows for faster movement.
# Otherwise the game is painfully slow.
map_center_dist = math.sqrt(pos_x ** 2 + pos_z ** 2)
if (map_center_dist > 800 or pos_y < -200) and not has_seaglide(state, player):
return False
depth = -pos_y # y-up
return get_max_depth(state, player) >= depth
@@ -230,21 +229,33 @@ def set_location_rule(world, player, loc):
set_rule(world.get_location(loc["name"], player), lambda state: can_access_location(state, player, loc))
def set_rules(world, player):
for loc in location_table:
def set_rules(subnautica_world):
player = subnautica_world.player
world = subnautica_world.world
for loc in location_table.values():
set_location_rule(world, player, loc)
# Victory location
set_rule(world.get_location("Neptune Launch", player), lambda state: \
get_max_depth(state, player) >= 1444 and \
has_mobile_vehicle_bay(state, player) and \
state.has('Neptune Launch Platform', player) and \
state.has('Neptune Gantry', player) and \
state.has('Neptune Boosters', player) and \
state.has('Neptune Fuel Reserve', player) and \
state.has('Neptune Cockpit', player) and \
state.has('Ion Power Cell', player) and \
state.has('Ion Battery', player) and \
# Victory locations
set_rule(world.get_location("Neptune Launch", player), lambda state:
get_max_depth(state, player) >= 1444 and
has_mobile_vehicle_bay(state, player) and
state.has("Neptune Launch Platform", player) and
state.has("Neptune Gantry", player) and
state.has("Neptune Boosters", player) and
state.has("Neptune Fuel Reserve", player) and
state.has("Neptune Cockpit", player) and
state.has("Ion Power Cell", player) and
state.has("Ion Battery", player) and
has_cyclops_shield(state, player))
world.completion_condition[player] = lambda state: state.has('Victory', player)
set_rule(world.get_location("Disable Quarantine", player), lambda state:
get_max_depth(state, player) >= 1444)
set_rule(world.get_location("Full Infection", player), lambda state:
get_max_depth(state, player) >= 900)
room = world.get_location("Aurora Drive Room - Upgrade Console", player)
set_rule(world.get_location("Repair Aurora Drive", player), lambda state: room.can_reach(state))
world.completion_condition[player] = lambda state: state.has("Victory", player)