implement Factorio options max_science_pack and tech_cost

also give warnings about deprecated LttP options
also fix FactorioClient.py getting stuck if send an unknown item id
also fix !missing having an extra newline after each entry
also default to no webui
This commit is contained in:
Fabian Dill
2021-04-03 14:47:49 +02:00
parent d225eb9ca8
commit 91bcd59940
13 changed files with 177 additions and 42 deletions

View File

@@ -241,7 +241,7 @@ def place_bosses(world, player: int):
if shuffle_mode == "none":
return # vanilla bosses come pre-placed
if shuffle_mode in ["basic", "normal"]:
if shuffle_mode in ["basic", "full"]:
if world.boss_shuffle[player] == "basic": # vanilla bosses shuffled
bosses = placeable_bosses + ['Armos Knights', 'Lanmolas', 'Moldorm']
else: # all bosses present, the three duplicates chosen at random

View File

@@ -1651,7 +1651,7 @@ def write_custom_shops(rom, world, player):
if item is None:
break
if not item['item'] in item_table: # item not native to ALTTP
item_code = 0x21
item_code = 0x09 # Hammer
else:
item_code = ItemFactory(item['item'], player).code
if item['item'] == 'Single Arrow' and item['player'] == 0 and world.retro[player]:

View File

@@ -35,11 +35,19 @@ def generate_mod(world: MultiWorld, player: int):
player_names = {x: world.player_names[x][0] for x in world.player_ids}
locations = []
for location in world.get_filled_locations(player):
if not location.name.startswith("recipe-"): # introduce this a new location property?
if not location.name.startswith("recipe-"): # introduce this as a new location property?
locations.append((location.name, location.item.name, location.item.player))
mod_name = f"archipelago-client-{world.seed}-{player}"
tech_cost = {0: 0.1,
1: 0.25,
2: 0.5,
3: 1,
4: 2,
5: 5,
6: 10}[world.tech_cost[player].value]
template_data = {"locations": locations, "player_names" : player_names, "tech_table": tech_table,
"mod_name": mod_name}
"mod_name": mod_name, "allowed_science_packs": world.max_science_pack[player].get_allowed_packs(),
"tech_cost": tech_cost}
mod_code = template.render(**template_data)

View File

@@ -29,10 +29,8 @@ for technology in sorted(raw):
requirements[technology] = set(data["requires"])
current_ingredients = set(data["ingredients"])-starting_ingredient_recipes
if current_ingredients:
all_ingredients |= current_ingredients
current_ingredients = {"recipe-"+ingredient for ingredient in current_ingredients}
ingredients[technology] = current_ingredients
ingredients[technology] = {"recipe-"+ingredient for ingredient in current_ingredients}
recipe_sources = {}
@@ -41,6 +39,6 @@ for technology, data in raw.items():
for recipe in recipe_source:
recipe_sources["recipe-"+recipe] = technology
all_ingredients = {"recipe-"+ingredient for ingredient in all_ingredients}
all_ingredients_recipe = {"recipe-"+ingredient for ingredient in all_ingredients}
del(raw)
lookup_id_to_name: Dict[int, str] = {item_id: item_name for item_name, item_id in tech_table.items()}

View File

@@ -2,7 +2,7 @@ import logging
from BaseClasses import Region, Entrance, Location, MultiWorld, Item
from .Technologies import tech_table, requirements, ingredients, all_ingredients, recipe_sources
from .Technologies import tech_table, requirements, ingredients, all_ingredients, recipe_sources, all_ingredients_recipe
static_nodes = {"automation", "logistics"}
@@ -30,7 +30,7 @@ def factorio_create_regions(world: MultiWorld, player: int):
tech = Location(player, tech_name, tech_id, nauvis)
nauvis.locations.append(tech)
tech.game = "Factorio"
for ingredient in all_ingredients: # register science packs as events
for ingredient in all_ingredients_recipe: # register science packs as events
ingredient_location = Location(player, ingredient, 0, nauvis)
ingredient_location.item = Item(ingredient, True, 0, player)
ingredient_location.event = ingredient_location.locked = True
@@ -56,4 +56,4 @@ def set_rules(world: MultiWorld, player: int):
world.completion_condition[player] = lambda state: all(state.has(ingredient, player)
for ingredient in all_ingredients)
for ingredient in all_ingredients_recipe)