新增单进程模式
This commit is contained in:
1 parent
669a524153
commit
6136e57919
73 files changed
+1900
-153
No files matched your search
+11
-7
@@ -27,9 +27,7 @@ var APPID string
|
||||
var APPVERSION string
|
||||
var GSID uint32
|
||||
|
||||
func Run(ctx context.Context, configFile string) error {
|
||||
config.InitConfig(configFile)
|
||||
|
||||
func Run(ctx context.Context) error {
|
||||
// natsrpc client
|
||||
discoveryClient, err := rpc.NewDiscoveryClient()
|
||||
if err != nil {
|
||||
@@ -67,10 +65,15 @@ func Run(ctx context.Context, configFile string) error {
|
||||
})
|
||||
}()
|
||||
|
||||
logger.InitLogger("gs_" + strconv.Itoa(int(GSID)) + "_" + APPID)
|
||||
if !config.GetConfig().Hk4e.StandaloneModeEnable {
|
||||
logger.InitLogger("gs_" + strconv.Itoa(int(GSID)) + "_" + APPID)
|
||||
defer func() {
|
||||
logger.CloseLogger()
|
||||
}()
|
||||
}
|
||||
logger.Warn("gs start, appid: %v, gsid: %v", APPID, GSID)
|
||||
defer func() {
|
||||
logger.CloseLogger()
|
||||
logger.Warn("gs exit, appid: %v", APPID)
|
||||
}()
|
||||
|
||||
gdconf.InitGameDataConfig()
|
||||
@@ -101,7 +104,9 @@ func Run(ctx context.Context, configFile string) error {
|
||||
defer s.Close()
|
||||
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
||||
if !config.GetConfig().Hk4e.StandaloneModeEnable {
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
@@ -110,7 +115,6 @@ func Run(ctx context.Context, configFile string) error {
|
||||
logger.Warn("get a signal %s", s.String())
|
||||
switch s {
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
|
||||
logger.Warn("gs exit, appid: %v", APPID)
|
||||
return nil
|
||||
case syscall.SIGHUP:
|
||||
default:
|
||||
|
||||
+2
-1
@@ -2,9 +2,10 @@ package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"hk4e/common/config"
|
||||
"hk4e/pkg/logger"
|
||||
"strings"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
|
||||
@@ -2,11 +2,12 @@ package game
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hk4e/pkg/endec"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"hk4e/pkg/endec"
|
||||
|
||||
"hk4e/gdconf"
|
||||
|
||||
"hk4e/common/constant"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"hk4e/pkg/object"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"hk4e/pkg/object"
|
||||
|
||||
"hk4e/common/constant"
|
||||
"hk4e/gdconf"
|
||||
"hk4e/gs/model"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"hk4e/common/constant"
|
||||
"hk4e/gdconf"
|
||||
"hk4e/gs/model"
|
||||
@@ -8,7 +10,6 @@ import (
|
||||
"hk4e/pkg/random"
|
||||
"hk4e/protocol/cmd"
|
||||
"hk4e/protocol/proto"
|
||||
"strconv"
|
||||
|
||||
pb "google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"hk4e/pkg/alg"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"hk4e/pkg/alg"
|
||||
|
||||
"hk4e/common/constant"
|
||||
"hk4e/gdconf"
|
||||
"hk4e/gs/model"
|
||||
|
||||
@@ -778,7 +778,7 @@ func (g *Game) TeleportPlayer(
|
||||
logger.Error("get world is nil, worldId: %v, uid: %v", player.WorldId, player.PlayerId)
|
||||
return
|
||||
}
|
||||
if WORLD_MANAGER.IsAiWorld(world) {
|
||||
if CommandPerm(player.CmdPerm) != CommandPermGM && WORLD_MANAGER.IsAiWorld(world) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user