Factorio: Show item source and enable research queue
This commit is contained in:
parent
433981fd3d
commit
b7327138f3
|
@ -146,12 +146,13 @@ async def factorio_server_watcher(ctx: FactorioContext):
|
||||||
if ctx.rcon_client:
|
if ctx.rcon_client:
|
||||||
while ctx.send_index < len(ctx.items_received):
|
while ctx.send_index < len(ctx.items_received):
|
||||||
item_id = ctx.items_received[ctx.send_index].item
|
item_id = ctx.items_received[ctx.send_index].item
|
||||||
|
player_name = ctx.player_names[ctx.send_index].player
|
||||||
if item_id not in lookup_id_to_name:
|
if item_id not in lookup_id_to_name:
|
||||||
logging.error(f"Cannot send unknown item ID: {item_id}")
|
logging.error(f"Cannot send unknown item ID: {item_id}")
|
||||||
else:
|
else:
|
||||||
item_name = lookup_id_to_name[item_id]
|
item_name = lookup_id_to_name[item_id]
|
||||||
factorio_server_logger.info(f"Sending {item_name} to Nauvis.")
|
factorio_server_logger.info(f"Sending {item_name} to Nauvis from {player_name}.")
|
||||||
ctx.rcon_client.send_command(f'/ap-get-technology {item_name}')
|
ctx.rcon_client.send_command(f'/ap-get-technology {item_name} {player_name}')
|
||||||
ctx.send_index += 1
|
ctx.send_index += 1
|
||||||
|
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|
|
@ -236,7 +236,8 @@ hollow_knight_skip_options: typing.Dict[str, type(Option)] = {
|
||||||
"SHADESKIPS": Toggle,
|
"SHADESKIPS": Toggle,
|
||||||
}
|
}
|
||||||
|
|
||||||
hollow_knight_options: typing.Dict[str, type(Option)] = {**hollow_knight_randomize_options, **hollow_knight_skip_options}
|
hollow_knight_options: typing.Dict[str, type(Option)] = {**hollow_knight_randomize_options,
|
||||||
|
**hollow_knight_skip_options}
|
||||||
|
|
||||||
|
|
||||||
class MaxSciencePack(Choice):
|
class MaxSciencePack(Choice):
|
||||||
|
@ -264,6 +265,7 @@ class TechCost(Choice):
|
||||||
option_insane = 6
|
option_insane = 6
|
||||||
default = 3
|
default = 3
|
||||||
|
|
||||||
|
|
||||||
class FreeSamples(Choice):
|
class FreeSamples(Choice):
|
||||||
option_none = 0
|
option_none = 0
|
||||||
option_single_craft = 1
|
option_single_craft = 1
|
||||||
|
@ -271,6 +273,7 @@ class FreeSamples(Choice):
|
||||||
option_stack = 3
|
option_stack = 3
|
||||||
default = 3
|
default = 3
|
||||||
|
|
||||||
|
|
||||||
class TechTreeLayout(Choice):
|
class TechTreeLayout(Choice):
|
||||||
option_single = 0
|
option_single = 0
|
||||||
option_small_diamonds = 1
|
option_small_diamonds = 1
|
||||||
|
@ -279,11 +282,13 @@ class TechTreeLayout(Choice):
|
||||||
option_funnel = 4
|
option_funnel = 4
|
||||||
default = 0
|
default = 0
|
||||||
|
|
||||||
|
|
||||||
class Visibility(Choice):
|
class Visibility(Choice):
|
||||||
option_none = 0
|
option_none = 0
|
||||||
option_sending = 1
|
option_sending = 1
|
||||||
default = 0
|
default = 0
|
||||||
|
|
||||||
|
|
||||||
factorio_options: typing.Dict[str, type(Option)] = {"max_science_pack": MaxSciencePack,
|
factorio_options: typing.Dict[str, type(Option)] = {"max_science_pack": MaxSciencePack,
|
||||||
"tech_tree_layout": TechTreeLayout,
|
"tech_tree_layout": TechTreeLayout,
|
||||||
"tech_cost": TechCost,
|
"tech_cost": TechCost,
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
require "lib"
|
require "lib"
|
||||||
|
script.on_event(defines.events.on_player_created, function(event)
|
||||||
|
game.players[event.player_index].force.research_queue_enabled = true
|
||||||
|
end)
|
||||||
|
|
||||||
-- for testing
|
-- for testing
|
||||||
script.on_event(defines.events.on_tick, function(event)
|
script.on_event(defines.events.on_tick, function(event)
|
||||||
if event.tick%600 == 0 then
|
if event.tick%600 == 0 then
|
||||||
|
@ -119,12 +123,17 @@ end)
|
||||||
|
|
||||||
commands.add_command("ap-get-technology", "Grant a technology, used by the Archipelago Client.", function(call)
|
commands.add_command("ap-get-technology", "Grant a technology, used by the Archipelago Client.", function(call)
|
||||||
local force = game.forces["player"]
|
local force = game.forces["player"]
|
||||||
local tech_name = call.parameter
|
chunks = {}
|
||||||
|
for substring in call.parameter:gmatch("%S+") do -- split on " "
|
||||||
|
table.insert(chunks, substring)
|
||||||
|
end
|
||||||
|
local tech_name = chunks[1]
|
||||||
|
local source = chunks[2] or "Archipelago"
|
||||||
local tech = force.technologies[tech_name]
|
local tech = force.technologies[tech_name]
|
||||||
if tech ~= nil then
|
if tech ~= nil then
|
||||||
if tech.researched ~= true then
|
if tech.researched ~= true then
|
||||||
tech.researched = true
|
tech.researched = true
|
||||||
game.print({"", "Received ", tech.localised_name, " from Archipelago"})
|
game.print({"", "Received ", tech.localised_name, " from ", source})
|
||||||
game.play_sound({path="utility/research_completed"})
|
game.play_sound({path="utility/research_completed"})
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue