From 760173e0a17c6a6b96c196e2001db1fe31854720 Mon Sep 17 00:00:00 2001 From: Oarcinae Date: Thu, 21 Nov 2024 13:37:11 -0500 Subject: [PATCH 1/6] Switch to using new set_driving() function, update required base version and mod version. --- changelog.txt | 6 ++++++ info.json | 4 ++-- lib/separate_spawns.lua | 4 +--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index d0ca844..57e232a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,10 @@ --------------------------------------------------------------------------------------------------- +Version: 2.1.14 +Date: 2024-11-21 + Info: + - Update locale (thanks plexpt!) + - Make use of new set_driving() function. +--------------------------------------------------------------------------------------------------- Version: 2.1.13 Date: 2024-11-20 Major Features: diff --git a/info.json b/info.json index 69a1f90..7ab1e01 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "oarc-mod", - "version": "2.1.13", + "version": "2.1.14", "factorio_version": "2.0", "title": "Oarc Multiplayer Spawn", "author": "Oarcinae", @@ -8,7 +8,7 @@ "homepage": "https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn", "description": "[[Description is in locale file!]]", "dependencies": [ - "base >= 2.0.0", + "base >= 2.0.17", "? space-age", "(?) dangOreus" , "(?) Milestones", diff --git a/lib/separate_spawns.lua b/lib/separate_spawns.lua index ef15900..a10d8b1 100644 --- a/lib/separate_spawns.lua +++ b/lib/separate_spawns.lua @@ -1702,10 +1702,8 @@ function TeleportPlayerToRespawnPoint(surface_name, player, first_spawn) return end - -- As a temporary measure to make sure teleport works in the case that the player is in a moving cargo-pod, we first - -- teleport to the holding pen surface since there is no way to force them out of the cargo-pod that I know of. if player.driving then - SafeTeleport(player, game.surfaces[HOLDING_PEN_SURFACE_NAME], {x=0,y=0}) + player.set_driving(false, true) -- We need to force player out of the cargo-pod before we teleport. end SafeTeleport(player, game.surfaces[surface_name], spawn.position) From aad1100d7c249685ad0314ee1d8587b86bbb83ed Mon Sep 17 00:00:00 2001 From: plex Date: Fri, 22 Nov 2024 02:41:39 +0800 Subject: [PATCH 2/6] update zh-CN locale (#274) * add mod setting string locale * add more locale gui * add more locale * add zh-CN locale * update locale --- control.lua | 18 +++++----- locale/en/locale.cfg | 12 +++---- locale/zh-CN/locale.cfg | 80 +++++++++++++++++++++++------------------ 3 files changed, 61 insertions(+), 49 deletions(-) diff --git a/control.lua b/control.lua index 8553f76..b9d91a1 100644 --- a/control.lua +++ b/control.lua @@ -1,9 +1,9 @@ -- Sep 2024 --- ____ _____ _____ +-- ____ _____ _____ -- / __ \ /\ | __ \ / ____| --- | | | | / \ | |__) | | --- | | | |/ /\ \ | _ /| | --- | |__| / ____ \| | \ \| |____ +-- | | | | / \ | |__) | | +-- | | | |/ /\ \ | _ /| | +-- | |__| / ____ \| | \ \| |____ -- \____/_/ \_\_| \_\\_____| -- Oarc's Separated Spawn MOD V2 @@ -150,7 +150,7 @@ end) script.on_event(defines.events.on_research_finished, function(event) local research = event.research -- TODO: Add a non-mod setting to disable this. - SendBroadcastMsg({"oarc-research-finished", research.force.name, research.localised_name}) + SendBroadcastMsg({"oarc-research-finished", research.force.name, research.name}) end) ---------------------------------------- @@ -192,7 +192,7 @@ end) ---@field new_surface_name string script.on_event("oarc-mod-character-surface-changed", function(event) log("EVENT - oarc-mod-character-surface-changed:" .. serpent.block(event --[[@as OarcModCharacterSurfaceChangedEvent]])) - + --This is just here so I don't get lua warnings about unused variables. ---@type OarcModCharacterSurfaceChangedEvent local custom_event = event --[[@as OarcModCharacterSurfaceChangedEvent]] @@ -250,7 +250,7 @@ script.on_event(defines.events.on_chunk_generated, function(event) if storage.ocfg.regrowth.enable_regrowth then RegrowthChunkGenerate(event) end - + CreateHoldingPenChunks(event) if storage.ocfg.gameplay.modified_enemy_spawning then @@ -264,7 +264,7 @@ end) ---------------------------------------- -- Radar Scanning ---------------------------------------- -script.on_event(defines.events.on_sector_scanned, function (event) +script.on_event(defines.events.on_sector_scanned, function (event) if storage.ocfg.regrowth.enable_regrowth then RegrowthSectorScan(event) end @@ -455,4 +455,4 @@ local oarc_mod_interface = end } -remote.add_interface("oarc_mod", oarc_mod_interface) \ No newline at end of file +remote.add_interface("oarc_mod", oarc_mod_interface) diff --git a/locale/en/locale.cfg b/locale/en/locale.cfg index 19c48d4..a354430 100644 --- a/locale/en/locale.cfg +++ b/locale/en/locale.cfg @@ -65,7 +65,7 @@ oarc-buddy-spawn-info=The buddy system requires 2 players in this menu at the sa oarc-max-players-shared-spawn=You can allow up to __1__ other players to join you. oarc-spawn-dist-notes=Spawn distance is in CHUNKS from the center of the map.\nExpect a fight to reach other players. -oarc-player-is-joining=__1__ is joining the game on __2__! +oarc-player-is-joining=__1__ is joining the game on [planet=__2__]! oarc-player-started-own-team=__1__ has started their own team! oarc-player-no-new-teams-sorry=Sorry, no new teams can be created. You were assigned to the default team instead. oarc-no-ungenerated-land-error=[color=red]Failed to find ungenerated land to spawn on! Please try again. If you see this message multiple times, it could be a settings or mod conflict issue.[/color] @@ -240,7 +240,7 @@ oarc-settings-tab-player-warning=You are not an admin. These settings are read-o oarc-settings-tab-description=This tab contains the same mod settings in the mod settings menu AND some additional settings that can only be changed in game. Check the Surface Settings tab for surface-specific settings. oarc-settings-tab-text-field-enter-tooltip=[color=red]You must press ENTER after typing in a text field to save the value![/color] oarc-settings-tab-title-surface=Enable or Disable Surface Features -oarc-settings-tab-surfaces-warning=Only Nauvis as primary is recommended! All planets support secondary spawns at this time, but it is still a work in progress. Please don't change these settings if you have already landed on other planets unless you are okay with losing your progress on those planets. +oarc-settings-tab-surfaces-warning=Only [planet=nauvis] as primary is recommended! All planets support secondary spawns at this time, but it is still a work in progress. Please don't change these settings if you have already landed on other planets unless you are okay with losing your progress on those planets. oarc-settings-tab-surface-checkbox-tooltip=Enabling this will allow players to START with custom spawn areas (the main feature of this mod) on this surface. You need at least one of these enabled for the mod to work. oarc-settings-tab-surface-secondary-checkbox-tooltip=Enabling this will give players custom landing areas when they first travel to this surface. This allows players to have separate landing sites. [color=red]This feature is currently a work in progress. If you enable this AFTER landing on a new planet, the next time you travel in a rocket you will be sent to a new spawn![/color] oarc-settings-tab-surface-regrowth-checkbox-tooltip=Enabling this will allow the regrowth and world eater features to work on this surface, if those are enabled. @@ -276,7 +276,7 @@ oarc-shared-chest-helper-txt=This connects to a shared storage chest for all pla oarc-mod-faq-what-is-this-mod=What is this mod? oarc-mod-faq-what-is-this-mod-answer=This mod overhauls multiplayer spawning. Players can create their own spawn points away from the center of the map. Players can also join other players' bases, or create buddy spawns. The mod does not change the core gameplay of Factorio, but it does change the way players start the game. The starting area is a preset area with resources, not a "natural" spawn point. oarc-mod-faq-other-surfaces=Can I start on a different surface/planet? -oarc-mod-faq-other-surfaces-answer=[color=red]I only recommend starting on "nauvis" or a default nauvis-like surface.[/color] The short answer is yes, but the you probably don't want to. There is no simple way to ensure that you can start on other planets without breaking the normal progression and gameplay. There are other mods out there, like Any Planet Start, but I have not tested compatibility yet. +oarc-mod-faq-other-surfaces-answer=[color=red]I only recommend starting on [planet=nauvis] or a default nauvis-like surface.[/color] The short answer is yes, but the you probably don't want to. There is no simple way to ensure that you can start on other planets without breaking the normal progression and gameplay. There are other mods out there, like Any Planet Start, but I have not tested compatibility yet. oarc-mod-faq-secondary-spawns=What are secondary spawns? oarc-mod-faq-secondary-spawns-answer=If enabled, when a player first travels to a new planet/surface, they will automatically be given a separate landing area based on their primary spawn choice (the first spawn they create). [color=red]This feature is currently a work in progress, but I have now added support for the Space Age planets (fulgora, gleba, vulcanus, and Aquilo).[/color] There are some known issues, such as cargo-pods landing at the center of the map if you don't have a landing pad setup yet (use the /oarc-wheres-my-cargo-pod command to retrieve them). Additionally, Vulcanus doesn't yet provide any API support to modify demolishers or territories, so I have a crude safety mechanism that removes demolishers close to your spawn area. All planets should still be playable, but it's not perfect. Please report issues to me on discord/github. oarc-mod-faq-enemy-scaling=How are enemies handled? @@ -313,8 +313,8 @@ oarc-select-surface-label=Select Surface: oarc-select-surface-tooltip=Select the surface you want to configure. oarc-revert-button=Revert oarc-revert-tooltip=Revert to default. -oarc-copy-nauvis-button=Copy Nauvis -oarc-copy-nauvis-tooltip=Copy Nauvis settings to this surface. +oarc-copy-nauvis-button=Copy [planet=nauvis] +oarc-copy-nauvis-tooltip=Copy [planet=nauvis] settings to this surface. oarc-add-item-tooltip=Add Item @@ -397,7 +397,7 @@ oarc-spawn-distance-invalid-msg=Invalid setting! Near spawn min distance is grea oarc-world-eater-invalid-msg=Invalid setting! World eater is enabled but regrowth is not! Disabling world eater. oarc-default-surface-invalid-msg=Invalid setting! Default surface does not exist! Setting to nauvis. -oarc-research-finished=Team __1__ has finished researching __2__! +oarc-research-finished=Team __1__ has finished researching [technology=__2__]! oarc-command-dude-wheres-my-cargo-pod=This will attempt to teleport any cargo-pods from the map center to you if they are on the same force as you. This is meant to be a temporary workaround until I find a way to send cargo pods directly to a new spawn. oarc-command-reroll-spawn=This will reroll your spawn (on whichever surface you are currently on). This is useful if you are stuck in a bad spot or want to try a different location. [color=red]Spam this at your own peril![/color] diff --git a/locale/zh-CN/locale.cfg b/locale/zh-CN/locale.cfg index 120548a..51fd96f 100644 --- a/locale/zh-CN/locale.cfg +++ b/locale/zh-CN/locale.cfg @@ -6,7 +6,7 @@ description=此模组提供了一个彻底改革多人生成的场景。\n[color oarc-scenario-info-warn-msg=此场景允许玩家在远离地图中心的地方创建自己的重生点。要了解更多信息,请点击左上角的 OARC 按钮。 -oarc-experimental-warning=[color=red][font=default-bold]Factorio 2.0 和 太空时代 支持仍在测试阶段!!!请在 群 289362487 向我报告错误/提交建议/参与翻译,谢谢![/font][/color] +oarc-experimental-warning=[color=red][font=default-bold]Factorio 2.0 和 太空时代 支持仍在测试阶段!!!请在开发群 289362487 向我报告错误/提交建议/参与翻译,谢谢![/font][/color] oarc-i-understand=我明白 oarc-spawn-options=重生选项 @@ -43,7 +43,7 @@ oarc-spawn-menu-buddy-header=创建伙伴基地 oarc-spawn-distance-slider-label=距离地图中心的距离: oarc-spawn-distance-slider-tooltip=这是你将生成的位置距离地图中心的区块的最小距离。如果你的地图已经被探索过,你可能会生成得更远。资源和敌人在离中心越远的地方越丰富,但你仍然会被保证有一个安全的基地。 -oarc-starting-area-normal=你在一个新区域生成,带有预设的起始资源。 +oarc-starting-area-normal=你在一个新区域出生,带有预设的起始资源。 oarc-join-someone-dropdown-label=选择共享基地: oarc-join-someone-dropdown-tooltip=选择一个玩家请求加入他们的共享基地。 oarc-join-shared-button-enable=加入 (__1__ 在 __2__) @@ -51,21 +51,21 @@ oarc-join-shared-button-disable=先选择一个玩家! oarc-join-shared-button-tooltip=这将发送一个请求加入所选玩家的共享基地。如果你改变主意,可以取消请求。 oarc-join-someone-info=你可以请求加入其他玩家的基地。这需要至少有一个玩家允许访问他们的基地,并有足够的空间供你加入。 -oarc-no-shared-avail=目前没有可生成的共享基地。 +oarc-no-shared-avail=目前没有可加入的共享基地。 oarc-join-check-again=再次检查 oarc-shared-spawn-disabled=在此模式下共享基地已禁用。 oarc-no-shared-spawn-selected=你尚未选择一个有效的玩家加入。请选择列表中的一个玩家。 oarc-invalid-host-shared-spawn=所选玩家不再可用!请再次尝试。 -oarc-buddy-spawn=请求伙伴生成 +oarc-buddy-spawn=请求伙伴挨着出生 oarc-buddy-spawn-tooltip=这将发送请求给所选伙伴。他们可以选择接受或拒绝请求。如果你改变主意,也可以取消请求。 -oarc-buddy-spawn-disabled=在此模式下伙伴生成已禁用。 -oarc-buddy-spawn-info=伙伴系统需要同时有两个玩家在此菜单中,你们将相邻生成,各自拥有自己的资源。 +oarc-buddy-spawn-disabled=在此模式下伙伴出生已禁用。 +oarc-buddy-spawn-info=伙伴系统需要同时有两个玩家在此菜单中,你们将相邻出生,各自拥有自己的资源。 oarc-max-players-shared-spawn=你可以允许最多 __1__ 名其他玩家加入你。 oarc-spawn-dist-notes=生成距离是以地图中心的区块计算的。\n预计到达其他玩家时会遇到战斗。 -oarc-player-is-joining=__1__ 正在 __2__ 上加入游戏! +oarc-player-is-joining=__1__ 正在 [planet=__2__] 上加入游戏! oarc-player-started-own-team=__1__ 已经创建了自己的队伍! oarc-player-no-new-teams-sorry=对不起,无法创建新队伍。你已被分配到默认队伍。 oarc-no-ungenerated-land-error=[color=red]未能找到未生成的土地以生成!请再次尝试。如果你多次看到此消息,可能是设置或模组冲突问题。[/color] @@ -91,7 +91,7 @@ oarc-return-to-previous-tooltip=返回上一菜单。 oarc-player-requesting-join-you=__1__ 请求加入你的基地! oarc-waiting-for-spawn-owner=等待基地主人回应... -oarc-you-will-spawn-once-host=一旦对方大佬选择是,你便会加入... +oarc-you-will-spawn-once-host=一旦对方大佬同意,你便会加入他的基地... oarc-player-cancel-join-request=__1__ 取消了加入你的基地的请求。 oarc-spawn-ctrl=重生选项 @@ -102,7 +102,7 @@ oarc-primary-spawn-info-surface-label=基地:__1__(x=__2__,y=__3__) oarc-teleport-home=传送至重生点 oarc-teleport-home-tooltip=这将把你传送到这个空间(星球)上的重生点(如果你设置了的话)。 -oarc-secondary-spawn-info-header=次要生成信息 +oarc-secondary-spawn-info-header=副基地信息 oarc-secondary-spawn-info-note=这些是你的次要基地位置。 oarc-secondary-spawn-info-surface-label=次要基地:__1__(x=__2__,y=__3__) @@ -174,7 +174,7 @@ oarc-invalid-buddy=你尚未选择一个有效的伙伴!请再次尝试。 oarc-buddy-not-avail=所选伙伴不再可用!请再次尝试。 oarc-waiting-for-buddy=等待伙伴回应... -oarc-wait-buddy-select-yes=一旦你的伙伴选择了“是”,你将生成... +oarc-wait-buddy-select-yes=一旦你的伙伴选择了“是”,你将出生... oarc-buddy-cancel-request=__1__ 取消了他们的伙伴请求! @@ -190,12 +190,11 @@ oarc-buddy-txt-moat= 被护城河环绕 oarc-buddy-txt-surface= 在 __1__ oarc-buddy-txt-distance= 在距离地图中心 __1__ 块的位置! - oarc-buddy-declined=__1__ 拒绝了你的伙伴请求! - +# oarc-spawn-wait=请稍等! oarc-wait-text=你的基地正在创建中。\n你将在 __1__ 秒后被传送到那里!\n请准备就绪... - +# oarc-gui-tab-header-label=场景信息和控件 oarc-server-info-tab-title=服务器信息 oarc-spawn-ctrls-tab-title=基地设置 @@ -240,13 +239,14 @@ oarc-settings-tab-player-warning=你不是管理员。这些设置对你来说 oarc-settings-tab-description=此标签包含与模组设置菜单相同的设置,并且还有一些只能在游戏中更改的附加设置。检查空间(星球)配置标签以获取特定于空间(星球)的设置。 oarc-settings-tab-text-field-enter-tooltip=[color=red]输入文本字段后,必须按 ENTER 键才能保存值![/color] oarc-settings-tab-title-surface=空间(星球)设置 +oarc-settings-tab-surfaces-warning=推荐将[planet=nauvis]作为主基地星球!目前所有行星都支持副基地,但这仍在开发中。如果您已经登陆其他行星,请勿更改这些设置,除非您不介意失去在这些行星上的进度。 oarc-settings-tab-surface-checkbox-tooltip=启用此选项将允许在此空间(星球)上自定义基地(该模组的主要功能)。你需要至少启用一个空间(星球)以便模组工作。 -oarc-settings-tab-surface-secondary-checkbox-tooltip=启用此选项将允许玩家首次前往此空间(星球)时获得自定义次要基地。[color=red]此功能目前处于开发中。[/color] +oarc-settings-tab-surface-secondary-checkbox-tooltip=启用此选项将允许玩家首次前往此空间(星球)时获得自定义着陆区域(次要基地)。 这允许玩家拥有独立的着陆点。[color=red]如果你在登陆新行星后启用此功能,下次乘坐火箭旅行时,你将被发送到一个新的基地![/color] oarc-settings-tab-surface-regrowth-checkbox-tooltip=启用此选项将允许在此空间(星球)上使用再生和世界吞噬者功能(如果启用了这些功能)。 oarc-settings-tab-surface-column-header=空间(星球) -oarc-settings-tab-surface-spawning-enabled=主生成 -oarc-settings-tab-surface-secondary-enabled=次要生成 -oarc-settings-tab-surface-regrowth-enabled=再生 +oarc-settings-tab-surface-spawning-enabled=主基地 +oarc-settings-tab-surface-secondary-enabled=副基地 +oarc-settings-tab-surface-regrowth-enabled=重生点 oarc-settings-tab-title-export=导入/导出设置 oarc-settings-tab-export-button=导出 oarc-settings-tab-export-button-tooltip=将所有设置导出为一个字符串,可以与其他玩家共享或以后保存。 @@ -264,8 +264,8 @@ oarc-settings-section-subheader-difficulty-scaling=敌人和资源扩展 oarc-settings-section-subheader-gameplay-misc=杂项 oarc-settings-section-subheader-sharing=共享与合作 -oarc-settings-section-subheader-resource-placement-circular=对于圆形/八边形生成 -oarc-settings-section-subheader-resource-placement-square=对于方形生成 +oarc-settings-section-subheader-resource-placement-circular=对于圆形/八边形基地 +oarc-settings-section-subheader-resource-placement-square=对于方形基地 oarc-settings-section-subheader-regrowth-warning=这些特性可以帮助减少存档文件大小,但可能会增加 UPS 开销。\n @@ -275,13 +275,15 @@ oarc-shared-chest-helper-txt=这连接到所有玩家共享的存储箱。 oarc-mod-faq-what-is-this-mod=这是什么模组? oarc-mod-faq-what-is-this-mod-answer=此模组彻底改革了多人生成。玩家可以在远离地图中心的地方创建自己的基地。玩家还可以加入其他玩家的基地,或者创建伙伴生成。该模组不会改变 Factorio 的核心玩法,但它确实改变了玩家开始游戏的方式。基地是一个预设的资源区域,而不是一个“自然”的基地。 oarc-mod-faq-other-surfaces=我可以从不同的空间/星球开始吗? -oarc-mod-faq-other-surfaces-answer=[color=red]此功能目前处于开发中。因此,仅在“nauvis”或默认的类似 nauvis 的空间(星球)上正确工作。[/color] -oarc-mod-faq-secondary-spawns=什么是次要生成? -oarc-mod-faq-secondary-spawns-answer=如果启用,当玩家首次前往具有自定义生成的新空间(星球)时,他们会自动获得一个新的基地,基于他们的主要生成选择(第一次创建的生成)。[color=red]此功能目前处于开发中。在其他空间(星球)上进行次要生成可能会导致问题。[/color] +oarc-mod-faq-other-surfaces-answer=[color=red]推荐在[planet=nauvis]或类似[planet=nauvis]的默认空间(星球)上开始游戏。[/color]简短的回答是可以,但你可能并不想这样做。没有简单的方法可以确保你能在其他行星上开始游戏而不破坏正常的游戏进程和玩法。还有其他一些模组,比如“任意行星开局”(Any Planet Start),但我尚未测试过兼容性。 +oarc-mod-faq-secondary-spawns=什么是副基地? +oarc-mod-faq-secondary-spawns-answer=如果启用,当玩家首次前往具有自定义生成的新空间(星球)时,他们会自动获得一个新的基地,基于他们的主要生成选择(第一次创建的基地)。[color=red]此功能目前处于开发中。在其他空间(星球)上进行次要生成可能会导致问题。[/color] +oarc-mod-faq-enemy-scaling=敌人是如何处理的? +oarc-mod-faq-enemy-scaling-answer=问得好!我的模组试图为加入游戏或登陆新星球的任何玩家提供一个安全的起始区域。主要方式是通过移除新基地周围的大多数敌人。此外,无论全局进化设置如何,玩家基地附近的区域只会生成较简单的敌人变种。在娜乌维斯(Nauvis)上,虫子也会被调整,这样如果你选择在远离地图中心的地方生成,你不会被巨虫包围。在火神星(Vulcanus)上,作为在我们获得适当的API来修改领土之前的临时解决方案,我会移除任何靠近你基地的破坏者。这是一个粗略的解决方案,但目前有效。我还会根据进化因子和到最近生成点的距离来调整对生成器的伤害。这有助于补偿在高进化因子下生成器生命值的调整。要调整距离,请查看表面设置选项卡。每个表面都有自己的设置,用于生成点周围的安全、警告和危险区域。 oarc-mod-faq-what-are-teams=不同的队伍选项是什么? -oarc-mod-faq-what-are-teams-answer=我只为合作游戏编写了这个模组,不是为了 PvP。根据模组设置,你可以选择加入主队,共享科技,或者创建自己的队伍,拥有自己的科技树。所有队伍/势力之间都是友好的,可以在聊天中交流,并且(可选地)共享地图视野。创建自己队伍的唯一原因是如果你想拥有自己的科技进度。 -oarc-mod-faq-shared-spawn=什么是共享生成? -oarc-mod-faq-shared-spawn-answer=玩家可以选择允许其他玩家加入他们的基地。这允许新玩家在同一初始区域生成为主机玩家。主机玩家可以控制谁能加入他们的基地。 +oarc-mod-faq-what-are-teams-answer=这个模组致力于合作游戏,不是为了 PvP,但你可以在设置中禁用停火和友军队伍来开战。根据模组设置,你可以选择加入主队,共享科技,或者创建自己的队伍,拥有自己的科技树。所有队伍/势力之间都是友好的,可以在聊天中交流,并且(可选地)共享地图视野。创建自己队伍的唯一原因是如果你想拥有自己的科技进度。 +oarc-mod-faq-shared-spawn=什么是共享基地? +oarc-mod-faq-shared-spawn-answer=玩家可以选择允许其他玩家加入他们的基地。这允许新玩家在同一初始区域基地为主机玩家。主机玩家可以控制谁能加入他们的基地。 oarc-mod-faq-buddy-spawn=什么是伙伴生成? oarc-mod-faq-buddy-spawn-answer=如果你和其他玩家同时在生成菜单中,你可以请求伙伴生成。这将使你和你的伙伴在地图上彼此紧邻生成,各自拥有自己的基地。 oarc-mod-faq-regrowth=再生和世界吞噬者特性是什么? @@ -306,13 +308,12 @@ oarc-label-crashed-ship-max=飞船残骸 (最多5个) oarc-label-ship-wreckage-max=飞船碎片 (最多1个) oarc-label-spawn-area-resources=出生区域资源 oarc-label-spawn-area-misc=出生区域其他设置 - -oarc-select-surface-label=选择空间(星球): -oarc-select-surface-tooltip=选择你想要配置的空间(星球)。 -oarc-revert-button=重置 -oarc-revert-tooltip=恢复到默认设置。 -oarc-copy-nauvis-button=复制主世界 -oarc-copy-nauvis-tooltip=将主世界的设置复制到此空间(星球)。 +oarc-select-surface-label=选择星球: +oarc-select-surface-tooltip=选择您要配置的星球。 +oarc-revert-button=还原 +oarc-revert-tooltip=还原为默认设置。 +oarc-copy-nauvis-button=复制[planet=nauvis]设置 +oarc-copy-nauvis-tooltip=将[planet=nauvis]的设置复制到此表面。 oarc-add-item-tooltip=添加物品 @@ -341,11 +342,10 @@ oarc-fluid-type=类型 oarc-fluid-count=数量 oarc-fluid-amount=量 - oarc-misc-config=杂项配置 oarc-liquid=水 oarc-liquid-length=水的长度 -oarc-liquid-length-tooltip=这是基地周围水带的长度(单位:格)。 +oarc-liquid-length-tooltip=这是基地内那个小水坑的长度(单位:格)。仅在没有护城河的情况下放置。 oarc-liquid-x-offset=水的 X 偏移 oarc-liquid-x-offset-tooltip=这是从基地北部的 x 轴偏移(单位:格)。 oarc-liquid-y-offset=水的 Y 偏移 @@ -374,6 +374,7 @@ oarc-broke-message=你破产了!去杀些敌人或讨些零钱吧…… oarc-character-invalid=要使用此功能,您的角色必须有效!确保您不在任何载具内或处于死亡状态! oarc-teleport-cargo-pod-fail=找不到安全的地方来传送货舱! oarc-teleport-cargo-pod-success=货舱已传送到您身边! +oarc-no-cargo-pods=未找到货运舱! oarc-cleanup-30sec-warning=地图清理将在30秒后开始... 未使用和过期的地图区块将被删除! oarc-cleanup-force-30sec-warning=地图强制清理将在30秒后开始... 未使用和过期的地图区块将被删除! @@ -395,6 +396,17 @@ oarc-spawn-distance-invalid-msg=设置无效!近距离出生点的最小距离 oarc-world-eater-invalid-msg=设置无效!世界吞噬者已启用但重生功能未启用!禁用世界吞噬者。 oarc-default-surface-invalid-msg=设置无效!默认地表不存在!设置为 nauvis。 +oarc-research-finished=__1__队已完成研究 [technology=__2__] + +oarc-command-dude-wheres-my-cargo-pod=如果货运舱与你属于同一队伍,此命令将尝试将地图中心的任何货运舱传送到你的位置。这是在我找到直接将货运舱发送到新生成点的方法之前的临时解决方案。 +oarc-command-reroll-spawn=这将重新生成你的起始点(在你当前所在的任何表面上)。如果你卡在了一个糟糕的位置或想尝试不同的位置,这会很有用。 [color=red]滥用此命令后果自负![/color] +oarc-no-reroll-buddy-spawn=我尚未为伙伴生成点实现重新生成功能!你可以尝试离开并重新加入游戏以获得新的伙伴生成点。 +oarc-spawn-rerolled=__1__ 已重新生成他们的起始点! +oarc-reroll-spawn-command=如果你的生成点有问题,你可以使用 /oarc-reroll-spawn 重新生成它!请不要滥用此命令。 + +oarc-spawn-ground-text-welcome=到家啦 +oarc-spawn-ground-text-home=你的新牢房 + [entity-name] oarc-linked-chest=OARC 链接箱子 oarc-linked-power=OARC 链接电力 From 1e1f3364ef13de51ab5fdaba86fa389d8b69a1f0 Mon Sep 17 00:00:00 2001 From: Oarcinae Date: Thu, 21 Nov 2024 19:36:55 -0500 Subject: [PATCH 3/6] More fancy planet name and icon localization. --- changelog.txt | 5 +++-- lib/gui_tabs/player_list.lua | 31 ++++++++++++++++++++++++++---- lib/gui_tabs/settings_controls.lua | 2 +- lib/gui_tabs/spawn_controls.lua | 18 ++++++++--------- lib/separate_spawns.lua | 2 ++ locale/de/locale.cfg | 12 ++++++------ locale/en/locale.cfg | 18 ++++++++--------- locale/ru/locale.cfg | 16 +++++++-------- locale/zh-CN/locale.cfg | 14 +++++++------- 9 files changed, 72 insertions(+), 46 deletions(-) diff --git a/changelog.txt b/changelog.txt index 57e232a..ced2f53 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,8 +2,9 @@ Version: 2.1.14 Date: 2024-11-21 Info: - - Update locale (thanks plexpt!) - - Make use of new set_driving() function. + - Update CN locale. (thanks plexpt!) + - Many non-localized planet names localized and started using the icons where possible too. + - Make use of new set_driving() function. Won't affect gameplay, but I no longer have to do an extra teleport as a workaround. --------------------------------------------------------------------------------------------------- Version: 2.1.13 Date: 2024-11-20 diff --git a/lib/gui_tabs/player_list.lua b/lib/gui_tabs/player_list.lua index cefbf49..5ef5028 100644 --- a/lib/gui_tabs/player_list.lua +++ b/lib/gui_tabs/player_list.lua @@ -67,7 +67,11 @@ function AddPlayerRow(table, player_name, online) else local spawn = FindPlayerHomeSpawn(player.name) if (spawn) then - AddLabel(table, nil, spawn.surface_name, my_label_style) + if game.planets[spawn.surface_name] ~= nil then + AddLabel(table, nil, {"", "[planet=", spawn.surface_name, "] ", {"space-location-name."..spawn.surface_name}}, my_label_style) + else + AddLabel(table, nil, game.surfaces[spawn.surface_name].localised_name, my_label_style) + end else AddLabel(table, nil, "Unknown?", my_label_style) -- Shouldn't happen end @@ -76,7 +80,7 @@ function AddPlayerRow(table, player_name, online) AddLabel(table, nil, FormatTimeHoursSecs(player.online_time), my_label_style) CreatePlayerGPSButton(table, player.name) - + if online then local label = AddLabel(table, nil, {"oarc-player-online"}, my_player_list_style) label.style.font_color = {r=0.1, g=1, b=0.1} @@ -92,7 +96,13 @@ end ---@param player_name string ---@return nil function CreatePlayerGPSButton(container, player_name) - local gps_button = container.add { + local flow = container.add { + type = "flow", + direction = "horizontal", + } + flow.style.vertical_align = "center" + + local gps_button = flow.add { type = "sprite-button", sprite = "utility/gps_map_icon", tags = { @@ -101,10 +111,23 @@ function CreatePlayerGPSButton(container, player_name) player_name = player_name, }, style = "slot_button", - tooltip = {"", {"oarc-player-list-tab-location-button-tooltip"}, " (", game.players[player_name].surface.name, ")"}, + tooltip = {"oarc-player-list-tab-location-button-tooltip"}, } gps_button.style.width = 28 gps_button.style.height = 28 + + local surface_name + if game.players[player_name].character ~= nil then + surface_name = game.players[player_name].character.surface.name + else + surface_name = game.players[player_name].surface.name + end + + if game.planets[surface_name] ~= nil then + AddLabel(flow, nil, {"", "[planet=", surface_name, "] ", {"space-location-name."..surface_name}}, my_label_style) + else + AddLabel(flow, nil, game.surfaces[surface_name].localised_name, my_label_style) + end end ---Handle the gui click of the player list tab in the Oarc GUI. diff --git a/lib/gui_tabs/settings_controls.lua b/lib/gui_tabs/settings_controls.lua index 3520f07..6dc802c 100644 --- a/lib/gui_tabs/settings_controls.lua +++ b/lib/gui_tabs/settings_controls.lua @@ -98,7 +98,7 @@ function CreateSurfaceSettingsSection(container, player) --- Add the rows for name, allowed in pairs(storage.oarc_surfaces) do - AddLabel(surface_table, nil, name, my_label_style) + AddLabel(surface_table, nil, {"", "[planet=", name, "] ", {"space-location-name."..name}}, my_label_style) AddSurfaceCheckboxSetting(surface_table, name, "spawn_enabled", allowed.primary, player.admin, { "oarc-settings-tab-surface-checkbox-tooltip" }) AddSurfaceCheckboxSetting(surface_table, name, "secondary_enabled", allowed.secondary, player.admin, diff --git a/lib/gui_tabs/spawn_controls.lua b/lib/gui_tabs/spawn_controls.lua index 79bed19..da27653 100644 --- a/lib/gui_tabs/spawn_controls.lua +++ b/lib/gui_tabs/spawn_controls.lua @@ -49,9 +49,9 @@ function CreatePrimarySpawnInfo(player, container) local horizontal_flow = container.add { type = "flow", direction = "horizontal"} horizontal_flow.style.vertical_align = "center" AddLabel(horizontal_flow, nil, { "oarc-primary-spawn-info-surface-label", - primary_spawn.surface_name, - primary_spawn.position.x, - primary_spawn.position.y}, my_label_style) + {"", "[planet=", primary_spawn.surface_name, "] ", {"space-location-name."..primary_spawn.surface_name}}, + primary_spawn.position.x, + primary_spawn.position.y}, my_label_style) --Add empty widget local dragger = horizontal_flow.add { @@ -79,9 +79,9 @@ function CreateSecondarySpawnInfo(player, container) local horizontal_flow = container.add { type = "flow", direction = "horizontal"} horizontal_flow.style.vertical_align = "center" AddLabel(horizontal_flow, nil, { "oarc-secondary-spawn-info-surface-label", - secondary_spawn.surface_name, - secondary_spawn.position.x, - secondary_spawn.position.y}, my_label_style) + {"", "[planet=", secondary_spawn.surface_name, "] ", {"space-location-name."..secondary_spawn.surface_name}}, + secondary_spawn.position.x, + secondary_spawn.position.y}, my_label_style) --Add empty widget local dragger = horizontal_flow.add { @@ -162,9 +162,9 @@ function CreateSetRespawnLocationButton(player, container) local horizontal_flow = container.add { type = "flow", direction = "horizontal"} horizontal_flow.style.vertical_align = "center" AddLabel(horizontal_flow, nil, { "oarc-set-respawn-loc-info-surface-label", - respawn_surface_name, - respawn_position.x, - respawn_position.y }, my_label_style) + {"", "[planet=", respawn_surface_name, "] ", {"space-location-name."..respawn_surface_name}}, + respawn_position.x, + respawn_position.y }, my_label_style) --Add empty widget local dragger = horizontal_flow.add { diff --git a/lib/separate_spawns.lua b/lib/separate_spawns.lua index a10d8b1..42b6956 100644 --- a/lib/separate_spawns.lua +++ b/lib/separate_spawns.lua @@ -1703,6 +1703,8 @@ function TeleportPlayerToRespawnPoint(surface_name, player, first_spawn) end if player.driving then + --Ignore the lua warning, the factorio docs use "bool" instead of "boolean" so its broken. TODO: Remove this when they update the docs. + ---@diagnostic disable-next-line: param-type-mismatch player.set_driving(false, true) -- We need to force player out of the cargo-pod before we teleport. end SafeTeleport(player, game.surfaces[surface_name], spawn.position) diff --git a/locale/de/locale.cfg b/locale/de/locale.cfg index c31e780..b5961dc 100644 --- a/locale/de/locale.cfg +++ b/locale/de/locale.cfg @@ -65,12 +65,12 @@ oarc-buddy-spawn-info=Das Buddy-System erfordert, dass 2 Spieler gleichzeitig in oarc-max-players-shared-spawn=Du kannst bis zu __1__ andere Spieler zulassen, dir beizutreten. oarc-spawn-dist-notes=Der Spawn-Abstand ist in CHUNKS vom Zentrum der Karte angegeben.\nErwarte Kämpfe, um andere Spieler zu erreichen. -oarc-player-is-joining=__1__ tritt dem Spiel bei auf __2__! +oarc-player-is-joining=__1__ tritt dem Spiel bei auf [planet=__2__]! oarc-player-started-own-team=__1__ hat sein eigenes Team gegründet! oarc-player-no-new-teams-sorry=Es tut uns leid, aber es können keine neuen Teams erstellt werden. Du wurdest stattdessen dem Standardteam zugewiesen. oarc-no-ungenerated-land-error=[color=red]Fehler: Es konnte kein ungenutztes Land zum Spawnen gefunden werden! Bitte versuche es erneut. Wenn du diese Nachricht mehrmals siehst, könnte dies ein Problem mit den Einstellungen oder eine Mod-Konflikt sein.[/color] -oarc-buddies-are-joining=__1__ und __2__ treten dem Spiel gemeinsam bei auf __3__! -oarc-player-new-secondary=__1__ hat eine sekundäre Basis auf __2__ gegründet! +oarc-buddies-are-joining=__1__ und __2__ treten dem Spiel gemeinsam bei auf [planet=__3__]! +oarc-player-new-secondary=__1__ hat eine sekundäre Basis auf [planet=__2__] gegründet! oarc-please-wait=BITTE WARTE, WÄHREND DEIN SPAWN-PUNKT GENERIERT WIRD! oarc-player-left-early=Spieler (__1__) hat das Spiel verlassen, bevor er/sie __2__ Minuten Spielzeit hatte. Ihr Spawn-Bereich wurde zur Bereinigung markiert. @@ -262,7 +262,7 @@ oarc-shared-chest-helper-txt=Dies verbindet sich mit einer gemeinsamen Lagertruh oarc-mod-faq-what-is-this-mod=Was ist dieser Mod? oarc-mod-faq-what-is-this-mod-answer=Dieser Mod überarbeitet den Mehrspieler-Spawn. Spieler können ihre eigenen Spawn-Punkte abseits des Kartenmittelpunkts erstellen. Spieler können auch anderen Spielern beitreten oder Mitspieler-Spawns erstellen. Der Mod ändert das grundlegende Gameplay von Factorio nicht, sondern beeinflusst nur, wie die Spieler das Spiel beginnen. Das Startgebiet ist ein voreingestelltes Gebiet mit Ressourcen, kein „natürlicher“ Spawn-Punkt. oarc-mod-faq-other-surfaces=Kann ich auf einer anderen Oberfläche/Planet starten? -oarc-mod-faq-other-surfaces-answer=[color=red]Dieses Feature ist derzeit in Arbeit. Daher funktioniert das Spawnen nur auf "Nauvis" oder einer standardmäßigen nauvis-ähnlichen Oberfläche korrekt.[/color] +oarc-mod-faq-other-surfaces-answer=[color=red]Dieses Feature ist derzeit in Arbeit. Daher funktioniert das Spawnen nur auf __PLANET__nauvis__ oder einer standardmäßigen __PLANET__nauvis__-ähnlichen Oberfläche korrekt.[/color] oarc-mod-faq-secondary-spawns=Was sind sekundäre Spawns? oarc-mod-faq-secondary-spawns-answer=Wenn aktiviert, erhalten Spieler beim ersten Betreten einer neuen Oberfläche mit benutzerdefiniertem Spawn automatisch ein neues Startgebiet basierend auf ihrer primären Spawn-Wahl (dem ersten Spawn, den sie erstellen). [color=red]Dieses Feature ist derzeit in Arbeit. Sekundäre Spawns auf anderen Oberflächen können Probleme verursachen.[/color] oarc-mod-faq-what-are-teams=Was sind die verschiedenen Team-Optionen? @@ -298,8 +298,8 @@ oarc-select-surface-label=Oberfläche auswählen: oarc-select-surface-tooltip=Wählen Sie die Oberfläche, die Sie konfigurieren möchten. oarc-revert-button=Zurücksetzen oarc-revert-tooltip=Auf Standard zurücksetzen. -oarc-copy-nauvis-button=Nauvis kopieren -oarc-copy-nauvis-tooltip=Kopiere Nauvis-Einstellungen auf diese Oberfläche. +oarc-copy-nauvis-button=__PLANET__nauvis__ kopieren +oarc-copy-nauvis-tooltip=Kopiere __PLANET__nauvis__-Einstellungen auf diese Oberfläche. oarc-add-item-tooltip=Gegenstand hinzufügen diff --git a/locale/en/locale.cfg b/locale/en/locale.cfg index a354430..dbe6c8e 100644 --- a/locale/en/locale.cfg +++ b/locale/en/locale.cfg @@ -69,8 +69,8 @@ oarc-player-is-joining=__1__ is joining the game on [planet=__2__]! oarc-player-started-own-team=__1__ has started their own team! oarc-player-no-new-teams-sorry=Sorry, no new teams can be created. You were assigned to the default team instead. oarc-no-ungenerated-land-error=[color=red]Failed to find ungenerated land to spawn on! Please try again. If you see this message multiple times, it could be a settings or mod conflict issue.[/color] -oarc-buddies-are-joining=__1__ and __2__ are joining the game together on __3__! -oarc-player-new-secondary=__1__ has started a secondary base on __2__! +oarc-buddies-are-joining=__1__ and __2__ are joining the game together on [planet=__3__]! +oarc-player-new-secondary=__1__ has started a secondary base on [planet=__2__]! oarc-please-wait=PLEASE WAIT WHILE YOUR SPAWN POINT IS GENERATED! oarc-player-left-early=Player (__1__) left the game before __2__ minutes of play time. Their spawn area has been marked for cleanup. @@ -240,7 +240,7 @@ oarc-settings-tab-player-warning=You are not an admin. These settings are read-o oarc-settings-tab-description=This tab contains the same mod settings in the mod settings menu AND some additional settings that can only be changed in game. Check the Surface Settings tab for surface-specific settings. oarc-settings-tab-text-field-enter-tooltip=[color=red]You must press ENTER after typing in a text field to save the value![/color] oarc-settings-tab-title-surface=Enable or Disable Surface Features -oarc-settings-tab-surfaces-warning=Only [planet=nauvis] as primary is recommended! All planets support secondary spawns at this time, but it is still a work in progress. Please don't change these settings if you have already landed on other planets unless you are okay with losing your progress on those planets. +oarc-settings-tab-surfaces-warning=Only [planet=nauvis] __PLANET__nauvis__ as primary is recommended! All planets support secondary spawns at this time, but it is still a work in progress. Please don't change these settings if you have already landed on other planets unless you are okay with losing your progress on those planets. oarc-settings-tab-surface-checkbox-tooltip=Enabling this will allow players to START with custom spawn areas (the main feature of this mod) on this surface. You need at least one of these enabled for the mod to work. oarc-settings-tab-surface-secondary-checkbox-tooltip=Enabling this will give players custom landing areas when they first travel to this surface. This allows players to have separate landing sites. [color=red]This feature is currently a work in progress. If you enable this AFTER landing on a new planet, the next time you travel in a rocket you will be sent to a new spawn![/color] oarc-settings-tab-surface-regrowth-checkbox-tooltip=Enabling this will allow the regrowth and world eater features to work on this surface, if those are enabled. @@ -276,11 +276,11 @@ oarc-shared-chest-helper-txt=This connects to a shared storage chest for all pla oarc-mod-faq-what-is-this-mod=What is this mod? oarc-mod-faq-what-is-this-mod-answer=This mod overhauls multiplayer spawning. Players can create their own spawn points away from the center of the map. Players can also join other players' bases, or create buddy spawns. The mod does not change the core gameplay of Factorio, but it does change the way players start the game. The starting area is a preset area with resources, not a "natural" spawn point. oarc-mod-faq-other-surfaces=Can I start on a different surface/planet? -oarc-mod-faq-other-surfaces-answer=[color=red]I only recommend starting on [planet=nauvis] or a default nauvis-like surface.[/color] The short answer is yes, but the you probably don't want to. There is no simple way to ensure that you can start on other planets without breaking the normal progression and gameplay. There are other mods out there, like Any Planet Start, but I have not tested compatibility yet. +oarc-mod-faq-other-surfaces-answer=[color=red]I only recommend starting on [planet=nauvis] __PLANET__nauvis__ or a __PLANET__nauvis__-like surface.[/color] The short answer is yes, but the you probably don't want to. There is no simple way to ensure that you can start on other planets without breaking the normal progression and gameplay. There are other mods out there, like Any Planet Start, but I have not tested compatibility yet. oarc-mod-faq-secondary-spawns=What are secondary spawns? -oarc-mod-faq-secondary-spawns-answer=If enabled, when a player first travels to a new planet/surface, they will automatically be given a separate landing area based on their primary spawn choice (the first spawn they create). [color=red]This feature is currently a work in progress, but I have now added support for the Space Age planets (fulgora, gleba, vulcanus, and Aquilo).[/color] There are some known issues, such as cargo-pods landing at the center of the map if you don't have a landing pad setup yet (use the /oarc-wheres-my-cargo-pod command to retrieve them). Additionally, Vulcanus doesn't yet provide any API support to modify demolishers or territories, so I have a crude safety mechanism that removes demolishers close to your spawn area. All planets should still be playable, but it's not perfect. Please report issues to me on discord/github. +oarc-mod-faq-secondary-spawns-answer=If enabled, when a player first travels to a new planet/surface, they will automatically be given a separate landing area based on their primary spawn choice (the first spawn they create). [color=red]This feature is currently a work in progress, but I have now added support for the Space Age planets ([planet=fulgora] __PLANET__fulgora__, [planet=gleba] __PLANET__gleba__, [planet=vulcanus] __PLANET__vulcanus__, and [planet=aquilo] __PLANET__aquilo__).[/color] There are some known issues, such as cargo-pods landing at the center of the map if you don't have a landing pad setup yet (use the /oarc-wheres-my-cargo-pod command to retrieve them). Additionally, Vulcanus doesn't yet provide any API support to modify demolishers or territories, so I have a crude safety mechanism that removes demolishers close to your spawn area. All planets should still be playable, but it's not perfect. Please report issues to me on discord/github. oarc-mod-faq-enemy-scaling=How are enemies handled? -oarc-mod-faq-enemy-scaling-answer=Good question! My mod attempts to provide a safe starting area to any player joining the game, or landing on a new planet. The primary way this is done is by removing most of the enemies around new bases. Additionally, areas near to player bases only spawn the easier enemy variants regardless of global evolution setting. On Nauvis, worms are scaled as well so that you won't be surrounded only by behemoth worms if you choose to spawn far from the map center. On Vulcanus, as a temporary workaround until we get a proper API to modify territories, I remove any demolishers that come close to your base. This is a crude solution, but it works for now. I also scale the damage done to spawners based on the evolution factor and distance to the closest spawn point. This helps compensate for the spawner health scaling at a high evolution factor. To tweak the distances, please check the surface settings tab. Each surface has its own settings for the safe, warn, and danger areas around spawn points. +oarc-mod-faq-enemy-scaling-answer=Good question! My mod attempts to provide a safe starting area to any player joining the game, or landing on a new planet. The primary way this is done is by removing most of the enemies around new bases. Additionally, areas near to player bases only spawn the easier enemy variants regardless of global evolution setting. On [planet=nauvis] __PLANET__nauvis__, worms are scaled as well so that you won't be surrounded only by behemoth worms if you choose to spawn far from the map center. On [planet=vulcanus] __PLANET__vulcanus__, as a temporary workaround until we get a proper API to modify territories, I remove any demolishers that come close to your base. This is a crude solution, but it works for now. I also scale the damage done to spawners based on the evolution factor and distance to the closest spawn point. This helps compensate for the spawner health scaling at a high evolution factor. To tweak the distances, please check the surface settings tab. Each surface has its own settings for the safe, warn, and danger areas around spawn points. oarc-mod-faq-what-are-teams=What are the different team options? oarc-mod-faq-what-are-teams-answer=I wrote this mod for co-op play only, not pvp, but you can disable cease fire and friendly teams in the settings. Depending on the mod settings, you can either join the main team, which shares research, or create your own team, which has its own research tree. All teams/forces are friendly to each other and can communicate in chat and (optionally) share map vision. The only reason to create your own team is if you want to have your own research progress. oarc-mod-faq-shared-spawn=What is a shared spawn? @@ -313,8 +313,8 @@ oarc-select-surface-label=Select Surface: oarc-select-surface-tooltip=Select the surface you want to configure. oarc-revert-button=Revert oarc-revert-tooltip=Revert to default. -oarc-copy-nauvis-button=Copy [planet=nauvis] -oarc-copy-nauvis-tooltip=Copy [planet=nauvis] settings to this surface. +oarc-copy-nauvis-button=Copy [planet=nauvis] __PLANET__nauvis__ +oarc-copy-nauvis-tooltip=Copy [planet=nauvis] __PLANET__nauvis__ settings to this surface. oarc-add-item-tooltip=Add Item @@ -395,7 +395,7 @@ oarc-scale-spawner-damage-tooltip=Scales damage done to spawners with evolution oarc-teams-both-disabled-msg=Invalid setting! Both main force and separate teams are disabled! Enabling main force. oarc-spawn-distance-invalid-msg=Invalid setting! Near spawn min distance is greater than or equal to near spawn max distance! oarc-world-eater-invalid-msg=Invalid setting! World eater is enabled but regrowth is not! Disabling world eater. -oarc-default-surface-invalid-msg=Invalid setting! Default surface does not exist! Setting to nauvis. +oarc-default-surface-invalid-msg=Invalid setting! Default surface does not exist! Setting to __PLANET__nauvis__. oarc-research-finished=Team __1__ has finished researching [technology=__2__]! diff --git a/locale/ru/locale.cfg b/locale/ru/locale.cfg index eb385ba..2c0611d 100644 --- a/locale/ru/locale.cfg +++ b/locale/ru/locale.cfg @@ -71,12 +71,12 @@ oarc-buddy-spawn-info=Система приятелей требует, чтоб oarc-max-players-shared-spawn=Вы можете разрешить до __1__ другим игрокам присоединиться к вам. oarc-spawn-dist-notes=Расстояние спауна указано в ЧАНКАХ от центра карты.\nОжидайте сражения, чтобы добраться до других игроков. -oarc-player-is-joining=__1__ присоединяется к игре на __2__! +oarc-player-is-joining=__1__ присоединяется к игре на [planet=__2__]! oarc-player-started-own-team=__1__ создал свою собственную команду! oarc-player-no-new-teams-sorry=Извините, новые команды не могут быть созданы. Вы были назначены в команду по умолчанию. oarc-no-ungenerated-land-error=[color=red]Не удалось найти негенерированную землю для спауна! Пожалуйста, попробуйте снова. Если вы видите это сообщение несколько раз, это может быть проблема с настройками или конфликт модов.[/color] -oarc-buddies-are-joining=__1__ и __2__ присоединяются к игре вместе на __3__! -oarc-player-new-secondary=__1__ создал вторичную базу на __2__! +oarc-buddies-are-joining=__1__ и __2__ присоединяются к игре вместе на [planet=__3__]! +oarc-player-new-secondary=__1__ создал вторичную базу на [planet=__2__]! oarc-please-wait=ПОЖАЛУЙСТА, ПОДОЖДИТЕ, ПОКА ВАША ТОЧКА СПАУНА ГЕНЕРИРУЕТСЯ! oarc-player-left-early=Игрок (__1__) покинул игру до __2__ минут игрового времени. Их область спауна помечена для очистки. @@ -241,7 +241,7 @@ oarc-settings-tab-player-warning=Вы не являетесь администр oarc-settings-tab-description=В этом меню содержатся те же настройки мода, что и в меню настроек мода, а также некоторые дополнительные настройки, которые могут быть изменены только в игре. Проверьте меню настроек поверхности для настроек поверхности. oarc-settings-tab-text-field-enter-tooltip=[color=red]Вы должны нажать ENTER после ввода текста в поле, чтобы сохранить значение![/color] oarc-settings-tab-title-surface=Включение/отключение функций поверхности -oarc-settings-tab-surfaces-warning=В данный момент только Nauvis (как основная) и Fulgora (как вторая) поддерживаются! Не изменяйте эти настройки, если вы уже приземлились на других планетах. +oarc-settings-tab-surfaces-warning=В данный момент только __PLANET__nauvis__ (как основная) и Fulgora (как вторая) поддерживаются! Не изменяйте эти настройки, если вы уже приземлились на других планетах. oarc-settings-tab-surface-checkbox-tooltip=Включение этого параметра позволит игрокам создавать свои собственные области спауна (основная функция мода) на этой поверхности. Вам нужно включить хотя бы один из этих параметров, чтобы мод работал. oarc-settings-tab-surface-secondary-checkbox-tooltip=Включение этого параметра даст игрокам отдельные точки спауна, когда они впервые прибудут на эту поверхность. Это позволяет игрокам иметь отдельные точки спауна. [color=red]В данный момент это функция находится в стадии разработки. Если вы включите это после приземления на новой планете, то при следующем полете на ракете вы будете телепортированы в новую точку спауна![/color] oarc-settings-tab-surface-regrowth-checkbox-tooltip=Включение этого параметра позволит функциям регенерации и поедания мира работать на этой поверхности, если они включены. @@ -276,7 +276,7 @@ oarc-shared-chest-helper-txt=Подключается к общему храни oarc-mod-faq-what-is-this-mod=Что это за мод? oarc-mod-faq-what-is-this-mod-answer=Этот мод полностью изменяет многопользовательский спавн. Игроки могут создавать свои собственные точки спавна вдали от центра карты. Они также могут присоединяться к базам других игроков или создавать спавны с друзьями. Мод не изменяет основную механику игры в Factorio, но изменяет способ старта игры. Стартовая зона - это предустановленная зона с ресурсами, а не "естественная" точка спавна. oarc-mod-faq-other-surfaces=Могу ли я начать на другой поверхности/планете? -oarc-mod-faq-other-surfaces-answer=[color=red]Эта функция в настоящее время в разработке. Поэтому только спавн на "nauvis" или поверхности, похожей на nauvis по умолчанию, будет работать корректно.[/color] +oarc-mod-faq-other-surfaces-answer=[color=red]Эта функция в настоящее время в разработке. Поэтому только спавн на __PLANET__nauvis__ или поверхности, похожей на __PLANET__nauvis__ по умолчанию, будет работать корректно.[/color] oarc-mod-faq-secondary-spawns=Что такое вторичные спавны? oarc-mod-faq-secondary-spawns-answer=Если включено, когда игрок впервые путешествует на новую поверхность, где включен пользовательский спавн, ему автоматически будет предоставлена новая стартовая зона на основе его основного выбора спавна (первая созданная точка спавна). [color=red]Эта функция в настоящее время в разработке. Вторичный спавн на других поверхностях может вызвать проблемы.[/color] oarc-mod-faq-what-are-teams=Какие существуют варианты команд? @@ -311,8 +311,8 @@ oarc-select-surface-label=Выберите Поверхность: oarc-select-surface-tooltip=Выберите поверхность, которую хотите настроить. oarc-revert-button=Вернуть oarc-revert-tooltip=Вернуться к умолчанию. -oarc-copy-nauvis-button=Копировать Nauvis -oarc-copy-nauvis-tooltip=Копировать настройки Nauvis на эту поверхность. +oarc-copy-nauvis-button=Копировать [planet=nauvis] __PLANET__nauvis__ +oarc-copy-nauvis-tooltip=Копировать настройки [planet=nauvis] __PLANET__nauvis__ на эту поверхность. oarc-add-item-tooltip=Добавить Предмет @@ -393,7 +393,7 @@ oarc-scale-spawner-damage-tooltip=Масштабирует урон, нанос oarc-teams-both-disabled-msg=Неверная настройка! Обе основные силы и отдельные команды отключены! Включается основная сила. oarc-spawn-distance-invalid-msg=Неверная настройка! Минимальное расстояние до спавна меньше или равно максимальному расстоянию до спавна! oarc-world-eater-invalid-msg=Неверная настройка! World Eater включен, но регенерация не включена! Отключается World Eater. -oarc-default-surface-invalid-msg=Неверная настройка! Default surface не существует! Устанавливается на nauvis. +oarc-default-surface-invalid-msg=Неверная настройка! Default surface не существует! Устанавливается на __PLANET__nauvis__. oarc-research-finished=Команда __1__ закончила исследования __2__! diff --git a/locale/zh-CN/locale.cfg b/locale/zh-CN/locale.cfg index 51fd96f..a7319ad 100644 --- a/locale/zh-CN/locale.cfg +++ b/locale/zh-CN/locale.cfg @@ -69,8 +69,8 @@ oarc-player-is-joining=__1__ 正在 [planet=__2__] 上加入游戏! oarc-player-started-own-team=__1__ 已经创建了自己的队伍! oarc-player-no-new-teams-sorry=对不起,无法创建新队伍。你已被分配到默认队伍。 oarc-no-ungenerated-land-error=[color=red]未能找到未生成的土地以生成!请再次尝试。如果你多次看到此消息,可能是设置或模组冲突问题。[/color] -oarc-buddies-are-joining=__1__ 和 __2__ 正在 __3__ 上一起加入游戏! -oarc-player-new-secondary=__1__ 已在 __2__ 上创建了一个次级基地! +oarc-buddies-are-joining=__1__ 和 __2__ 正在 [planet=__3__] 上一起加入游戏! +oarc-player-new-secondary=__1__ 已在 [planet=__2__] 上创建了一个次级基地! oarc-please-wait=请稍等,正在生成你的基地! oarc-player-left-early=玩家 (__1__) 在游戏时间不到 __2__ 分钟时离开了游戏。其基地已被标记为清理。 @@ -239,7 +239,7 @@ oarc-settings-tab-player-warning=你不是管理员。这些设置对你来说 oarc-settings-tab-description=此标签包含与模组设置菜单相同的设置,并且还有一些只能在游戏中更改的附加设置。检查空间(星球)配置标签以获取特定于空间(星球)的设置。 oarc-settings-tab-text-field-enter-tooltip=[color=red]输入文本字段后,必须按 ENTER 键才能保存值![/color] oarc-settings-tab-title-surface=空间(星球)设置 -oarc-settings-tab-surfaces-warning=推荐将[planet=nauvis]作为主基地星球!目前所有行星都支持副基地,但这仍在开发中。如果您已经登陆其他行星,请勿更改这些设置,除非您不介意失去在这些行星上的进度。 +oarc-settings-tab-surfaces-warning=推荐将[planet=nauvis]__PLANET__nauvis__作为主基地星球!目前所有行星都支持副基地,但这仍在开发中。如果您已经登陆其他行星,请勿更改这些设置,除非您不介意失去在这些行星上的进度。 oarc-settings-tab-surface-checkbox-tooltip=启用此选项将允许在此空间(星球)上自定义基地(该模组的主要功能)。你需要至少启用一个空间(星球)以便模组工作。 oarc-settings-tab-surface-secondary-checkbox-tooltip=启用此选项将允许玩家首次前往此空间(星球)时获得自定义着陆区域(次要基地)。 这允许玩家拥有独立的着陆点。[color=red]如果你在登陆新行星后启用此功能,下次乘坐火箭旅行时,你将被发送到一个新的基地![/color] oarc-settings-tab-surface-regrowth-checkbox-tooltip=启用此选项将允许在此空间(星球)上使用再生和世界吞噬者功能(如果启用了这些功能)。 @@ -275,7 +275,7 @@ oarc-shared-chest-helper-txt=这连接到所有玩家共享的存储箱。 oarc-mod-faq-what-is-this-mod=这是什么模组? oarc-mod-faq-what-is-this-mod-answer=此模组彻底改革了多人生成。玩家可以在远离地图中心的地方创建自己的基地。玩家还可以加入其他玩家的基地,或者创建伙伴生成。该模组不会改变 Factorio 的核心玩法,但它确实改变了玩家开始游戏的方式。基地是一个预设的资源区域,而不是一个“自然”的基地。 oarc-mod-faq-other-surfaces=我可以从不同的空间/星球开始吗? -oarc-mod-faq-other-surfaces-answer=[color=red]推荐在[planet=nauvis]或类似[planet=nauvis]的默认空间(星球)上开始游戏。[/color]简短的回答是可以,但你可能并不想这样做。没有简单的方法可以确保你能在其他行星上开始游戏而不破坏正常的游戏进程和玩法。还有其他一些模组,比如“任意行星开局”(Any Planet Start),但我尚未测试过兼容性。 +oarc-mod-faq-other-surfaces-answer=[color=red]推荐在[planet=nauvis]__PLANET__nauvis__或类似__PLANET__nauvis__的默认空间(星球)上开始游戏。[/color]简短的回答是可以,但你可能并不想这样做。没有简单的方法可以确保你能在其他行星上开始游戏而不破坏正常的游戏进程和玩法。还有其他一些模组,比如“任意行星开局”(Any Planet Start),但我尚未测试过兼容性。 oarc-mod-faq-secondary-spawns=什么是副基地? oarc-mod-faq-secondary-spawns-answer=如果启用,当玩家首次前往具有自定义生成的新空间(星球)时,他们会自动获得一个新的基地,基于他们的主要生成选择(第一次创建的基地)。[color=red]此功能目前处于开发中。在其他空间(星球)上进行次要生成可能会导致问题。[/color] oarc-mod-faq-enemy-scaling=敌人是如何处理的? @@ -312,8 +312,8 @@ oarc-select-surface-label=选择星球: oarc-select-surface-tooltip=选择您要配置的星球。 oarc-revert-button=还原 oarc-revert-tooltip=还原为默认设置。 -oarc-copy-nauvis-button=复制[planet=nauvis]设置 -oarc-copy-nauvis-tooltip=将[planet=nauvis]的设置复制到此表面。 +oarc-copy-nauvis-button=复制[planet=nauvis]__PLANET__nauvis__设置 +oarc-copy-nauvis-tooltip=将[planet=nauvis]__PLANET__nauvis__的设置复制到此表面。 oarc-add-item-tooltip=添加物品 @@ -394,7 +394,7 @@ oarc-scale-spawner-damage-tooltip=根据进化因子和距离最近出生点的 oarc-teams-both-disabled-msg=设置无效!主队伍和独立队伍都被禁用!启用主队伍。 oarc-spawn-distance-invalid-msg=设置无效!近距离出生点的最小距离大于或等于最大距离! oarc-world-eater-invalid-msg=设置无效!世界吞噬者已启用但重生功能未启用!禁用世界吞噬者。 -oarc-default-surface-invalid-msg=设置无效!默认地表不存在!设置为 nauvis。 +oarc-default-surface-invalid-msg=设置无效!默认地表不存在!设置为 __PLANET__nauvis__ oarc-research-finished=__1__队已完成研究 [technology=__2__] From e18bd34d52b9b9f4f962010aa9a6bb0b3b4e1b44 Mon Sep 17 00:00:00 2001 From: PennyJim <40438818+PennyJim@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:43:38 -0700 Subject: [PATCH 4/6] Add Better Chatting compatibility (#252) * Add CompatSend * Replace all other prints with CompatSend I used the regex `(\w+)\.print\(` and replaced it with `CompatSend($1, ` Was really easy. --- lib/gui_tabs/item_shop.lua | 2 +- lib/gui_tabs/player_list.lua | 4 +-- lib/gui_tabs/settings_controls.lua | 4 +-- lib/gui_tabs/spawn_controls.lua | 22 ++++++------- lib/gui_tabs/surface_config.lua | 22 ++++++------- lib/oarc_tests.lua | 12 +++---- lib/oarc_utils.lua | 51 +++++++++++++++++++++++++++--- lib/separate_spawns.lua | 6 ++-- lib/separate_spawns_guis.lua | 20 ++++++------ 9 files changed, 93 insertions(+), 50 deletions(-) diff --git a/lib/gui_tabs/item_shop.lua b/lib/gui_tabs/item_shop.lua index 537cbbb..58234c0 100644 --- a/lib/gui_tabs/item_shop.lua +++ b/lib/gui_tabs/item_shop.lua @@ -102,7 +102,7 @@ function OarcItemShopGuiClick(event) button.parent.parent.player_store_wallet_lbl.caption = { "oarc-coins-available", wallet } end else - player.print({ "oarc-broke-message" }) + CompatSend(player, { "oarc-broke-message" }) end end end diff --git a/lib/gui_tabs/player_list.lua b/lib/gui_tabs/player_list.lua index 5ef5028..79d9072 100644 --- a/lib/gui_tabs/player_list.lua +++ b/lib/gui_tabs/player_list.lua @@ -148,7 +148,7 @@ function PlayerListTabGuiClick(event) local target_player = game.players[player_name] if (target_player == nil) then - player.print({"oarc-player-not-found", player_name}) + CompatSend(player, {"oarc-player-not-found", player_name}) return end @@ -161,6 +161,6 @@ function PlayerListTabGuiClick(event) surface = target_player.surface end player.set_controller{type = defines.controllers.remote, position = position, surface = surface} - player.print({"", target_player.name, ": ", GetGPStext(surface.name, position)}) + CompatSend(player, {"", target_player.name, ": ", GetGPStext(surface.name, position)}) end end \ No newline at end of file diff --git a/lib/gui_tabs/settings_controls.lua b/lib/gui_tabs/settings_controls.lua index 6dc802c..51601a6 100644 --- a/lib/gui_tabs/settings_controls.lua +++ b/lib/gui_tabs/settings_controls.lua @@ -590,13 +590,13 @@ function SettingsSurfaceControlsTabGuiClick(event) local ok, copy = serpent.load(import_text) if (not ok) or (type(copy) ~= "table") or (next(copy) == nil) then log("Error importing settings!") - player.print("Error importing settings!") + CompatSend(player, "Error importing settings!") else storage.ocfg = table.deepcopy(copy) ValidateSettings() -- Some basic validation, not 100% foolproof SyncModSettingsToOCFG() -- Sync the mod settings. log("Imported settings!") - player.print("Imported settings!") + CompatSend(player, "Imported settings!") OarcGuiRefreshContent(player) end end diff --git a/lib/gui_tabs/spawn_controls.lua b/lib/gui_tabs/spawn_controls.lua index da27653..7732d1b 100644 --- a/lib/gui_tabs/spawn_controls.lua +++ b/lib/gui_tabs/spawn_controls.lua @@ -408,26 +408,26 @@ function SpawnCtrlTabGuiClick(event) -- Check if player has a valid character if (player.character == nil) then - player.print({ "oarc-no-valid-player-character" }) + CompatSend(player, { "oarc-no-valid-player-character" }) return end -- Check if player is in a vehicle if player.driving then - player.print({ "oarc-player-character-in-vehicle" }) + CompatSend(player, { "oarc-player-character-in-vehicle" }) return end -- Check if the surface is blacklisted local surface_name = player.character.surface.name if IsSurfaceBlacklisted(surface_name) then - player.print({"oarc-no-respawn-this-surface"}) + CompatSend(player, {"oarc-no-respawn-this-surface"}) return end SetPlayerRespawn(player.name, surface_name, player.character.position, true) OarcGuiRefreshContent(player) - player.print({ "oarc-spawn-point-updated" }) + CompatSend(player, { "oarc-spawn-point-updated" }) -- Shows the spawn location on the map elseif (tags.setting == "show_location") then @@ -435,7 +435,7 @@ function SpawnCtrlTabGuiClick(event) local position = tags.position --[[@as MapPosition]] player.set_controller{type = defines.controllers.remote, position = position, surface = surface_name} - player.print({"", { "oarc-spawn-gps-location" }, " ", GetGPStext(surface_name, position)}) + CompatSend(player, {"", { "oarc-spawn-gps-location" }, " ", GetGPStext(surface_name, position)}) -- Teleports the player to their home base elseif (tags.setting == "teleport_home") then @@ -444,13 +444,13 @@ function SpawnCtrlTabGuiClick(event) -- Check if player has a valid character if (player.character == nil) then - player.print({ "oarc-no-valid-player-character" }) + CompatSend(player, { "oarc-no-valid-player-character" }) return end -- Check if player is in a vehicle if player.driving then - player.print({ "oarc-player-character-in-vehicle" }) + CompatSend(player, { "oarc-player-character-in-vehicle" }) return end @@ -478,7 +478,7 @@ function SpawnCtrlTabGuiClick(event) if ((event.element.parent.join_queue_dropdown == nil) or (event.element.parent.join_queue_dropdown.selected_index == 0)) then - player.print({ "oarc-selected-player-not-valid" }) + CompatSend(player, { "oarc-selected-player-not-valid" }) OarcGuiRefreshContent(player) return end @@ -488,7 +488,7 @@ function SpawnCtrlTabGuiClick(event) -- Shouldn't be able to hit this since we force a GUI refresh when they leave? if ((game.players[join_queue_player_choice] == nil) or (not game.players[join_queue_player_choice].connected)) then - player.print({ "oarc-selected-player-not-wait" }) + CompatSend(player, { "oarc-selected-player-not-wait" }) OarcGuiRefreshContent(player) return end @@ -500,7 +500,7 @@ function SpawnCtrlTabGuiClick(event) RemovePlayerFromJoinQueue(join_queue_player_choice) -- This also refreshes the host gui -- Inform the host that the player was rejected - player.print({ "oarc-reject-joiner", join_queue_player_choice }) + CompatSend(player, { "oarc-reject-joiner", join_queue_player_choice }) -- Inform the player that their request was rejected SendMsg(join_queue_player_choice, { "oarc-your-request-rejected" }) @@ -514,7 +514,7 @@ function SpawnCtrlTabGuiClick(event) -- Check if there is space first if (table_size(primary_spawn.joiners) >= storage.ocfg.gameplay.number_of_players_per_shared_spawn - 1) then - player.print({ "oarc-shared-spawn-full" }) + CompatSend(player, { "oarc-shared-spawn-full" }) return end diff --git a/lib/gui_tabs/surface_config.lua b/lib/gui_tabs/surface_config.lua index 6ffd825..7b005b5 100644 --- a/lib/gui_tabs/surface_config.lua +++ b/lib/gui_tabs/surface_config.lua @@ -733,7 +733,7 @@ function SurfaceConfigTabGuiConfirmed(event) -- Check if an item is selected first. if (tags.item_name == "") then - player.print("Please select an item first!") + CompatSend(player, "Please select an item first!") event.element.text = "0" return end @@ -754,7 +754,7 @@ function SurfaceConfigTabGuiConfirmed(event) -- Check if an item is selected first. if (tags.resource_name == "") then - player.print("Please select a resource first!") + CompatSend(player, "Please select a resource first!") event.element.text = "0" return end @@ -780,7 +780,7 @@ function SurfaceConfigTabGuiConfirmed(event) -- Check if an item is selected first. if (tags.resource_name == "") then - player.print("Please select a resource first!") + CompatSend(player, "Please select a resource first!") event.element.text = "0" return end @@ -844,7 +844,7 @@ function SurfaceConfigTabGuiElemChanged(event) local setting_name = parent.tags.setting --[[@as string]] if (storage.ocfg.surfaces_config[surface_name].starting_items[setting_name][new_item_name]) then - player.print("Item already exists in list! " .. new_item_name) + CompatSend(player, "Item already exists in list! " .. new_item_name) event.element.elem_value = nil return end @@ -874,7 +874,7 @@ function SurfaceConfigTabGuiElemChanged(event) end if (prototypes.entity[new_resource_name].resource_category ~= "basic-solid") then - player.print("Resource must be a solid resource! " .. new_resource_name) + CompatSend(player, "Resource must be a solid resource! " .. new_resource_name) event.element.elem_value = nil return end @@ -892,7 +892,7 @@ function SurfaceConfigTabGuiElemChanged(event) local setting_name = parent.tags.setting --[[@as string]] if (storage.ocfg.surfaces_config[surface_name].spawn_config[setting_name][new_resource_name]) then - player.print("Resource already exists in list! " .. new_resource_name) + CompatSend(player, "Resource already exists in list! " .. new_resource_name) event.element.elem_value = nil return end @@ -922,7 +922,7 @@ function SurfaceConfigTabGuiElemChanged(event) end if (prototypes.entity[new_resource_name].resource_category ~= "basic-fluid") then - player.print("Resource must be a fluid resource! " .. new_resource_name) + CompatSend(player, "Resource must be a fluid resource! " .. new_resource_name) event.element.elem_value = nil return end @@ -940,7 +940,7 @@ function SurfaceConfigTabGuiElemChanged(event) local setting_name = parent.tags.setting --[[@as string]] if (storage.ocfg.surfaces_config[surface_name].spawn_config[setting_name][new_resource_name]) then - player.print("Resource already exists in list! " .. new_resource_name) + CompatSend(player, "Resource already exists in list! " .. new_resource_name) event.element.elem_value = nil return end @@ -1030,7 +1030,7 @@ function SurfaceConfigTabGuiClick(event) local surface_name = event.element.parent["surface_dropdown"].items[event.element.parent["surface_dropdown"].selected_index] --[[@as string]] - player.print("Revert to default: " .. surface_name) + CompatSend(player, "Revert to default: " .. surface_name) storage.ocfg.surfaces_config[surface_name].starting_items = table.deepcopy(NAUVIS_STARTER_ITEMS) storage.ocfg.surfaces_config[surface_name].spawn_config = table.deepcopy(NAUVIS_SPAWN_CONFIG) @@ -1047,11 +1047,11 @@ function SurfaceConfigTabGuiClick(event) local surface_name = event.element.parent["surface_dropdown"].items[event.element.parent["surface_dropdown"].selected_index] --[[@as string]] if (surface_name == "nauvis") then - player.print("Already on nauvis, select a different surface to copy nauvis settings to!") + CompatSend(player, "Already on nauvis, select a different surface to copy nauvis settings to!") return end - player.print("Copy nauvis to " .. surface_name) + CompatSend(player, "Copy nauvis to " .. surface_name) storage.ocfg.surfaces_config[surface_name].starting_items = storage.ocfg.surfaces_config["nauvis"].starting_items storage.ocfg.surfaces_config[surface_name].spawn_config = storage.ocfg.surfaces_config["nauvis"].spawn_config diff --git a/lib/oarc_tests.lua b/lib/oarc_tests.lua index 8735e49..bffd88f 100644 --- a/lib/oarc_tests.lua +++ b/lib/oarc_tests.lua @@ -210,7 +210,7 @@ end function DudeWheresMyCargoPod(player) if not player.character then - player.print({ "oarc-character-invalid" }) + CompatSend(player, { "oarc-character-invalid" }) return end @@ -221,7 +221,7 @@ function DudeWheresMyCargoPod(player) local pods = surface.find_entities_filtered{area=search_area, name="cargo-pod-container", force=player.force} if #pods == 0 then - player.print({ "oarc-no-cargo-pods" }) + CompatSend(player, { "oarc-no-cargo-pods" }) return end @@ -230,12 +230,12 @@ function DudeWheresMyCargoPod(player) local new_position = surface.find_non_colliding_position("cargo-pod-container", player.character.position, CHUNK_SIZE, 1) if new_position == nil then - player.print({ "oarc-teleport-cargo-pod-fail" }) + CompatSend(player, { "oarc-teleport-cargo-pod-fail" }) return end cargo_pod.teleport(new_position) - player.print({ "oarc-teleport-cargo-pod-success" }) + CompatSend(player, { "oarc-teleport-cargo-pod-success" }) end end @@ -261,7 +261,7 @@ function RerollSpawn(player) -- If it is a buddy spawn, tell them we don't support this: if (spawn_choices.buddy ~= nil) then - player.print({ "oarc-no-reroll-buddy-spawn" }) + CompatSend(player, { "oarc-no-reroll-buddy-spawn" }) return end @@ -281,7 +281,7 @@ function RerollSpawn(player) local spawn_position = FindUngeneratedCoordinates(surface_name, spawn_choices.distance, 3) -- If that fails, just throw a warning and don't spawn them. They can try again. if ((spawn_position.x == 0) and (spawn_position.y == 0)) then - player.print({ "oarc-no-ungenerated-land-error" }) + CompatSend(player, { "oarc-no-ungenerated-land-error" }) return end diff --git a/lib/oarc_utils.lua b/lib/oarc_utils.lua index be572ab..b6b2098 100644 --- a/lib/oarc_utils.lua +++ b/lib/oarc_utils.lua @@ -95,12 +95,54 @@ function FadeoutRenderOnTick() end end +---@type boolean? +local has_better_chat = nil +--- Safely attempts to print via the Better Chatting's interface +---@param recipient LuaGameScript|LuaForce|LuaPlayer +---@param msg LocalisedString +---@param print_settings PrintSettings? +function CompatSend(recipient, msg, print_settings) + if has_better_chat == nil then + local better_chat = remote.interfaces["better-chat"] + has_better_chat = better_chat and better_chat["send"] + end + + if not has_better_chat then return recipient.print(msg, print_settings) end + print_settings = print_settings or {} + + + ---@type "global"|"force"|"player", int? + local send_level, send_index + local recipient_type = recipient.object_name + + if recipient_type == "LuaGameScript" then + send_level = "global" + else + ---@cast recipient -LuaGameScript + send_index = recipient.index + if recipient_type == "LuaForce" then + send_level = "force" + elseif recipient_type == "LuaPlayer" then + send_level = "player" + else + error("Invalid Recipient", 2) + end + end + + remote.call("better-chat", "send", { + message = msg, + send_level = send_level, + color = print_settings.color, + recipient = send_index, + }) +end + --- Broadcast messages to all connected players ---@param msg LocalisedString ---@return nil function SendBroadcastMsg(msg) for name, player in pairs(game.connected_players) do - player.print(msg) + CompatSend(player, msg) end end @@ -109,8 +151,9 @@ end ---@param msg LocalisedString ---@return nil function SendMsg(playerName, msg) - if ((game.players[playerName] ~= nil) and (game.players[playerName].connected)) then - game.players[playerName].print(msg) + local player = game.players[playerName] + if ((player ~= nil) and (player.connected)) then + CompatSend(player, msg) end end @@ -411,7 +454,7 @@ function ShareChatBetweenForces(player, msg) (force.name ~= "neutral") and (force.name ~= "player") and (force ~= player.force)) then - force.print(player.name..": "..msg) + CompatSend(force, {"", player.name, ": ", msg}) end end end diff --git a/lib/separate_spawns.lua b/lib/separate_spawns.lua index 42b6956..9fe5083 100644 --- a/lib/separate_spawns.lua +++ b/lib/separate_spawns.lua @@ -1622,7 +1622,7 @@ function SecondarySpawn(player, surface_name) local spawn_position = FindUngeneratedCoordinates(surface_name, spawn_choices.distance, 3) -- If that fails, just throw a warning and don't spawn them. They can try again. if ((spawn_position.x == 0) and (spawn_position.y == 0)) then - player.print({ "oarc-no-ungenerated-land-error" }) + CompatSend(player, { "oarc-no-ungenerated-land-error" }) return end @@ -1651,7 +1651,7 @@ function SecondarySpawn(player, surface_name) SendBroadcastMsg({"", { "oarc-player-new-secondary", player_name, surface_name }, " ", GetGPStext(surface_name, spawn_position)}) -- Tell the player about the reroll command: - player.print({ "oarc-reroll-spawn-command" }) + CompatSend(player, { "oarc-reroll-spawn-command" }) end -- Check a table to see if there are any players waiting to spawn @@ -1787,7 +1787,7 @@ function CreatePlayerCustomForce(player) if (newForce.name == player.name) then SendBroadcastMsg({ "oarc-player-started-own-team", player.name }) else - player.print({ "oarc-player-no-new-teams-sorry" }) + CompatSend(player, { "oarc-player-no-new-teams-sorry" }) end return newForce diff --git a/lib/separate_spawns_guis.lua b/lib/separate_spawns_guis.lua index 203e2e0..abd9be9 100644 --- a/lib/separate_spawns_guis.lua +++ b/lib/separate_spawns_guis.lua @@ -704,11 +704,11 @@ end ---@return nil function RequestBuddySpawn(player) local buddy_choice = storage.spawn_choices[player.name].buddy - if (buddy_choice == nil) then player.print({ "oarc-invalid-buddy" }) return end + if (buddy_choice == nil) then CompatSend(player, { "oarc-invalid-buddy" }) return end local buddy = game.players[buddy_choice] - if (buddy == nil) then player.print({ "oarc-invalid-buddy" }) return end + if (buddy == nil) then CompatSend(player, { "oarc-invalid-buddy" }) return end -- Confirm the buddy is still in the spawn menu! - if (buddy.gui.screen.spawn_opts == nil) then player.print({ "oarc-invalid-buddy", buddy.name }) return end + if (buddy.gui.screen.spawn_opts == nil) then CompatSend(player, { "oarc-invalid-buddy", buddy.name }) return end DisplayBuddySpawnWaitMenu(player) DisplayBuddySpawnRequestMenu(buddy, player.name) @@ -736,7 +736,7 @@ function CancelBuddySpawnWaitMenu(player) DisplaySpawnOptions(buddy) end - buddy.print({ "oarc-buddy-cancel-request", player.name }) + CompatSend(buddy, { "oarc-buddy-cancel-request", player.name }) end ---Request to join someone's shared spawn @@ -749,7 +749,7 @@ function RequestToJoinSharedSpawn(player) end local host_name = storage.spawn_choices[player.name].host_name - if (host_name == nil) then player.print({ "oarc-no-shared-spawn-selected" }) return end + if (host_name == nil) then CompatSend(player, { "oarc-no-shared-spawn-selected" }) return end -- Clear the spawn options gui if (player.gui.screen.spawn_opts ~= nil) then @@ -767,7 +767,7 @@ function RequestToJoinSharedSpawn(player) game.players[host_name].print({ "oarc-player-requesting-join-you", player.name }) OarcGuiRefreshContent(game.players[host_name]) else - player.print({ "oarc-invalid-host-shared-spawn" }) + CompatSend(player, { "oarc-invalid-host-shared-spawn" }) DisplaySpawnOptions(player) end @@ -865,7 +865,7 @@ function SharedSpawnSelect(gui_element, player) button.caption = { "oarc-join-shared-button-enable", host_name, primary_spawn.surface_name } button.style = "green_button" else - player.print({ "oarc-invalid-host-shared-spawn" }) + CompatSend(player, { "oarc-invalid-host-shared-spawn" }) storage.spawn_choices[player.name].host_name = nil gui_element.selected_index = 0 button.enabled = false @@ -896,7 +896,7 @@ function PrimarySpawnRequest(player) -- If that fails, just throw a warning and don't spawn them. They can try again. if ((spawn_position.x == 0) and (spawn_position.y == 0)) then - player.print({ "oarc-no-ungenerated-land-error" }) + CompatSend(player, { "oarc-no-ungenerated-land-error" }) return end @@ -1146,7 +1146,7 @@ function AcceptBuddyRequest(player, requesting_buddy_name) -- If that fails, just throw a warning and don't spawn them. They can try again. if ((spawn_position.x == 0) and (spawn_position.y == 0)) then - player.print({ "oarc-no-ungenerated-land-error" }) + CompatSend(player, { "oarc-no-ungenerated-land-error" }) return end @@ -1212,7 +1212,7 @@ function RejectBuddyRequest(player, requesting_buddy_name) DisplaySpawnOptions(requester_buddy) end - requester_buddy.print({ "oarc-buddy-declined", player.name }) + CompatSend(requester_buddy, { "oarc-buddy-declined", player.name }) end ---Display the please wait dialog From c0d5538041b4815b0f7dc5522c27be7c88f8f1f8 Mon Sep 17 00:00:00 2001 From: Oarcinae Date: Thu, 21 Nov 2024 19:57:39 -0500 Subject: [PATCH 5/6] Update changelog. --- changelog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index ced2f53..38ac25d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,9 +2,10 @@ Version: 2.1.14 Date: 2024-11-21 Info: - - Update CN locale. (thanks plexpt!) + - Update CN locale. (Thanks plexpt!) - Many non-localized planet names localized and started using the icons where possible too. - Make use of new set_driving() function. Won't affect gameplay, but I no longer have to do an extra teleport as a workaround. + - Add mod compatibility for "Better Chatting" mod. (Thanks PennyJim!) --------------------------------------------------------------------------------------------------- Version: 2.1.13 Date: 2024-11-20 From f453597d351f0ad61e84bbd7d1ae231498a303e8 Mon Sep 17 00:00:00 2001 From: Oarcinae Date: Thu, 21 Nov 2024 19:58:54 -0500 Subject: [PATCH 6/6] Add better-chat compatibility to info.json --- info.json | 1 + 1 file changed, 1 insertion(+) diff --git a/info.json b/info.json index 7ab1e01..461dcaa 100644 --- a/info.json +++ b/info.json @@ -18,6 +18,7 @@ "(?) helmod", "(?) blueprint-sandboxes", "(?) factorissimo-2-notnotmelon", + "(?) better-chat", "! rso-mod" ] }