Skip to content

Commit

Permalink
Merge branch 'main' into lingo-imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholassaylor authored Nov 30, 2024
2 parents 8e80cd5 + b83b486 commit e3aaa4a
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 22 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ jobs:
- name: Install python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '~3.12.7'
check-latest: true
- name: Download run-time dependencies
run: |
Invoke-WebRequest -Uri https://github.com/Ijwu/Enemizer/releases/download/${Env:ENEMIZER_VERSION}/win-x64.zip -OutFile enemizer.zip
Expand Down Expand Up @@ -111,7 +112,8 @@ jobs:
- name: Get a recent python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '~3.12.7'
check-latest: true
- name: Install build-time dependencies
run: |
echo "PYTHON=python3.12" >> $GITHUB_ENV
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
- name: Get a recent python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '~3.12.7'
check-latest: true
- name: Install build-time dependencies
run: |
echo "PYTHON=python3.12" >> $GITHUB_ENV
Expand Down
11 changes: 9 additions & 2 deletions ModuleUpdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
import warnings


if sys.version_info < (3, 10, 11):
raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. 3.10.11+ is supported.")
if sys.platform in ("win32", "darwin") and sys.version_info < (3, 10, 11):
# Official micro version updates. This should match the number in docs/running from source.md.
raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. Official 3.10.15+ is supported.")
elif sys.platform in ("win32", "darwin") and sys.version_info < (3, 10, 15):
# There are known security issues, but no easy way to install fixed versions on Windows for testing.
warnings.warn(f"Python Version {sys.version_info} has security issues. Don't use in production.")
elif sys.version_info < (3, 10, 1):
# Other platforms may get security backports instead of micro updates, so the number is unreliable.
raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. 3.10.1+ is supported.")

# don't run update if environment is frozen/compiled or if not the parent process (skip in subprocess)
_skip_update = bool(getattr(sys, "frozen", False) or multiprocessing.parent_process())
Expand Down
4 changes: 3 additions & 1 deletion docs/running from source.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ use that version. These steps are for developers or platforms without compiled r
## General

What you'll need:
* [Python 3.10.15 or newer](https://www.python.org/downloads/), not the Windows Store version
* [Python 3.10.11 or newer](https://www.python.org/downloads/), not the Windows Store version
* On Windows, please consider only using the latest supported version in production environments since security
updates for older versions are not easily available.
* Python 3.12.x is currently the newest supported version
* pip: included in downloads from python.org, separate in many Linux distributions
* Matching C compiler
Expand Down
3 changes: 2 additions & 1 deletion worlds/blasphemous/Options.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from Options import Choice, Toggle, DefaultOnToggle, DeathLink, PerGameCommonOptions, OptionGroup
from Options import Choice, Toggle, DefaultOnToggle, DeathLink, PerGameCommonOptions, StartInventoryPool, OptionGroup
import random


Expand Down Expand Up @@ -213,6 +213,7 @@ class BlasphemousDeathLink(DeathLink):

@dataclass
class BlasphemousOptions(PerGameCommonOptions):
start_inventory_from_pool: StartInventoryPool
prie_dieu_warp: PrieDieuWarp
skip_cutscenes: SkipCutscenes
corpse_hints: CorpseHints
Expand Down
9 changes: 0 additions & 9 deletions worlds/blasphemous/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,6 @@ def create_items(self):
]

skipped_items = []
junk: int = 0

for item, count in self.options.start_inventory.value.items():
for _ in range(count):
skipped_items.append(item)
junk += 1

skipped_items.extend(unrandomized_dict.values())

Expand Down Expand Up @@ -194,9 +188,6 @@ def create_items(self):
for _ in range(count):
pool.append(self.create_item(item["name"]))

for _ in range(junk):
pool.append(self.create_item(self.get_filler_item_name()))

self.multiworld.itempool += pool

self.place_items_from_dict(unrandomized_dict)
Expand Down
8 changes: 8 additions & 0 deletions worlds/factorio/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ class AtomicRocketTrapCount(TrapCount):
display_name = "Atomic Rocket Traps"


class AtomicCliffRemoverTrapCount(TrapCount):
"""Trap items that when received trigger an atomic rocket explosion on a random cliff.
Warning: there is no warning. The launch is instantaneous."""
display_name = "Atomic Cliff Remover Traps"


class EvolutionTrapCount(TrapCount):
"""Trap items that when received increase the enemy evolution."""
display_name = "Evolution Traps"
Expand Down Expand Up @@ -467,6 +473,7 @@ class FactorioOptions(PerGameCommonOptions):
cluster_grenade_traps: ClusterGrenadeTrapCount
artillery_traps: ArtilleryTrapCount
atomic_rocket_traps: AtomicRocketTrapCount
atomic_cliff_remover_traps: AtomicCliffRemoverTrapCount
attack_traps: AttackTrapCount
evolution_traps: EvolutionTrapCount
evolution_trap_increase: EvolutionTrapIncrease
Expand Down Expand Up @@ -500,6 +507,7 @@ class FactorioOptions(PerGameCommonOptions):
ClusterGrenadeTrapCount,
ArtilleryTrapCount,
AtomicRocketTrapCount,
AtomicCliffRemoverTrapCount,
],
start_collapsed=True
),
Expand Down
5 changes: 4 additions & 1 deletion worlds/factorio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class FactorioItem(Item):
all_items["Cluster Grenade Trap"] = factorio_base_id - 5
all_items["Artillery Trap"] = factorio_base_id - 6
all_items["Atomic Rocket Trap"] = factorio_base_id - 7
all_items["Atomic Cliff Remover Trap"] = factorio_base_id - 8


class Factorio(World):
Expand Down Expand Up @@ -142,6 +143,7 @@ def create_regions(self):
self.options.grenade_traps + \
self.options.cluster_grenade_traps + \
self.options.atomic_rocket_traps + \
self.options.atomic_cliff_remover_traps + \
self.options.artillery_traps

location_pool = []
Expand Down Expand Up @@ -194,7 +196,8 @@ def sorter(loc: FactorioScienceLocation):
def create_items(self) -> None:
self.custom_technologies = self.set_custom_technologies()
self.set_custom_recipes()
traps = ("Evolution", "Attack", "Teleport", "Grenade", "Cluster Grenade", "Artillery", "Atomic Rocket")
traps = ("Evolution", "Attack", "Teleport", "Grenade", "Cluster Grenade", "Artillery", "Atomic Rocket",
"Atomic Cliff Remover")
for trap_name in traps:
self.multiworld.itempool.extend(self.create_item(f"{trap_name} Trap") for _ in
range(getattr(self.options,
Expand Down
21 changes: 16 additions & 5 deletions worlds/factorio/data/mod/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,23 @@ function random_offset_position(position, offset)
end

function fire_entity_at_players(entity_name, speed)
local entities = {}
for _, player in ipairs(game.forces["player"].players) do
current_character = player.character
if current_character ~= nil then
current_character.surface.create_entity{name=entity_name,
position=random_offset_position(current_character.position, 128),
target=current_character, speed=speed}
if player.character ~= nil then
table.insert(entities, player.character)
end
end
return fire_entity_at_entities(entity_name, entities, speed)
end

function fire_entity_at_entities(entity_name, entities, speed)
for _, current_entity in ipairs(entities) do
local target = current_entity
if target.health == nil then
target = target.position
end
current_entity.surface.create_entity{name=entity_name,
position=random_offset_position(current_entity.position, 128),
target=target, speed=speed}
end
end
7 changes: 7 additions & 0 deletions worlds/factorio/data/mod_template/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,13 @@ end,
["Atomic Rocket Trap"] = function ()
fire_entity_at_players("atomic-rocket", 0.1)
end,
["Atomic Cliff Remover Trap"] = function ()
local cliffs = game.surfaces["nauvis"].find_entities_filtered{type = "cliff"}

if #cliffs > 0 then
fire_entity_at_entities("atomic-rocket", {cliffs[math.random(#cliffs)]}, 0.1)
end
end,
}

commands.add_command("ap-get-technology", "Grant a technology, used by the Archipelago Client.", function(call)
Expand Down
1 change: 1 addition & 0 deletions worlds/hk/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class HKItemData(NamedTuple):
"VesselFragments": lookup_type_to_names["Vessel"],
"WhisperingRoots": lookup_type_to_names["Root"],
"WhiteFragments": {"Queen_Fragment", "King_Fragment", "Void_Heart"},
"DreamNails": {"Dream_Nail", "Dream_Gate", "Awoken_Dream_Nail"},
})
item_name_groups['Horizontal'] = item_name_groups['Cloak'] | item_name_groups['CDash']
item_name_groups['Vertical'] = item_name_groups['Claw'] | {'Monarch_Wings'}
Expand Down

0 comments on commit e3aaa4a

Please sign in to comment.