Subnautica: fix exported radiation logic (#1507)
This commit is contained in:
parent
414166f6a2
commit
5b64c5f934
|
@ -580,9 +580,14 @@ if False: # turn to True to export for Subnautica mod
|
|||
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)
|
||||
# copy-paste from Rules
|
||||
def is_radiated(x: float, y: float, z: float) -> bool:
|
||||
aurora_dist = math.sqrt((x - 1038.0) ** 2 + y ** 2 + (z - -163.1) ** 2)
|
||||
return aurora_dist < 950
|
||||
# end of copy-paste
|
||||
|
||||
def radiated(pos: Vector):
|
||||
return is_radiated(pos["x"], pos["y"], pos["z"])
|
||||
|
||||
def far_away(pos: Vector):
|
||||
return (pos["x"] ** 2 + pos["z"] ** 2) > (800 ** 2)
|
||||
|
|
|
@ -221,6 +221,11 @@ def get_max_depth(state: "CollectionState", player: int):
|
|||
)
|
||||
|
||||
|
||||
def is_radiated(x: float, y: float, z: float) -> bool:
|
||||
aurora_dist = math.sqrt((x - 1038.0) ** 2 + y ** 2 + (z - -163.1) ** 2)
|
||||
return aurora_dist < 950
|
||||
|
||||
|
||||
def can_access_location(state: "CollectionState", player: int, loc: LocationDict) -> bool:
|
||||
need_laser_cutter = loc.get("need_laser_cutter", False)
|
||||
if need_laser_cutter and not has_laser_cutter(state, player):
|
||||
|
@ -235,8 +240,7 @@ def can_access_location(state: "CollectionState", player: int, loc: LocationDict
|
|||
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
|
||||
need_radiation_suit = is_radiated(pos_x, pos_y, pos_z)
|
||||
if need_radiation_suit and not state.has("Radiation Suit", player):
|
||||
return False
|
||||
|
||||
|
|
Loading…
Reference in New Issue