FactorioClient: Fix bridge not sending, and limit bridge to run up to once a second.
Setup: Fix LttP Adjuster needs to be installed with generator/lttp MultiServer: fix duplicate !forfeits
This commit is contained in:
parent
f8569db21b
commit
89c05cfcae
|
@ -5,6 +5,8 @@ import json
|
|||
import string
|
||||
import copy
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
import factorio_rcon
|
||||
|
||||
import colorama
|
||||
|
@ -109,9 +111,11 @@ class FactorioContext(CommonContext):
|
|||
async def game_watcher(ctx: FactorioContext):
|
||||
bridge_logger = logging.getLogger("FactorioWatcher")
|
||||
from worlds.factorio.Technologies import lookup_id_to_name
|
||||
last_bridge = time.perf_counter()
|
||||
try:
|
||||
while not ctx.exit_event.is_set():
|
||||
if ctx.awaiting_bridge and ctx.rcon_client:
|
||||
if ctx.awaiting_bridge and ctx.rcon_client and time.perf_counter() + 1 < last_bridge:
|
||||
last_bridge = time.perf_counter()
|
||||
ctx.awaiting_bridge = False
|
||||
data = json.loads(ctx.rcon_client.send_command("/ap-sync"))
|
||||
if data["slot_name"] != ctx.auth:
|
||||
|
@ -135,7 +139,7 @@ async def game_watcher(ctx: FactorioContext):
|
|||
f"{[lookup_id_to_name[rid] for rid in research_data - ctx.locations_checked]}")
|
||||
ctx.locations_checked = research_data
|
||||
await ctx.send_msgs([{"cmd": 'LocationChecks', "locations": tuple(research_data)}])
|
||||
await asyncio.sleep(1)
|
||||
await asyncio.sleep(0.1)
|
||||
|
||||
except Exception as e:
|
||||
logging.exception(e)
|
||||
|
|
|
@ -915,7 +915,7 @@ class ClientMessageProcessor(CommonCommandProcessor):
|
|||
" You can ask the server admin for a /forfeit")
|
||||
return False
|
||||
|
||||
def _cmd_forfeit(self) -> bool:
|
||||
def _cmd_collect(self) -> bool:
|
||||
"""Send your remaining items to yourself"""
|
||||
if "enabled" in self.ctx.collect_mode:
|
||||
collect_player(self.ctx, self.client.team, self.client.slot)
|
||||
|
|
|
@ -74,7 +74,7 @@ Source: "{#sourcepath}\ArchipelagoServer.exe"; DestDir: "{app}"; Flags: ignoreve
|
|||
Source: "{#sourcepath}\ArchipelagoFactorioClient.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: client/factorio
|
||||
Source: "{#sourcepath}\ArchipelagoTextClient.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: client/text
|
||||
Source: "{#sourcepath}\ArchipelagoLttPClient.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: client/lttp
|
||||
Source: "{#sourcepath}\ArchipelagoLttPAdjuster.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: client/lttp
|
||||
Source: "{#sourcepath}\ArchipelagoLttPAdjuster.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: client/lttp or generator/lttp
|
||||
Source: "{#sourcepath}\ArchipelagoMinecraftClient.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: client/minecraft
|
||||
Source: "vc_redist.x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall
|
||||
|
||||
|
@ -96,7 +96,7 @@ Name: "{commondesktop}\{#MyAppName} Factorio Client"; Filename: "{app}\Archipela
|
|||
[Run]
|
||||
|
||||
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/passive /norestart"; Check: IsVCRedist64BitNeeded; StatusMsg: "Installing VC++ redistributable..."
|
||||
Filename: "{app}\ArchipelagoLttPAdjuster"; Parameters: "--update_sprites"; StatusMsg: "Updating Sprite Library..."; Components: client/lttp or generator
|
||||
Filename: "{app}\ArchipelagoLttPAdjuster"; Parameters: "--update_sprites"; StatusMsg: "Updating Sprite Library..."; Components: client/lttp or generator/lttp
|
||||
Filename: "{app}\jre8\bin\java.exe"; Parameters: "-jar ""{app}\forge-installer.jar"" --installServer ""{app}\Minecraft Forge server"""; Flags: runhidden; Check: IsForgeNeeded(); StatusMsg: "Installing Forge Server..."; Components: client/minecraft
|
||||
|
||||
[UninstallDelete]
|
||||
|
|
|
@ -57,7 +57,6 @@ function on_force_created(event)
|
|||
local data = {}
|
||||
data['earned_samples'] = {{ dict_to_lua(starting_items) }}
|
||||
data["victory"] = 0
|
||||
data["checked_technologies"] = {}
|
||||
global.forcedata[event.force] = data
|
||||
{%- if silo == 2 %}
|
||||
check_spawn_silo(force)
|
||||
|
@ -202,9 +201,7 @@ script.on_event(defines.events.on_research_finished, function(event)
|
|||
local technology = event.research
|
||||
if technology.researched and string.find(technology.name, "ap%-") == 1 then
|
||||
-- check if it came from the server anyway, then we don't need to double send.
|
||||
if global.forcedata[technology.force.name]["checked_technologies"][technology.name] ~= nil then
|
||||
dumpInfo(technology.force) --is sendable
|
||||
end
|
||||
dumpInfo(technology.force) --is sendable
|
||||
else
|
||||
if FREE_SAMPLES == 0 then
|
||||
return -- Nothing else to do
|
||||
|
@ -393,7 +390,6 @@ commands.add_command("ap-get-technology", "Grant a technology, used by the Archi
|
|||
if index == -1 then -- for coop sync and restoring from an older savegame
|
||||
tech = force.technologies[item_name]
|
||||
if tech.researched ~= true then
|
||||
global.forcedata[force.name]["checked_technologies"][tech.name] = 1 -- mark as don't send again
|
||||
game.print({"", "Received [technology=" .. tech.name .. "] as it is already checked."})
|
||||
game.play_sound({path="utility/research_completed"})
|
||||
tech.researched = true
|
||||
|
|
Loading…
Reference in New Issue