summaryrefslogtreecommitdiff
path: root/server-beta/src
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/src')
-rw-r--r--server-beta/src/boss.lua (renamed from server-beta/src/pub/client.lua)14
-rw-r--r--server-beta/src/brave/brave.lua (renamed from server-beta/src/pub/brave.lua)2
-rw-r--r--server-beta/src/brave/init.lua (renamed from server-beta/src/work/init.lua)4
-rw-r--r--server-beta/src/brave/log.lua (renamed from server-beta/src/work/log.lua)2
-rw-r--r--server-beta/src/service.lua10
5 files changed, 16 insertions, 16 deletions
diff --git a/server-beta/src/pub/client.lua b/server-beta/src/boss.lua
index c08068ba..d9c87f70 100644
--- a/server-beta/src/pub/client.lua
+++ b/server-beta/src/boss.lua
@@ -9,16 +9,14 @@ local braveTemplate = [[
package.path = %q
package.cpath = %q
-log = require 'work.log'
-require 'work'
-
-local brave = require 'pub.brave'
+log = require 'brave.log'
+local brave = require 'brave'
brave.register(%d)
]]
----@class pub_client
+---@class boss
local m = {}
-m.type = 'pub.client'
+m.type = 'boss'
m.braves = {}
--- 招募勇者,勇者会从公告板上领取任务,完成任务后到看板娘处交付任务
@@ -94,9 +92,9 @@ function m.recieve()
goto CONTINUE
end
if type(id) == 'string' then
- m.popTask(brave, id, result)
- else
m.popReport(brave, id, result)
+ else
+ m.popTask(brave, id, result)
end
task.sleep(0)
::CONTINUE::
diff --git a/server-beta/src/pub/brave.lua b/server-beta/src/brave/brave.lua
index 9ee3dba4..bf6cb559 100644
--- a/server-beta/src/pub/brave.lua
+++ b/server-beta/src/brave/brave.lua
@@ -2,7 +2,7 @@ local thread = require 'bee.thread'
---@class pub_brave
local m = {}
-m.type = 'pub.brave'
+m.type = 'brave'
m.ability = {}
--- 注册成为勇者
diff --git a/server-beta/src/work/init.lua b/server-beta/src/brave/init.lua
index b77b970c..39b66bac 100644
--- a/server-beta/src/work/init.lua
+++ b/server-beta/src/brave/init.lua
@@ -1,4 +1,4 @@
-local brave = require 'pub.brave'
+local brave = require 'brave.brave'
local jsonrpc = require 'jsonrpc'
brave.on('loadProto', function ()
@@ -9,3 +9,5 @@ brave.on('loadProto', function ()
end
end
end)
+
+return brave
diff --git a/server-beta/src/work/log.lua b/server-beta/src/brave/log.lua
index 4059b461..d86be162 100644
--- a/server-beta/src/work/log.lua
+++ b/server-beta/src/brave/log.lua
@@ -1,4 +1,4 @@
-local brave = require 'pub.brave'
+local brave = require 'brave'
local tablePack = table.pack
local tostring = tostring
diff --git a/server-beta/src/service.lua b/server-beta/src/service.lua
index bd217627..122917fa 100644
--- a/server-beta/src/service.lua
+++ b/server-beta/src/service.lua
@@ -1,4 +1,4 @@
-local client = require 'pub.client'
+local boss = require 'boss'
local subprocess = require 'bee.subprocess'
local thread = require 'bee.thread'
local task = require 'task'
@@ -15,7 +15,7 @@ function m.listenProto()
io.stdout:setvbuf 'no'
task.create(function ()
while true do
- local proto = client.task('loadProto')
+ local proto = boss.task('loadProto')
log.debug('proto:', utility.dump(proto))
end
end)
@@ -24,8 +24,8 @@ end
function m.listenPub()
task.create(function ()
while true do
- client.checkDead()
- client.recieve()
+ boss.checkDead()
+ boss.recieve()
task.sleep(0)
end
end)
@@ -43,7 +43,7 @@ function m.startTimer()
end
function m.start()
- client.recruitBraves(4)
+ boss.recruitBraves(4)
task.setErrorHandle(log.error)
m.listenProto()
m.listenPub()