为 azerothcore docker build 设置 lua_scripts 目录

问题描述 投票:0回答:3

我正在运行 AzerothCore 服务器以通过 LAN 进行个人访问。我按照官方网站上提供的设置在docker上运行服务器。我还设法通过 AzerothCore GitHub 上提供的 module 附加 Eluna lua enging。

我可以看到 Eluna 已通过世界服务器成功编译,因为我在调用

docker-compose up
后收到此消息:

ac-worldserver_1  | [Eluna]: Executed 0 Lua scripts in 0 ms

我通过客户端登录并正常播放也没有问题。

现在,我遇到的问题是我似乎找不到放置我的 lua 脚本的位置以便服务器使用它们。深入挖掘配置文件,我在

azerothcore-wotlk/modules/mod-eluna-lua-engine/conf/mod_LuaEngine.conf.dist
中找到了这个参数:

Eluna.ScriptPath = "lua_scripts"

这个常量被加载到主

LuaEngine.cpp
文件中,所以我确信这是要查找的正确位置。但是,整个存储库(包括附加模块)中没有
lua_scripts
目录。我尝试将它(和基本的
hello_world.lua
脚本)放在多个子目录中,但无济于事。我认为由于使用了 docker,可能会在存储库之外找到它,因此我运行了
sudo find / | grep lua_scripts
,并在这个非常难以访问的位置找到了该文件夹的副本:

/var/snap/docker/common/var-lib-docker/overlay2/3d7f9d1de6602baf9a33ee24333ecdf01d537c2b7b439e90d645ff9643bfdd07/diff/azeroth-server/bin/lua_scripts

显然这只能通过

sudo
访问,并且我无法轻松地使用此位置进行开发。

作为最后的手段,我尝试将

Eluna.ScriptPath
常量更改为存储库中的绝对路径,但这也不成功。未加载脚本,登录时没有 hello world。有人知道我可以在哪里查看或放置目录吗?

供参考,

hello_world.lua

local PLAYER_EVENT_ON_LOGIN = 3

local function OnLogin(event, player)
    player:SendBroadcastMessage("Hello world")
end

RegisterPlayerEvent(PLAYER_EVENT_ON_LOGIN, OnLogin)
docker-compose lua azerothcore eluna-lua-engine
3个回答
2
投票

我通过添加

 绑定 
lua_scripts
 中的 
docker-compose.yml

文件夹来修复此问题
  - type: bind
    source: ./docker/worldserver/bin/lua_scripts
    target: /azeroth-server/bin/lua_scripts

volumes
docker-compose.yml
部分。我把它放在
worldserver/bin
绑定的正下方。

然后在

docker/worldserver/etc/mod_LuaEngine.conf
中设置
Eluna.ScriptPath = "/azeroth-server/bin/lua_scripts"
并将脚本放入
docker/worldserver/bin/lua_scripts
中。


0
投票

自从 docker-compose 返工(提交 380f406248bdc1f15227a7b2f8a75b4bf922f730)以来,您应该能够更新您的

mod_LuaEngine.conf
文件以包括:

Eluna.ScriptPath = "/azerothcore/lua_scripts"

并在您的基本目录中创建一个

lua_scripts
文件夹(例如,可以找到 docker.compose.yml 和
apps/
文件夹)。


0
投票

为此提出了另一个问题,can't get eluna-scripts to run on azerothcore docker。但该问题被标记为重复。

尝试过这些解决方案,但没有成功。

Armin 的解决方案可能不起作用,因为该文件中的语法从那时起已经发生了变化。

suprsokr的解决方案也不起作用。

© www.soinside.com 2019 - 2024. All rights reserved.